villaden.blogg.se

Theme hospital zoom out
Theme hospital zoom out








theme hospital zoom out
  1. #THEME HOSPITAL ZOOM OUT UPDATE#
  2. #THEME HOSPITAL ZOOM OUT SOFTWARE#
  3. #THEME HOSPITAL ZOOM OUT CODE#

I do not need to do anything special here, the contextily add_basemap function figures it all out for me, given that I pass in the coordinate reference system of the basemap. Which I add to the plot after this, and increase the default size.įinally I add my basemap. This is necessary to have those objects saved into the matplotlib legend. Note I gave the outline a label, as well as the hospitals. Since the projected units are in meters, I just draw a rectangle that is 5 kilometers longways. The scale bar is more straightforward – I just plot a rectangle on the matplotlib plot, and then put text in the middle of the bar. (If it isn’t, you will need to adjust this for your map.) The north arrow is using annotations and arrows, so this just relies on the fact that north is up in the plot.

#THEME HOSPITAL ZOOM OUT CODE#

Next I have some hacky code to do the north arrow and scale bar. Here I use the default plotting methods from geopandas boundary plot to create a base matplotlib plot object with the Philly border outline. If you happened to want to stick to typical web map projections though geopandas makes it quite easy using geo_dat.to_crs('epsg:4326'). So I prefer to stick to projected maps when I can. I thought at first you needed to only use typical web map projections to grab the tiles, but Dani Arribas-Bel has done a bunch of work to make this work for any projection. Note that the background is in projected coordinates, so then I use some updated pyproj code to transform the lat/lon into the local projection I am using.

theme hospital zoom out

The next part we load in our shapefile into a geopandas data frame (just a border for Philly), then I just define the locations of hospitals (with level 1 trauma facilities) in text in the code. (andy_theme) Data Prep with geopandas & pyproj Os.chdir(r'D:\Dropbox\Dropbox\School_Projects\Shooting_Survival_Philly\Analysis\OriginalData'

#THEME HOSPITAL ZOOM OUT UPDATE#

Then I change my working directory to where I have my data, and then update my personal matplotlib defaults.

theme hospital zoom out

So here I need geopandas, pyproj, & contexily as non-traditional libraries. So at the recommendation of the geopandas folks, I just created my own conda environment for geospatial stuff, and that has worked nicely so far. Most recently the issue was older version of pyproj and epsg codes were giving me fits. So first, I have consistently had a difficult time working with the various geo tools in python on my windows machine. (And are honestly nicer than I could personally make even with the original vector data anyway).īelow I walk through the python code, but the data to replicate my paper with Gio can be found here, including the updated base map python script and shapefile data. That is quite a bit of work though, so for a more general solution these basemaps are really great. So if you are a crime analyst working for a specific city, it may make sense to pull the original vector data for streets/highways and create your own style for your maps. Here is the map we will be producing in the end:

theme hospital zoom out

#THEME HOSPITAL ZOOM OUT SOFTWARE#

I would typically do this in ArcMap, but since I do not have access to that software anymore, I took some time to learn the contextily library in python to accomplish the same task. Me and Gio received a peer review asking for a nice basemap in Philadelphia showing the relationship between hospital locations and main arterials for our paper on shooting fatalities.










Theme hospital zoom out