Updated Spatial data for Germany on county level - r

I didn't find updated Spatial data for Germany on county level. I used a SpatialPolygonsDataFrame from gadm before, which were perfect until some reforms concerning administrative boundaries. Further, I tried an updated version from Geodatenzentrum, but I didn't get a complete map of all German counties or had failed to transform UTM 32 data properly.
If anyone has an idea how to get these data it would be great.

Are the openstreetmap administrative areas appropriate?
http://download.geofabrik.de/europe/germany.html

Related

Adding geography to tmap World data frame

I need to map data of South America and the Caribbean, including small geographies such as St. Vincent and the Grenadines. However, in the World data set with the tmap library these are not included. Using the included spatial data base of the tmap library seems easier than finding, loading, parsing and cleaning a different shape file from some other sources. Is it possible to insert these countries or should I just fight through learning the details of GIS just to draw a simple thematic map of the Caribbean?
I have battled with reading shape files from OSM today and other mapping packages. Tmap is a great approach for us non-GIS professionals.
Thanks for any direction you can give.

Searching for postal code map of Germany for R

I'm searching for a map of Germany which is divided into the different postal codes and could be coloured in R. Possible would be a map like this on wikipedia:
https://upload.wikimedia.org/wikipedia/commons/c/cd/Karte_Paketzentren_Deutsche_Post_AG.png
Is there any package which is supporting this?
You can download the Geojson (I advise this format) from https://public.opendatasoft.com/explore/dataset/postleitzahlen-deutschland/export/
You can then read the Geojson with the sf package. You will find support for this on stackoverflow. Through the sf package you will have graphing possibilities with various other packages.
You can also download shapefiles for "Landkreis" and other administrative areas in Germany on this site.

Using leaflet with large data - ACS data for all counties in U.S

I'm plotting ACS data (counts of low-income children) for each county across the entire U.S. I don't have any markers, just a county shapefile and 6 values for each county that are in separate layers.
Unsurprisingly this is too large for browsers to handle. I've seen some similar questions here that deal with clustering, but since I have nothing to cluster I'm starting a new question.
I've tried breaking it up into 6 regional maps, but even those are too much.
Is there some way to lower the footprint, but still have all the county specific data?
I've looked at tilemill and other options for only loading the data the user is currently viewing and based on the zoom level, but I can't find any information on how to go from an R generated leaflet map to something like that. Alternatives using this route are useful as well.
You can try to simplify the polygons using the rmapshaper package and then try visualising it with mapview. The former will help get rid of 'unnecessary' polygon vertices, while the latter has dedicated functions to enable leaflet rendering of large data (ballpark around 100k features - depending on complexity).
You might also consider the tigris package, which gets you direct access to low-resolution county shapefiles within R:
library(tigris)
library(leaflet)
cty <- counties(cb = TRUE, resolution = "20m")
leaflet(cty) %>% addTiles() %>% addPolygons()
This should allow your Leaflet map to perform well in-browser as the polygons are pre-simplified, if you choose to go this route.

Display only a single state with ggmap

Is there a simple way to display only a single state? For example
qmap("Texas", zoom=6)
produces
which obviously also includes all of Oklahoma, most of New Mexico, etc...is there a way to "mask" the surrounding states (and Mexico) to display only Texas?
The short answer is that you need to tell ggmap where Texas is. Typically you'd do that using a shapefile. See e.g.
R: ggmap – Overlay shapefile with filled polygon of regions
Plotting Choropleths from Shapefiles in R with ggmap

Themathic map/choropleth map of the Netherlands

I have a bunch of data on Dutch individuals that I would like to visualize with a choropleth map. I also have the location of the individuals (longitude and latitude), so I was hoping that it would be possible to visualize that on a Dutch map that is divided into municipalities (="gemeente" in Dutch), so I can color each municipality according to the mean value of all individuals living there. I know that the R package maptools can make choropleth maps, but I believe that it requires template maps in the form of a .shp file. Does anyone know where I could find such a template for the Netherlands? Preferably with municipalities and NOT per province, so for this image it would be the one on the left:
(source: www.kb.nl)
Any suggestions for other packages/software/etc to do this are also welcome! Many thanks!
also try GADM: http://www.gadm.org/
This site is an excellent resource, extra bonus: .Rdata is one of the formats you can download in (containing a SpatialPolygonsDataFrame). They also have .shp format, for your case.
Your main problem will be finding a shapefile for the municipalities. Once you have that and can easily relate your data at the lat/long level to the municipalities, then plotting becomes easy.
ggplot2 is a fantastic example.
Choropleths in R is a potential example, because it does not use shapefiles, but I believe the maps package supports it
Failing that, you could always try Weave
There are various .shp files for the Netherlands here:
http://www.eea.europa.eu/data-and-maps/data/eea-reference-grids/
You might also be able to find the municipalities layer on GeoCommons and join your data with one of those layers. GeoCommons makes it really easy to make many different choropleth maps quickly.
Another source for shapefiles at Eurostat is here. However, with a restrictive license, and I believe only at NUTS3 level (I did not look at it, though).
Open Streetmap does contain administrative boundaries,but not as polygons. Here is a report about how to transform boundaries to polygons. (I did not try)
You can find recent official Dutch maps here: https://www.pdok.nl/nl/producten/pdok-downloads/basis-registratie-kadaster/bestuurlijke-grenzen-actueel in .gml and .xsd formats (not in .shp unfortunately). National borders, province and municipality.

Resources