[OpenLayers-Users] Query Feature by Attribute and Zoom
Guillaume Sueur
guillaume.sueur at neogeo-online.net
Thu Apr 10 15:47:58 EDT 2008
Hi Greg,
As an WMS Server doesn't publish the features themselves, you will have
to use another method for the requested functionnality, even if the
layers can remain in WMS.
1. If you don't have so many countries, you can grab the extents of each
of them manually and build a simple html select list with the extents in
the value field. OnChange, you will fire a function getting the extent
and setting your map extent with it.
2. If you have many countries, or if these data change often, you can
build a simple web service sending you a stream (JSON for example) that
you will use to build dynamically the same list as above. On the server
side you can use many OpenSource tools to perform that : either
php/mapscript, or even ogrinfo, in fact any tool that will be able to
open your dataset and read the shapes in it. Of course, it's even
simpler if they are stored into postGIS ;-)
Hope that helps,
Guillaume
groby a écrit :
> Hello,
>
> I am fairly new to OpenLayers and GIS in general and new to this list. I
> have just setup an OpenLayers page. I am using MapServer as my WMS Server
> and my data is held in PostGIS tables.
>
> I would like to know how can I create a way for a user to input text and to
> zoom to the feature specified by the text.
>
> An example of what I am trying to accomplish:
> Take the Feature Info Example at
> http://www.openlayers.org/dev/examples/getfeatureinfo.html. If I wanted to
> make it so a user could type in a country name then have the map zoom to the
> extent of the country, how would I do so? It needs to be a general enough
> example I could use it with any text field (for example, a Serial Number).
>
> I have found a few previous postings that seem to be asking a similar
> question but not many answers. Any pointers to a nice or ugly solution are
> appreciated.
>
> Thanks.
>
> Greg
>
>
-
More information about the Users
mailing list