2

How can I add all geometries included in a FeatureSet to a web map?

Trying to add geometries (i.e., shapes) to a Jupyter notebook web map (see code sample below).

Adding features from the ArcGIS server is a breeze. But what about adding from third parties?

My geometries are first imported as a .geojson, which I convert to an arcgis.feature.FeatureSet.

For each feature in the set, I'd like to use the coordinates of each shape to add that shape to a web map.

Setup: latest anaconda python with arcgis API v.1.4 on a Linux 16.04 box.

import arcgis
from IPython.display import display
import requests

# link build
HI_geo_stem = 'https://opendata.arcgis.com/datasets/'
HI_parcels_json = '1eb5fa03038d49cba930096ea67194e0_5'
parcels_link = ''.join([HI_geo_stem, HI_parcels_json, '.geojson'])

# read in parcel json
raw_parcels_json = requests.get(parcels_link).json()

# convert json to arcgis FeatureSet
hi_arc_parcels = arcgis.features.FeatureSet.from_geojson(raw_parcels_json)

# display a web mapgis = arcgis.GIS("https://www.arcgis.com")
m = gis.map("Hawaii", zoomlevel = 10)‍‍‍‍‍‍‍‍‍‍‍‍

# now display hi_arc_parcels in web map m‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ ??

1 Answer 1

2

So with quite a bit more digging around in the sample notebooks provided by ESRI, I found the map.draw method. It can take both features and featuresets and draw their shapes onto a web map. The only problem is that with large featuresets (>100k in my case ), the browser can take a long time to output and you'll get messages asking you to kill the running script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.