View geojson.json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View csv2shp.py
import arcpy
import os
def csv2shp(csv_file, field_x, field_y, shape_file):
"""
Convert a CSV file with x/y fields into a Shapefile
"""
table_view = 'csv_file_as_view'
layer = 'xy_event_layer'
View arc2pgrouting
-- PG_Geometry Line feature class -> PG Routing
-- Add Required Fields
ALTER TABLE way ADD COLUMN "source" integer;
ALTER TABLE way ADD COLUMN "target" integer;
-- Build Topology (3D)
SELECT sde.pgr_createTopology3d('way', 0.01, 'shape', 'objectid')
-- Add Indices
View gist:9d46bb1d3a84e136b84a
from xml.dom import minidom
import fiona
from shapely.geometry import mapping, Point
from dateutil.parser import parse
def xml_to_python(xml_file):
output = []
View parseEsriBinaryGeometry
def ExtractInt(string, start_position):
"""
Loop through string till the next + or - sign and convert the stuff in between from 32-> integer
"""
result = []
stop = False
position = start_position
while not stop:
View gist:1a8358a38d2eae54c6e9
#!/usr/bin/env python
'''
This script creates an .sd from a .pyt
.. It assumes that all tools can be called with no parameters (i.e.,
all parameters are "optional". Not ideal for all services, but
works fine for services that arn't called from ArcMap anyway.
If you are calling your service from ArcMap, publish the traditional
way ..
View phpbreaks
function getBreaks($max, $min, $q){
$quant = ($max - $min) / $q;
for ($x = 0; $x <= $q; $x++){
$breakValue[$x] = $min+($quant*$x);
}
return $breakValue;
}
View gist:e6a09a5e7f65b1f7a903
// To call this from your php script, insert $kml_output .= getGeo($row['SHAPE']);
// or whatever the geometry field in your MYSQL DB table is
function getGeo($shape){
// Parse WKT style coordinates to KML style Coordinates
$shape = preg_replace("/([0-9.-]+) ([0-9.-]+),*/", "$1,$2,0 ", $shape);
// If the Geometry Type is a point parse the geometry type as a point
if (preg_match("/^POINT/", $shape)){
$shape = substr($shape, 6);
$shape = substr($shape, 0,-1);
View gist:352b049757f161e98df9
//Get Coordinates From Javascript Call
$latMin = $_GET["c1"];
$lonMin = $_GET["c2"];
$latMax = $_GET["c3"];
$lonMax = $_GET["c4"]; //Gather Coordinates Into a MySQL Polygon Geometry Type
$bounds = "GeomFromText('POLYGON((".$lonMin." ".$latMin.",".$lonMin."," .$latMax.",".$lonMax." ".$latMax.",".$lonMax." ".$latMin.",".$lonMin." ".$latMin."))')";
//Database Fields
View ConfigObjDemo2
# Import the ConfigObj library
from configobj import ConfigObj
# Parse the configuration file using ConfigObj
config = ConfigObj(filename)
# The ConfigObj library parses the configuration file as a
# python dictionary. Super Cool!
# This means you can do things like this -