[Mapserver-users] shpxy
Paul Spencer
spencer at dmsolutions.ca
Wed Mar 10 12:07:02 PST 2004
Steve,
sorry, it does work for polygons but it doesn't do what I want :)
Subtle difference.
I am generating an imagemap dynamically and the onmouseover handler of
the areas is supposed to position a dhtml div at a specific location,
the javascript I am using to do this means that I put function calls in
the onmouseover handler so I don't have access to the event object in
all browsers. So instead, for points, I output the x/y into the
javascript function call ... which works nicely. For polygons, I had
nothing (until now ;)) to put in the template to return a position to
display the popup div at.
the [shpmid] should do what I want as long as it transforms the
coordinates into pixel locations.
I agree with the shpxy changes :) Some documentation might help too ...
although reading the code is a viable alternative.
As a side note, I have also implemented this for lines now by buffering
the lines into polygons ... pretty cool but also pretty hairy if you
have lots of data. Feature processing would really help here (and with
polygons too).
Cheers,
Paul
Steve Lime wrote:
> Hi Paul: There's a [shpmid] tag (and maybe shpmidx/shpmidy tags) that
> will give you a psuedo centroid. It's not a true centroid, but rather
> the center of the bounding box. It was added originally as a means of
> creating maps centered on a feature.
>
> Out of curiousity why aren't polygons working for you? I assume the tag
> works ok it's just not what you need to position an element.
>
> We/I should extend the shpxy tag to simply replace the other [shp...]
> tags. We could have different representations of a feature (default
> full, bbox, center, centroid), plus support projections and feature
> processing (e.g. line thinning).
>
> Steve
>
>
>>>>pagameba at magma.ca 3/9/2004 2:37:11 PM >>>
>
> Hi,
>
> I'm using the [shpxy xf="," transform] in a template to create
> imagemaps
> ... the imagemap onmouseover/onmouseout dynamically positions a dhtml
>
> div element over the feature in the map. This works exceptionally well
>
> for points but it doesn't work for polygons.
>
> Is there anything I can use in a template to get a centroid value for a
>
> polygon (rather than all the points)?
>
> Also, has anyone tried to do this for lines? I'm using mapscript and
> generating the template dynamically based the type of a selected layer.
>
> Right now my approach is to get the points that make up lines and
> then
> create polygons by buffering the lines ... this is obviously quite a
> lot
> of work in php :)
>
> Cheers,
>
> Paul
--
-----------------------------------------------------------------
|Paul Spencer spencer at dmsolutions.ca |
|-----------------------------------------------------------------|
|Applications & Software Development |
|DM Solutions Group Inc http://www.dmsolutions.ca/|
-----------------------------------------------------------------
More information about the MapServer-users
mailing list