Adding the points to a map

To simply see the points on the map, we can supply a few parameters and call the show property of the CircleViz object:

viz = CircleViz('tract_points.geojson', access_token=token,                 radius = 2, center = (-122, 37.75), zoom = 8)viz.show()

The previous code will produce the output as follows:

To classify the data, we can set color stops for specific fields, passing class breaks as a list with associated color information:

color_stops = [    [0.0, 'rgb(255,255,204)'],    [500.0, 'rgb(255,237,160)'],    [1000.0, 'rgb(252,78,42)'],    [2500.0, 'rgb(227,26,28)'],    [5000.0, 'rgb(189,0,38)'], [max(tract_points['Total Population']),'rgb(128,0,38)'] ...

Get Mastering Geospatial Analysis with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.