shapefile
This commit is contained in:
parent
01e9fe7eba
commit
15cb798263
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
// Query
|
// Query
|
||||||
|
|
||||||
require_once("../config.db.php");
|
|
||||||
require_once ("../config.php");
|
require_once ("../config.php");
|
||||||
|
|
||||||
|
|
||||||
@ -22,13 +21,14 @@ $coords_array = array ();
|
|||||||
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||||
$coords_array[]=$row;
|
$coords_array[]=$row;
|
||||||
}
|
}
|
||||||
|
//DEBUG echo "<pre>"; print_r($coords_array); echo "</pre>";
|
||||||
|
|
||||||
// If no results are found, echo a message and stop
|
// If no results are found, echo a message and stop
|
||||||
//if ($coords_array == false) { echo "No results"; exit; }
|
//if ($coords_array == false) { echo "No results"; exit; }
|
||||||
|
|
||||||
unlink ("shape/ideenmelder.shp");
|
if (file_exists("shape/ideenmelder.shp")) {unlink ("shape/ideenmelder.shp");}
|
||||||
unlink ("shape/ideenmelder.dbf");
|
if (file_exists("shape/ideenmelder.dbf")) {unlink ("shape/ideenmelder.dbf");}
|
||||||
unlink ("shape/ideenmelder.shx");
|
if (file_exists("shape/ideenmelder.shx")) {unlink ("shape/ideenmelder.shx");}
|
||||||
//unlink ("shape/ideenmelder.dbt");
|
//unlink ("shape/ideenmelder.dbt");
|
||||||
|
|
||||||
require_once('../vendor/Shapefile/ShapefileAutoloader.php');
|
require_once('../vendor/Shapefile/ShapefileAutoloader.php');
|
||||||
@ -43,10 +43,9 @@ use Shapefile\Geometry\Point;
|
|||||||
try {
|
try {
|
||||||
// Open Shapefile
|
// Open Shapefile
|
||||||
$Shapefile = new ShapefileWriter('shape/ideenmelder.shp');
|
$Shapefile = new ShapefileWriter('shape/ideenmelder.shp');
|
||||||
|
|
||||||
// Set shape type
|
// Set shape type
|
||||||
|
|
||||||
$Shapefile->setShapeType(Shapefile::SHAPE_TYPE_POINT);
|
$Shapefile->setShapeType(Shapefile::SHAPE_TYPE_POINT);
|
||||||
|
|
||||||
// Create field structure
|
// Create field structure
|
||||||
$Shapefile->addNumericField('ID', 10);
|
$Shapefile->addNumericField('ID', 10);
|
||||||
$Shapefile->addCharField('DESC');
|
$Shapefile->addCharField('DESC');
|
||||||
@ -55,7 +54,7 @@ try {
|
|||||||
$Shapefile->addCharField('DEFECT',60);
|
$Shapefile->addCharField('DEFECT',60);
|
||||||
|
|
||||||
foreach ($coords_array as $coords) {
|
foreach ($coords_array as $coords) {
|
||||||
//echo "Coords ".$coords['id'].":";print_r($coords);echo "<hr>";
|
//DEBUG echo "Coords ".$coords['id'].":";print_r($coords);echo "<hr>";
|
||||||
// Create a Point Geometry
|
// Create a Point Geometry
|
||||||
$lat=$coords['lat'];
|
$lat=$coords['lat'];
|
||||||
$lon=$coords['lng'];
|
$lon=$coords['lng'];
|
||||||
|
Loading…
Reference in New Issue
Block a user