Skip to content

Instantly share code, notes, and snippets.

@ojoaoaugusto
ojoaoaugusto / LUOSMapService2ShapefileIterate.py
Last active October 19, 2017 16:50 — forked from TheBryanMac/MapService2ShapefileIterate.py
Python script that connects to an ArcGIS Server Map Service and downloads a single vector layer to shapefiles. If there are more features than AGS max allowed, it will iterate to extract all features.
#Name: Export ArcGIS Server Map Service Layer to Shapefile with Iterate
#Author: Bryan McIntosh
#Description: Python script that connects to an ArcGIS Server Map Service and downloads a single vector layer
# to shapefiles. If there are more features than AGS max allowed, it will iterate to extract all features.
import urllib2,json,os,arcpy,itertools
ws = os.getcwd() + os.sep
#Set connection to ArcGIS Server, map service, layer ID, and server max requests (1000 is AGS default if not known).
serviceURL = "https://www.geoservicos1.segeth.df.gov.br/arcgis/rest/services"
@ojoaoaugusto
ojoaoaugusto / luosMapService2Shapefile.py
Last active October 19, 2017 15:25 — forked from TheBryanMac/MapService2Shapefile.py
Export ArcGIS Server Map Service Layer to Shapefile
#Name: Export ArcGIS Server Map Service Layer to Shapefile
#Author: Bryan McIntosh
import urllib2, os, arcpy
# Variables
myUrl = "https://www.geoservicos1.segeth.df.gov.br/arcgis/rest/services"
myService = "/Luos/LUOS_PLC/MapServer"
myParams = "/0/query?where=1%3D1&text=&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&relationParam=&outFields=&returnGeometry=true&returnTrueCurves=false&maxAllowableOffset=&geometryPrecision=&outSR=&returnIdsOnly=false&returnCountOnly=true&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&gdbVersion=&returnDistinctValues=false&resultOffset=&resultRecordCount=&queryByDistance=&returnExtentsOnly=false&datumTransformation=&parameterValues=&rangeValues=&f=pjson"
# Query ArcGIS Server Map Service