Skip to content

Instantly share code, notes, and snippets.

View AlexArcPy's full-sized avatar

Alexey Tereshenkov AlexArcPy

View GitHub Profile
@AlexArcPy
AlexArcPy / filter_states.r
Last active August 12, 2016 16:21
arcgisbinding R package for running R scripts as ArcGIS geoprocessing script tools
options(scipen=999)
tool_exec <- function(in_param, out_param)
{
#load feature class into dataset
#can use 'C:\\Program Files (x86)\\ArcGIS\\Desktop10.4\\TemplateData\\TemplateData.gdb\\USA\\states'
data = arc.open(path = in_param[[1]])
#get subregion name from user
sub_region = in_param[[2]]
@AlexArcPy
AlexArcPy / pandas_df_from_fc.ipynb
Last active July 9, 2022 14:24
Make pandas data frame from feature class with shape
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AlexArcPy
AlexArcPy / iterating_arcpy_object.ipynb
Last active September 28, 2016 07:51
Iterating through the properties of arcpy objects
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AlexArcPy
AlexArcPy / get_mapservice_sources.py
Created November 2, 2016 17:03
Get data sources that are used by ArcGIS Server map services with Python
'''
Script to list data sources (feature classes paths) that are served by a map service
as well as map document that was used for publishing a service.
The script will report this information for all map services on the ArcGIS Server.
It is required to have an Administrator level user account to be able to log in into
the ArcGIS Server Administrator Directory.
'''
import collections
@AlexArcPy
AlexArcPy / get_mapservice_sources.ipynb
Created November 2, 2016 17:05
Get data sources that are used by ArcGIS Server map services with Python - Jupyter notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AlexArcPy
AlexArcPy / arcpy_named_tuples.py
Created November 9, 2016 16:08
Using Python named tuples for feature class records
from collections import namedtuple
import arcpy
fc = r'C:\Program Files (x86)\ArcGIS\Desktop10.4\TemplateData\TemplateData.gdb\USA\states'
#creating a defintion of a named tuple with fields from feature class
fields = [field.name for field in arcpy.ListFields(fc)]
state = namedtuple('StateFeature',field_names=fields)
#generating named tuples for features in feature class
@AlexArcPy
AlexArcPy / test.geojson
Last active January 5, 2022 10:11
GeoJSON
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AlexArcPy
AlexArcPy / ags_networkserver_samples.ipynb
Created December 4, 2016 11:07
Network analysis with ArcGIS Server
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AlexArcPy
AlexArcPy / spatial_sqlite_arcgis.ipynb
Created December 14, 2016 14:53
Using ArcGIS and SQLite for ST_Geometry functions
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AlexArcPy
AlexArcPy / gdb_to_sqlite.py
Created December 17, 2016 14:19
Load Esri file geodatabase feature classes into SQLite spatial table
from __future__ import print_function
import sys
print(sys.version)
print(sys.executable)
import os
import sqlite3
import arcpy
from time import strftime