Aquire x/y coordinates from rectangle object

G-Net Consulting joelf at GNETCONSULTING.COM
Tue Sep 7 13:24:17 EDT 2004


Lowell:

Thanks a bunch.  I really appreciate the help.

Joel

----- Original Message -----
From: "Lowell Filak" <lfilak at MEDINACO.ORG>
To: <MAPSERVER-USERS at LISTS.UMN.EDU>
Sent: Tuesday, September 07, 2004 12:04 PM
Subject: Re: [UMN_MAPSERVER-USERS] Aquire x/y coordinates from rectangle
object


> The following message was sent by Lowell Filak <lfilak at MEDINACO.ORG> on
> Tue, 7 Sep 2004 10:37:36 -0400.
>
>> The following message was sent by G-Net Consulting
>> <joelf at GNETCONSULTING.COM> on Sat, 4 Sep 2004 01:14:23 -0400.
>>
>> > Hello List:
>> >
>> > I'm looking for a snippet of code to grab the X/Y coordinates
>> > from a point in a shape file.  I've pulled the shape data in
>> > from the DBF (thanks to Lowell for that).  Now I would like
>> > to display the data in overLib with a mouseover.
>> >
>> > So what is the best way to get the X/Y for each shape
>> > in the chosen extent?
>> >
>> > Thanks.
>> >
>> > Joel
>>
>> Joel;
>>
>> You can:
>>
>> shapeObj = new shapeObj(type_point)
>>
>> use the shapeindex from resultCacheMemberObj with
>> layer->getShape(shapeObj, 0, shapeindex)
>>
>> pointObj=shapeObj->get(0)
>>
>> pointObj->{x} & pointObj->{y}
>>
>> The doc (at least swigmapscript) needs to be clearer on this.
>>
>> Lowell
>
> Joel;
>
> Here's a correct example.
>
> $data = $layer->{data};
> $shapefile = new mapscript::shapefileObj($data,-1);
> $point = new mapscript::pointObj();
> $shapefile->getPoint(shapeindex,$point);
> $x = $point->{x};
> $y = $point->{y};
>
> Lowell
>



More information about the mapserver-users mailing list