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
# Install PostGIS | |
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" >> /etc/apt/sources.list' | |
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get install Postgresql-9.3-postgis postgresql-contrib | |
sudo -u postgres psql | |
# > CREATE EXTENSION adminpack; | |
# > \q |
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
# Set values using the '='. | |
# Text will default to strings url = http://testing/arcgis/rest/awesometest/MapServer | |
# Unless it looks like an integer threads = 1 | |
# or a floating point value = 510.128 | |
# If you put brackets around something, that makes it | |
# a section. The text inside the bracket is the section header [data] | |
# To create a sub-section, just add another bracket. | |
# I like to tab these suckers out to make it legible. | |
name = "example" |
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 - |
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
// 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
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
#!/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
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
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 = [] |
OlderNewer