r - How to calculate centroid of polygon using sf::st_centroid? -


i trying manipulate brazilian census data in r using new "sf" package. able import data, error when try create centroids of original polygons

library(sf)  #donwload data   filepath <- 'ftp://geoftp.ibge.gov.br/organizacao_do_territorio/malhas_territoriais/malhas_de_setores_censitarios__divisoes_intramunicipais/censo_2010/setores_censitarios_shp/ac/ac_setores_censitarios.zip' download.file(filepath,'ac_setores_censitarios.zip') unzip('ac_setores_censitarios.zip') d <- st_read('12see250gc_sir.shp',stringsasfactors = f)  

now try create new geometry column containing centroid of column "geometry", error:

d$centroid <- st_centroid(d$geometry) warning message: in st_centroid.sfc(d$geometry) :   st_centroid not give correct centroids longitude/latitude data 

how can solve this?


Comments

Post a Comment

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -