[OpenLayers-Users] Vector layer with
map.events.register("click")
Brad Spencer
bradspencer at ozemail.com.au
Mon Jun 7 18:24:56 EDT 2010
Stuart,
I think its horses for courses really. A lot of people get hung up about
mouseover interactivity and force programmers to do all sorts of gymnastics
to try to make a loosely coupled web app look like as responsive as a
desktop GIS. This is even worse when you are dealing with polygons -
geometry gets filtered and loaded to the client just to give the mouseover
interactivity which looks awful when you zoom in. Also, the area that a user
decides to apply this approach to maynot be controllable by you and could
lead to excessive and unnecessary geometry download times.
When working with remote data services you may or maynot have access to WFS
in which case you need to use getfeatureinfo requests to get the attributes
on a click. If the data is private to the end user and does not belong to
the WMS data provider at all then uploading geometry into the user's session
from their desktop is the way to go providing the mouseover interactivity.
Of course if you need the geometry in the client for real spatial analysis
purposes then that is a different issue than doing it just for mouseover
interactivity and is typically done on a more selective object basis.
Now to answer your question regarding clicking on the vector layer. I found
that you have to make the vector layer the top layer to avoid these
conflicts. So I manipulate the z-index of the vector layer to make sure its
at the top.
Cheers, Brad....
-----Original Message-----
From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] On
Behalf Of gingerbbm
Sent: Tuesday, June 08, 2010 2:26 AM
To: users at openlayers.org
Subject: [OpenLayers-Users] Vector layer with map.events.register("click")
Dear all
I retrieve a set of points from GeoServer as a WMS tile. Using
map.events.register('click',...) I attempt to retrieve information about a
specific point when the map is clicked, using a bespoke WFS call.
I am now required to provide some data about each point on mouseover so have
been investigating OpenLayers.Layer.Vector and
OpenLayers.Control.SelectFeature. My initial idea is to keep my original WMS
layer and supplement it with a WFS-driven Vector layer. See this mock-up:
http://v5dev.elgin.gov.uk/sw.html
The idea is to set the opacity of the style of the vector objects to 0.01 to
take advantage of the "selected" behaviour while seemingly not affecting the
map appearance. But using this two-layer method, the map clicks are not
triggering over the vector objects.
So... two questions:
1. Is there a way to make map.events.register('click',...) work when a
vector object is selected?
2. Should I abandon this and simply use the vector layer exclusively
(plotting the relevant images at the appropriate points)?
Would appreciate your advice.
Thanks
Stuart
--
View this message in context:
http://osgeo-org.1803224.n2.nabble.com/Vector-layer-with-map-events-register
-click-tp5149829p5149829.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users
More information about the Users
mailing list