Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 | |
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' |
This file contains 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
-- 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 |
This file contains 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 xml.dom import minidom | |
import fiona | |
from shapely.geometry import mapping, Point | |
from dateutil.parser import parse | |
def xml_to_python(xml_file): | |
output = [] |
This file contains 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
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: |
This file contains 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
#!/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 .. |
This file contains 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
function getBreaks($max, $min, $q){ | |
$quant = ($max - $min) / $q; | |
for ($x = 0; $x <= $q; $x++){ | |
$breakValue[$x] = $min+($quant*$x); | |
} | |
return $breakValue; | |
} |
This file contains 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
// 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); |
This file contains 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
//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 |
This file contains 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 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 - |
NewerOlder