[mapserver-users] converting line object to series of points
Andy Colson
andy at squeakycode.net
Thu Apr 15 08:54:15 PDT 2010
On 4/15/2010 10:51 AM, Mark Brooks wrote:
> I'm using PHP Mapscript. I need a point every X meters along the line.
>
> Mark
>
>
> Andy Colson wrote:
>> On 4/15/2010 10:24 AM, Mark Brooks wrote:
>>> I have a line object that I need to to turn into points. How can I
>>> create a series of points from the line object?
>>>
>>> Mark
>>> NC State University
>>
>> A line has many many points. Which are you interested in? Just the
>> first and last? Any one point on the line? The mid-point? A point
>> every meter along the line? The closes point on the line to some other
>> object?
>>
>> I know of two options:
>> 1) use PostGIS:
>> select st_centroid(the_geom) from layer
>>
>> 2) use mapscript
>>
>>
>> -Andy
>
Does the line have a single start and end point? (a MULTILINE record
can have multiple lines (so multiple start and end points, all stuck
togethor).
In general, find the start and end points, use them to find the equation
of the line (y=mx+b if I recall correctly), then use that equation to
find one corrd based on another. (so, plug in a buch of x's to find
their y's).
-Andy
More information about the MapServer-users
mailing list