Created
October 30, 2020 05:26
-
-
Save seanlinmt/f98c75a6d728125bf2fb6aecdb9a8562 to your computer and use it in GitHub Desktop.
Extracting features from an ArcGIS server using arcpy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arcpy | |
arcpy.env.overwriteOutput = True | |
baseURL = "https://services.arcgis.com/XTtANUDT8Va4DLwI/ArcGIS/rest/services/NZ_School_Zone_boundaries/FeatureServer/0/query" | |
where = "1=1" | |
fields = "OBJECTID,School_ID,School_name,Office,Approval_date,Effective_date,Institution_type,Shape__Area,Shape__Length" | |
query = "?where={}&outFields={}&returnGeometry=true&f=json".format(where, fields) | |
fsURL = baseURL + query | |
fs = arcpy.FeatureSet() | |
fs.load(fsURL) | |
arcpy.CopyFeatures_management(fs, "H:/temp/data.gdb/school_zones") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment