April 2018
Beginner to intermediate
440 pages
11h 36m
English
To perform geospatial analysis, using the cloud datasets, we can connect using CARTOframes and perform spatial queries using a combination of GeoPandas and Shapely. In this example, the NBA arenas dataset is compared against a US States shapefile using an intersects spatial query. If the arena object intersects with a state object, the name of the arena and the state are printed:
import geopandas as gdpimport cartoframesimport pandas as pdAPIKEY = "1353407a098fef50ec1b6324c437d6d52617b890"cc = cartoframes.CartoContext(base_url='https://lokiintelligent.carto.com/', api_key=APIKEY)from shapely.geometry import Pointfrom shapely.wkb import loadsarenas_df = cc.read('arenas_nba')shp = r"C:\Data\US_States\US_States.shp"states_df ...