Creating point data from polygons

The Bay Area census tracts GeoJSON file has population data with polygon geometry. To create the first visualization we need to convert the geometry type to point:

tracts = gpd.read_file(r'tracts_bayarea.geojson')
tracts['centroids'] = tracts.centroid
tract_points = tracts
tract_points = tract_points.set_geometry('centroids')
tract_points.plot()

The output of the previous code is as follows:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset