This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create a map | |
m = folium.Map(location=[np.median(gdf_income_tax['centroid_lat'].tolist()), | |
np.median(gdf_income_tax['centroid_lon'].tolist())], | |
tiles='Stamen Toner', zoom_start=12) | |
## add chloropleth layer | |
m.choropleth( | |
geo_data=geojson, | |
name='Income Tax Per Capita', | |
data=gdf_income_tax, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def json_to_geojson(data, districts): | |
# create a geojson from a list of dictionaries | |
# containing coordinates with the name of the polygon | |
# in our case a polygon is a district | |
assert type(data) == list, "The parameter data should be a list of coordinates with a name argument!" | |
geojson = { | |
"type": "FeatureCollection", | |
"features": [ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36' | |
overpass_url = "http://overpass-api.de/api/interpreter" | |
overpass_query = """ | |
[out:json]; | |
area["ISO3166–1"="HU"][admin_level=2]; | |
( | |
rel["name"="I. kerület"](area); | |
); | |
out center; | |
""" |
NewerOlder