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
| '''This code will export the attachments associated with a feature class features into | |
| a folder naming output files using the feature's attribute provided''' | |
| import arcpy | |
| import os | |
| ##define input parameters for the tool | |
| #input attachments table | |
| in_table = arcpy.GetParameterAsText(0) | |
| #output folder to save files in | |
| file_location = arcpy.GetParameterAsText(1) |
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
| '''This is an ArcGIS Python add-in class for calculating the distance and the time | |
| between the two selected by user Route network analysis layer stops. This code is | |
| supposed to be wrapped into a Python add-in, but can also be executed as a standalone | |
| script tool with minor modifications. This code assumes that the route has been | |
| already solved and there are accumulators associated with the route solver''' | |
| import arcpy | |
| import arcpy.mapping as mp | |
| import pythonaddins | |
| arcpy.env.overwriteOutput = True |
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
| '''Find difference in gp tools between Pro and Desktop''' | |
| import json | |
| pro_tools = dict(json.load(open(r"C:\GIS\Temp\Pro_tools.json"))) | |
| desktop_tools = dict(json.load(open(r"C:\GIS\Temp\Desktop_tools.json"))) | |
| #to get tools present in Pro but not in Desktop | |
| for tbx, tools in pro_tools.iteritems(): | |
| print(tbx) | |
| for i in [str(tool) for tool in tools if tool not in desktop_tools.get(tbx,[])]: | |
| print(i) |
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
| using System; | |
| using ArcGIS.Core.Hosting; | |
| using ArcGIS.Core.Data; | |
| namespace SimplePro | |
| { | |
| public class DataManagement | |
| { | |
| public static string GetObjectIDField(string path, string shapefile) | |
| { |
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
| '''Python add-in that will find multiple k-alternate paths between a given number of stops. | |
| This code is supposed to be run in ArcMap map document with a Route Network Analysis layer | |
| named Route with at least two stops loaded. The impedance attribute name is read from a | |
| Route solver properties object.''' | |
| import os | |
| import arcpy | |
| import arcpy.mapping as mp | |
| import pythonaddins |
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
| UPDATE DBO.CITIES SET TYPE = 0 WHERE TYPE IS NULL | |
| ALTER TABLE DBO.CITIES | |
| ALTER COLUMN TYPE NVARCHAR(25) NOT NULL | |
| --create FK for feature class Cities and store legal values for the attribute Type in the table CityType | |
| ALTER TABLE DBO.CITIES DROP CONSTRAINT FK_CITYTYPES | |
| DROP TABLE CityType | |
| GO |
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 json | |
| import ogr | |
| driver = ogr.GetDriverByName('ESRI Shapefile') | |
| shp_path = r'C:\GIS\Temp\Counties.shp' | |
| data_source = driver.Open(shp_path, 0) | |
| fc = { | |
| 'type': 'FeatureCollection', | |
| 'features': [] |
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
| ''' | |
| Convert file geodatabase feature class features into GeoJSON and | |
| then construct text file for loading into elastic search bulk api | |
| ''' | |
| import json | |
| import arcpy | |
| arcpy.env.overwriteOutput = True | |
| #create a geojson file |
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
| ''' | |
| * generate a list of (x,y) for points along the route polyline feature class | |
| with the set interval (using arcpy); | |
| * save image from the API for each point trying to find the closest one as well | |
| as the one looking at the next point in the route (using requests); | |
| * merge the images into an output avi video file (using opencv); | |
| ''' | |
| import os | |
| import json |
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
| from __future__ import print_function | |
| import json | |
| import xml.etree.ElementTree as ET | |
| import ogr | |
| gdb_path = r'C:\GIS\data\Adv.gdb' | |
| ds = ogr.Open(gdb_path) | |
| res = ds.ExecuteSQL('select * from GDB_Items') | |
| res.CommitTransaction() |