Get line and line points

Nicol Hermann mapserver at GEOWORLD.DE
Wed Aug 10 01:15:53 EDT 2005


Hi Ryan,

joerg p posted a little script a while ago.

http://lists.umn.edu/cgi-bin/wa?A2=ind0506&L=mapserver-users&P=R115632&D=0&H=0&I=-3&O=T&T=0&X=65DF737538283E5E65&Y=mapserver%40geoworld.de


<schnip>
$testshape = ms_newShapefileObj("data/country", -1);
print_r($testshape);
echo "<br><hr>";
for($i=0; $i < $testshape->numshapes; $i++){
        echo $i.":    ";
     print_r($singleshape = $testshape->getShape($i));
        echo "<br>";
        for($j=0; $j < $singleshape->numlines; $j++){
                $singleline = $singleshape->line($j);
                for($k=0; $k < $singleline->numpoints; $k++){
                        $singlepoint = $singleline->point($k);
                        print_r($singlepoint);
                }
        }
        echo "<hr><br><br>";
}
</schnip>

HTH
Nicol


Am Montag, den 08.08.2005, 14:03 -0500 schrieb Ryan Feagin:
> Hi. I've just recently started using mapserver with PHP mapscript.
> 
> I'm trying to find a specific line segment from a shapefile, and then find
> a point x distance on the line to be able create a geocoded point.  Can
> someone give me an example in php of how get to the line segment and how
> to access its node points?  I have started unsuccessfully playing around
> with the following:
> 
>   $shapefile = ms_newShapefileObj($streetFile, -1);
>   $s = ms_newShapeObj(-1);
>   $shapefile->getShape(1, $s);
> 
>   $line = ms_NewLineObj();
>   $line = $s->{line};
> 
>   echo $line->numpoints;
> 
> I get nothing back.
> 
> Thanks for you help



More information about the mapserver-users mailing list