import json
from esridump.dumper import EsriDumperScraping Data from ArcGIS StoryMaps
In [2]:
In [3]:
layer_num = 11In [4]:
# d = EsriDumper('http://example.com/arcgis/rest/services/Layer/MapServer/1')
k1835_endpoint = 'https://services.arcgis.com/3xOwF6p0r7IHIjfn/arcgis/rest/services/KurdPop1835/FeatureServer/0'
principalities_1835_endpoint = 'https://services.arcgis.com/3xOwF6p0r7IHIjfn/arcgis/rest/services/Kurd1835/FeatureServer/9'
sevres_endpoint = 'https://services.arcgis.com/3xOwF6p0r7IHIjfn/arcgis/rest/services/Treaty_of_Sevres/FeatureServer/11/'
k47_endpoint = 'https://services.arcgis.com/3xOwF6p0r7IHIjfn/ArcGIS/rest/services/Kurdistan1947Boundaries/FeatureServer/10'
cur_endpoint = 'https://services.arcgis.com/3xOwF6p0r7IHIjfn/arcgis/rest/services/Kurdistan_Current_Boundary_Estimates/FeatureServer/15'
ed_object = EsriDumper(k47_endpoint)In [5]:
ed_object<esridump.dumper.EsriDumper at 0x108895410>
In [6]:
krd_features = list(ed_object)In [7]:
len(krd_features)1
In [8]:
krd_feature = krd_features[0]
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]:
krd_feature['type']'Feature'
In [14]:
krd_feature['properties']{'OBJECTID': 1,
'area': 41360557.05027756,
'Shape__Area': 413605942350.6803,
'Shape__Length': 4362383.882545892}
In [16]:
krd_geom = krd_feature['geometry']In [17]:
type(krd_geom)dict
In [18]:
krd_geom.keys()dict_keys(['type', 'coordinates'])
In [19]:
krd_geom['type']'Polygon'
In [21]:
krd_coords = krd_geom['coordinates']