[OpenLayers-Users] Query Feature by Attribute and Zoom

Gregory Roby groby at tce.coop
Thu Apr 10 16:56:34 EDT 2008


Guillaume,

Thanks for the quick response, this nudges me in a direction that will solve
this (plus I can expand on it to solve a couple of other related issues I am
sure I will have in the coming month or so).

It sounds like the simplest way based on what I already have knowledge of
then would be to:

Create a HTML form in which a user enters the point.
Create a CGI Python program that gets the proper zoom-to extent (maybe using
GeoDjango, I have used Django a bit before).
Dynamically output the new map webpage from the CGI program with the added
Zoom to Extent Line.

On rereading it, it sounds a bit different from what you suggested but the
same basic idea...  
 
I will post back in a week or so the results (and hopefully some code) in
case anyone is interested.  


Greg





-----Original Message-----
From: Guillaume Sueur [mailto:guillaume.sueur at neogeo-online.net] 
Sent: Thursday, April 10, 2008 3:48 PM
To: groby
Cc: users at openlayers.org
Subject: Re: [OpenLayers-Users] Query Feature by Attribute and Zoom

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
> 
> 

-


-------------- next part --------------
The information contained in this electronic mail transmission is intended by Tri-County 
Electric Cooperative for the use of the named individual or entity to which it is directed 
and may contain information that is confidential or privileged.  If you have received this 
electronic mail transmission in error, please delete it from your system without copying or 
forwarding it, and notify the sender of the error by reply email so that the sender's address 
records can be corrected.


More information about the Users mailing list