mapping query results with dbox and mapserv.js

Richard Greenwood richard.greenwood at GMAIL.COM
Sun Dec 10 05:21:31 PST 2006


On 12/10/06, william paul <williampaul28 at yahoo.com> wrote:
> Hello:
> I am using dBox, the example from
> http://maps.dnr.state.mn.us/tools/dbox/example/example.html.
> I have a database on Sql ServerExpress and I am using ASPX to query the
> database and display the results
> I want to map some of the results, but I don't know how to do it. I tried
> with the example provided by Rich:
>
> mapserv.exe?map=my.map
>   &mode=itemnquery
>   &qitem=pidn
>   &qlayer=join_region_spatial
>   &mapext=shapes
>   &savequery=true
>   &qstring=22-41-16-33-4-11-004
>
> but instead of mapping the result I get a basic mapserver query results,
> like they were queried from the map
>
> How can I map the query results from a database with dbox.js and mapserv.js
> on the example from
> http://maps.dnr.state.mn.us/tools/dbox/example/example.html?
>
> Thank you in advance
>
> William

You need to set a template for the queried layer to display the map.
In other words, the template for your query layer has to be an html
page with a map in it. You set this in the .map file.

The map file definition for the query string above is shown below. The
HEADER just references my main html map page (it is not a special
page). The TEMPLATE is an empty file. The reason for this is that if a
query result returns more than one object you will get one map for
each object if you reference the html map page with the TEMPLATE key
word, but referencing it with the HEADER causes all queried objects to
be drawn on one map, and zoomed to an extent including all of the
objects.


Layer
	NAME "join_region_spatial"
	STATUS OFF	# either set to DEFAULT, or explicitly call for it
	TYPE  polygon
	DATA  "ownership_region.shp"
	FILTERITEM Pidn
	Filter "%pidn%"
	HEADER "sc_map.html"
	TEMPLATE "empty2.html"
	CLASS
		OUTLINECOLOR 255 255 0
		SYMBOL 'solid' SIZE 6
	END # class
END # layer



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



More information about the MapServer-users mailing list