Python Geo Pandas allows Python to work with geospatial data. In this case we read-in Geojson files.
Plotting with Geo Pandas |
Source code
The following outlines the Python code used:
import geopandas as gpd import matplotlib.pyplot as plt import sys val=0 file='1111' if (val==0): fi="eer.json" if (val==1): fi="us.json" if (val==2): fi="canada.json" if (val==3): fi="france.json" if (val==4): fi="germany.json" if (val==5): fi="au.json" df = gpd.read_file("c:\\inetpub\\wwwroot\\log\\"+fi) df.plot() f2= file+".svg" plt.savefig(f2,format='SVG') f2= file+".png" plt.savefig(f2,format='PNG') #plt.show()
Outline
An outline of the GeoJson file is:
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"scalerank":1,"featurecla":"Admin-0 country","labelrank":2,"sovereignt":"United Kingdom","sov_a3":"GB1","adm0_dif":1,"level":2,"type":"Country","admin":"United Kingdom","adm0_a3":"GBR","geou_dif":0,"geounit":"United Kingdom","gu_a3":"GBR","su_dif":0,"subunit":"United Kingdom","su_a3":"GBR","brk_diff":0,"name":"United Kingdom","name_long":"United Kingdom","brk_a3":"GBR","brk_name":"United Kingdom","brk_group":null,"abbrev":"U.K.","postal":"GB","formal_en":"United Kingdom of Great Britain and Northern Ireland","formal_fr":null,"note_adm0":null,"note_brk":null,"name_sort":"United Kingdom","name_alt":null,"mapcolor7":6,"mapcolor8":6,"mapcolor9":6,"mapcolor13":3,"pop_est":62262000,"gdp_md_est":1977704,"pop_year":0,"lastcensus":2011,"gdp_year":2009,"economy":"1. Developed region: G7","income_grp":"1. High income: OECD","wikipedia":-99,"fips_10":null,"iso_a2":"GB","iso_a3":"GBR","iso_n3":"826","un_a3":"826","wb_a2":"GB","wb_a3":"GBR","woe_id":-99,"adm0_a3_is":"GBR","adm0_a3_us":"GBR","adm0_a3_un":-99,"adm0_a3_wb":-99,"continent":"Europe","region_un":"Europe","subregion":"Northern Europe","region_wb":"Europe & Central Asia","name_len":14,"long_len":14,"abbrev_len":4,"tiny":-99,"homepart":1},"geometry":{"type":"MultiPolygon","coordinates":[[[[-1.065576171874966,50.69023437500002],[-1.149365234374983,50.65571289062501],...]]]]}}]}