Re: It's possible delimit a shapefile very extent using R? (Roger Bivand)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: It's possible delimit a shapefile very extent using R? (Roger Bivand)

Caridad Serrano Ortega
Hi Rober,

My script with R is intermedi level and the english is basic one. Is this
your answer?

pas_file<- readOGR("D:/DATOS", "CoveredArea")

pas_file@bbox # Extend all
pas_file@polygons[[1]]@Polygons[[1]]@coords # Coordinates from the first
polygon
pas_file@polygons[[1]]@Polygons[[1]]@coords[,1] # All x from the first
polygon
pas_file@polygons[[1]]@Polygons[[1]]@coords[,2] # All y from the first
polygon
max(pas_file@polygons[[1]]@Polygons[[1]]@coords[,1])
min(pas_file@polygons[[1]]@Polygons[[1]]@coords[,1])
max(pas_file@polygons[[1]]@Polygons[[1]]@coords[,2])
min(pas_file@polygons[[1]]@Polygons[[1]]@coords[,2])

The shape file is a spatialPolygonsDataFrame so look at this link:
http://strimas.com/r/tidy-sf/

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: It's possible delimit a shapefile very extent using R? (Roger Bivand)

Roger Bivand
Administrator
Hi Caridad,

You may be right, that Geomar actually meant the bounding box or
coordinates of each polygon - thanks for trying to clarify. I think we'll
have to Geomar to explain what is needed.

Roger

On Sun, 10 Nov 2019, Caridad Serrano Ortega wrote:

> Hi Rober,
>
> My script with R is intermedi level and the english is basic one. Is this
> your answer?
>
> pas_file<- readOGR("D:/DATOS", "CoveredArea")
>
> pas_file@bbox # Extend all
> pas_file@polygons[[1]]@Polygons[[1]]@coords # Coordinates from the first
> polygon
> pas_file@polygons[[1]]@Polygons[[1]]@coords[,1] # All x from the first
> polygon
> pas_file@polygons[[1]]@Polygons[[1]]@coords[,2] # All y from the first
> polygon
> max(pas_file@polygons[[1]]@Polygons[[1]]@coords[,1])
> min(pas_file@polygons[[1]]@Polygons[[1]]@coords[,1])
> max(pas_file@polygons[[1]]@Polygons[[1]]@coords[,2])
> min(pas_file@polygons[[1]]@Polygons[[1]]@coords[,2])
>
> The shape file is a spatialPolygonsDataFrame so look at this link:
> http://strimas.com/r/tidy-sf/
>

--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: [hidden email]
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway