[R-sig-Geo] Dimensions problem when extracting latitude and longitude from shapefiles in multipolygon format in lambert 93 format
Zivan Karaman
z|v@n@k@r@m@n @end|ng |rom gm@||@com
Sat May 11 15:00:14 CEST 2024
Hi,
What you probably want is
nrow(st_coordinates(st_centroid(sentrau)))
which is equal to now(sentrau)
nrow(st_coordinates(sentrau)) is equal to sum(sapply(1:nrow(sentrau), FUN = function(i) nrow(st_coordinates(sentrau[i, ]))))
as sentrau is MULTIPOLYGON
Hope this helps.
> On 11 May 2024, at 13:47, Aymard Loïc KWEKEU KWEKEU <kwekeuaymardloic using gmail.com> wrote:
>
>> hos <- geo[!sf::st_is_empty(geo), ]
>
>> santrau <-cbind(hos, st_coordinates(st_centroid(hos$geometry)))
>
>> sontrau <- subset(santrau, select=c(1:40))
>
>> sentrau <- na.omit(sontrau)
>
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list