Zoom to location by name or other parameter using cgi mapserv

Richard Greenwood richard.greenwood at GMAIL.COM
Thu Dec 20 17:38:17 PST 2007


On Dec 20, 2007 6:20 PM, Ben Madin <ben at remoteinformation.com.au> wrote:
>  G'day all,
>
> I have a list of small polygons spread out over about 2500 kms, and I want
> to be able to zoom to a polygon by choosing it from a list.
>
> The data is all in a postgis database, so I can get the polygon names, gid
> and centroid location.
>
> I had through I would put the names into a select list, and have the gid as
> the option value.
>
> My question is, can I set a centre based on a gid in a call to the cgi, or
> can I put the centroid of the polygon into the options value and append it
> to the cgi call. What is the appropriate format for this?
>
> It is only a small application, and I done similar for other projects in
> php/mapscript, but I would rather stick to the cgi for now.

Using mode=itemnquery is a pretty standard way to do it. Several other
parameters are required. e.g.:

qitem=gid&qlayer=poly_layer&mapext=shapes&qstring=poly_gid

Another way, with PostGIS, you can also query the extent of one or
more polygons and then pass that extent to mapserv with mode=map.

-- 
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com



More information about the MapServer-users mailing list