In [1]:
from lets_plot import *
LetsPlot.setup_html()
In [2]:
from lets_plot.geo_data import *
The geodata is provided by © OpenStreetMap contributors and is made available here under the Open Database License (ODbL).
In [3]:
# No level - autodetect, in case of ambiguity take state
regions(request="New York")
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
C:\Temp/ipykernel_5016/3345970821.py in <module>
      1 # No level - autodetect, in case of ambiguity take state
----> 2 regions(request="New York")

NameError: name 'regions' is not defined
In [ ]:
# city
regions(request='New York', level='city')
In [ ]:
regions_builder(request='warwick', level='city').allow_ambiguous().build()
In [ ]:
from shapely.geometry import box
regions_builder(request='warwick', level='city') \
    .where('warwick', within=box(-71.488034, 41.685644, -71.367528, 41.744844)) \
    .build()
In [ ]:
boston = regions(request='boston', within='usa')
regions_builder(request='warwick', level='city') \
    .where('warwick', near=boston) \
    .build()
In [ ]:
c = regions(level="country")
In [ ]:
states = regions(request='us-48')
In [ ]:
ggplot() + geom_point(map=states, color='black', size=10)
In [ ]:
ggplot() + geom_polygon(aes(fill='request'), data=states, map=states, map_join=('request', 'request'))