import json
from esridump.dumper import EsriDumper
Scraping Data from ArcGIS StoryMaps
In [2]:
In [3]:
= 11 layer_num
In [4]:
# d = EsriDumper('http://example.com/arcgis/rest/services/Layer/MapServer/1')
= 'https://services.arcgis.com/3xOwF6p0r7IHIjfn/arcgis/rest/services/KurdPop1835/FeatureServer/0'
k1835_endpoint
= 'https://services.arcgis.com/3xOwF6p0r7IHIjfn/arcgis/rest/services/Kurd1835/FeatureServer/9'
principalities_1835_endpoint
= 'https://services.arcgis.com/3xOwF6p0r7IHIjfn/arcgis/rest/services/Treaty_of_Sevres/FeatureServer/11/'
sevres_endpoint
= 'https://services.arcgis.com/3xOwF6p0r7IHIjfn/ArcGIS/rest/services/Kurdistan1947Boundaries/FeatureServer/10'
k47_endpoint
= 'https://services.arcgis.com/3xOwF6p0r7IHIjfn/arcgis/rest/services/Kurdistan_Current_Boundary_Estimates/FeatureServer/15'
cur_endpoint
= EsriDumper(k47_endpoint) ed_object
In [5]:
ed_object
<esridump.dumper.EsriDumper at 0x108895410>
In [6]:
= list(ed_object) krd_features
In [7]:
len(krd_features)
1
In [8]:
= krd_features[0]
krd_feature len(krd_feature)
3
In [40]:
with open('krd_47.geojson', 'w') as infile:
json.dump(krd_feature, infile)
In [21]:
print("ESRI Type:", krd_feature['type'])
print("ESRI Properties:", krd_feature['properties'])
print("Geometry Type:", krd_feature['geometry']['type'])
print("First Coordinate:",krd_feature['geometry']['coordinates'][0][0])
ESRI Type: Feature
ESRI Properties: {'OBJECTID': 1, 'area': 41360557.05027756, 'Shape__Area': 413605942350.6803, 'Shape__Length': 4362383.882545892}
Geometry Type: Polygon
First Coordinate: [37.6952778, 39.2168218]
In [9]:
krd_feature.keys()
dict_keys(['type', 'geometry', 'properties'])
In [13]:
'type'] krd_feature[
'Feature'
In [14]:
'properties'] krd_feature[
{'OBJECTID': 1,
'area': 41360557.05027756,
'Shape__Area': 413605942350.6803,
'Shape__Length': 4362383.882545892}
In [16]:
= krd_feature['geometry'] krd_geom
In [17]:
type(krd_geom)
dict
In [18]:
krd_geom.keys()
dict_keys(['type', 'coordinates'])
In [19]:
'type'] krd_geom[
'Polygon'
In [21]:
= krd_geom['coordinates'] krd_coords