Zoom to location by name or other parameter using cgi mapserv
bob.b at GRITECHNOLOGIES.COM
Sat Dec 22 11:22:05 EST 2007
Ben (and Richard),
I know I've been sounding like a broken record on the list lately with
regard to GeoMoose, but . . . :c)
In one of the Demo datasets that is included with the Windows (MS4W)
version of GeoMoose, there is a selection and highlighting example
already set up for use with MapServer.
The GeoMoose client framework utilizes the INCLUDE option for MapServer
mapfiles to a rather high degree, and each of these capabilities have
been included in the demo as MapFile template fragments that are used to
achieve the (your) results, both for zooming and highlighting. There
was even recently (within the last month) a how-to put together on the
subject that was posted to the GeoMoose site.
This is a pretty good description of how MapServer works it's magic for
Further, if you still want go the route of pre-defining a zoom-to URL,
GeoMoose has a facility for this as well, there is a tool for doing a
Jump-to action that can be pre-populated, you can even include more than
one if needed. You can get more info about setting this up in the
MAPBOOK documentation at:
Specifically, look at the <view> tag set for details.
Richard Greenwood wrote:
> On Dec 21, 2007 6:18 AM, Ben Madin <ben at remoteinformation.com.au> wrote:
>> Thanks for your help Richard, I think I am closer, but I haven't got it yet
>> to the point I can write it up!
>> After struggling to work out the validation thing, I can run the script, but
>> as soon as I use mode=itemquery I return a list of locations, and a
>> querymap, beautifully shrunk down to show only the polygon I am interested
>> However, I was hoping to be able to use this function in the main window -
>> as an example say I was looking for roadside stops by name, it could then
>> "zoom" me to the one I wanted, and I could continue panning or zooming.
>> but if I use mode=browse, I just get my normal interface, with a quarter of
>> Australia to zoom in from!
>> I'm guessing the better option may just be to make the select list with the
>> extents of each object, queried from the database, so when the form is
>> submitted that is the mapext value.
> The trick to getting the query result into your main map is to make
> the TEMPLATE for the query layer be the main map. So in your map file
> the template for 'stops' should be whatever your main map html file
> A couple more tricks. Sometimes you will need to have two versions of
> your 'stops' layer with different templates. The first "stops" layer
> would have a template for displaying attribute data and the style of
> that layer would be the regular default style. Then the second layer,
> we'll call "stops_spatial" has the main map defined as the template,
> it has a FILTER %gid% so that it only shows the selected object(s) and
> the style ewould be something bright and bold to show the object.
> Another trick. If you want to display more than selected object in one
> map (as opposed to several maps each just showing one object) then
> instead of putting the main map html in the template, put it in the
> HEADER for your "stops" or "stops_spatial" layer, and define an empty
> html file for the template.
> You can see an example of this at: http://www2.tetonwyo.org/mapserver/
> Select the "Property Search" link near the bottom of the page. In the
> "Search by Owner" "Last Name" enter 'Smith'. This will give you a
> list, click the "Map It" link.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the mapserver-users