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
# 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 |
NewerOlder