Before we start, did you have followed the setup steps described at here
Let’s explore data
Source of our data for this sample:
Source: http://geosampa.prefeitura.sp.gov.br/
Population = downloadAndUnzipShp("http://geosampa.prefeitura.sp.gov.br/PaginasPublicas/downloadArquivoOL.aspx?orig=DownloadCamadas&arq=02_Popula%E7%E3o%5C%5CDensidade%20Demogr%E1fica%5C%5CShapefile%5C%5CSAD69_SHP_densidade_demografica_2010&arqTipo=Shapefile")
Population1 <- readOGR(dsn=Population$dir[1], layer=Population$shapeclass[1])
#Converting the Coordinates from UTM to Degrees
Population1inDegrees <- utm2decimalSouth(Population1,23,"WGS84")
geojson_write( Population1inDegrees, lat = Population1inDegrees[,2], lon = Population1inDegrees[,1],file = "/home/rstudio/populationSP")
File Saved at: /home/rstudio/populationSP.geojson Copying it to your machine:
docker cp r_workbench:/home/rstudio/populationSP.geojson ~/Downloads/
You can test the generated file at: http://geojson.io/
D3.JS Rendering Section
Attention: This page loads 50MB of data to render the area below, be adviced on data consumption when accessing it.
References:
http://geojson.io/ https://cran.r-project.org/web/packages/geojsonio/README.html http://www.dummies.com/how-to/content/how-to-create-a-data-frame-from-scratch-in-r.html http://bl.ocks.org/sgruhier/1d692762f8328a2c9957
comments powered by Disqus