[Mapbender-commits] r7814 - trunk/mapbender/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu May 12 04:21:34 EDT 2011
Author: apour
Date: 2011-05-12 01:21:34 -0700 (Thu, 12 May 2011)
New Revision: 7814
Modified:
trunk/mapbender/http/php/mod_digitize_splitLine.php
Log:
#232 done
Modified: trunk/mapbender/http/php/mod_digitize_splitLine.php
===================================================================
--- trunk/mapbender/http/php/mod_digitize_splitLine.php 2011-05-11 15:01:41 UTC (rev 7813)
+++ trunk/mapbender/http/php/mod_digitize_splitLine.php 2011-05-12 08:21:34 UTC (rev 7814)
@@ -10,8 +10,11 @@
require_once(dirname(__FILE__) . "/../classes/class_json.php");
$json = new Mapbender_JSON();
+$startPoint = null;
+$endPoint = null;
+$points = array();
+$lineArray = array();
-
function isLinestring($string) {
$floatPattern = "-?\d+(\.\d+)?";
$pointPattern = $floatPattern . " " . $floatPattern;
@@ -36,19 +39,13 @@
$intersection_sql = sprintf("SELECT ST_AsText(multipoint.geom) as point, "
." ST_AsText(ST_StartPoint('%s'::geometry)) AS startpoint,"
." ST_AsText(ST_EndPoint('%s'::geometry)) AS endpoint "
- ." FROM ST_Dump((SELECT ST_AsText(ST_Intersection('%s'::geometry,'%s'::geometry)))) AS multipoint;",
- $line1Text,$line1Text,$line1Text,$line2Text);
+ ." FROM ST_Dump((SELECT ST_AsText(ST_Intersection('%s'::geometry,'%s'::geometry)))) AS multipoint"
+ ." ORDER BY ST_Line_Locate_Point('%s'::geometry,ST_AsText(multipoint.geom)::geometry) ASC;"
+ ,$line1Text,$line1Text,$line1Text,$line2Text,$line1Text);
$res = db_query($intersection_sql);
-
// add first and last points to the array of intersectionpoints
-$startPoint = null;
-$endPoint = null;
-$points = array();
-$lineArray = array();
-
-
while ($row = db_fetch_array($res)) {
$startPoint = $row['startpoint'];
$endPoint = $row['endpoint'];
@@ -61,12 +58,8 @@
if(count($points) == 0){
$lineArray[] = $line1Text;
}else{
- $points = array_merge(array($startPoint),array_reverse($points),array($endPoint));
+ $points = array_merge(array($startPoint),$points,array($endPoint));
-// header("Content-type:application/x-json; charset=utf-8");
-// die($json->encode(array("geometries" => $points)));
-
-
// go through the point array in pairs, cut into segment, and add each segment onto resultArray
for($i = 0; $i < count($points)-1; $i++){
More information about the Mapbender_commits
mailing list