Hello Hara,

what you want to do is possible in different ways:

To your approach a):
Right, you can load the features via KML or GML or other Vector formats into your map. Then you have OpenLayers support for selecting "features". The advantage is that it works offline. Drawback the actuality of the data (you have to update the stuff) and too many features will crash your browser.


To your approach b):
You can query a WFS by clicking the feature, but I don't know if there is an open WFS for your purpose.

What I would do or what could be an appropriate way:
Render your maps and implement an own click handler. see: http://openlayers-buch.de/beispiele/chapter-10/click.html and http://openlayers-buch.de/beispiele/chapter-10/OpenLayers.Control.Box.js This handler has to be adapted that it queries open data sources such Nominatim (http://wiki.openstreetmap.org/wiki/Nominatim) or geonames (http://www.geonames.org/).

Best regards,
Chris



Am 23.03.2011 23:30, schrieb harahara:
I tried searching the mailing list (the server threw an exception).
"
HTTP ERROR: 500

url=http://old.nabble.com/forum/Search.jtp?forum=15906&local=y&query=selecting+the+city+beneath+the+mouse
user-agent=Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15)
Gecko/20110303 Firefox/3.6.15
referer=http://lists.osgeo.org/mailman/listinfo/openlayers-users

RequestURI=/forum/Search.jtp
Caused by:
fschmidt.util.servlet.JtpContextServlet$JtpRuntimeException:
url=http://old.nabble.com/forum/Search.jtp?forum=15906&local=y&query=selecting+the+city+beneath+the+mouse
user-agent=Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15)
Gecko/20110303 Firefox/3.6.15
referer=http://lists.osgeo.org/mailman/listinfo/openlayers-users
...
"

Google wasn't of great help either.

So I apologize in advance if the question has been answered before (probably
many times over).

What I would like to do is pretty simple (from user perspective):

1. User clicks on a city/state/country (depending on the zoom level) on a
Google map or OpenStreetMap

The selected city/state/country is then displayed to the user.

Based on my research so far, the ways to accomplish this are:

a) Have a kml based overlay with country, state borders and city points. Use
OpenLayers support for selecting "features" and then display the appropriate
info

b) Use a WFS to obtain feature info for a given location

On approach a) I have to display the kml depending on zoom level etc.
(Possible definitely but is that the only way?)
b) I am not sure whether I can use a open WFS server such as opengeo.org for
that purpose.

Ideally I would like to be able to do this offline (which I guess means
approach a) ) but I would like to hear your thoughts before digging in.


Thanks

Hara Arcot

--
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/Finding-the-country-state-city-beneath-the-mouse-click-tp6202172p6202172.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to