Trying to implement an identify tool

Daniel Morissette danmo at videotron.ca
Fri May 5 13:36:46 PDT 2000


bfischer at usgs.gov wrote:
> 
> I am trying to implement an identify tool similiar to how ArcView IMS
> works.  I was wondering if anyone else has implement something like this
> with mapserver.  What I want is a seperate window to appear after a feature
> is clicked on.  This would be fairly simple if we could use a javascript
> function like window.open in the template parameter of a layer query.  Is
> there any way to do something like this with the current version of
> mapserver?
> 

Brian,

We do that kind of things, but we use MapScript... there might be ways 
to build a URL using the regular MapServer and do the same. 
Unfortunately none the apps that we have built and do that are publicly 
available yet... but here is an idea of the way we do it:

When the user does a query in the main HTML page that contains the map 
then you use JavaScript (or MapScript in our case) to build the URL that
will generate the query result and open the identify window using 
something like:

newwin = window.open("/cgi-bin/mapserv?all_identify_query_params_here",
                     "IdentifyWindow",   
"alwaysRaised=1,scrollbars=1,titlebar=1,toolbar=1,status=1,location=1,dependant=1,resizable=0,menubar=1");

This could probably be executed in the "onSubmit" callback of your form
if you do not want to submit the main page.  In our case, we have that
line execute as the main map page is reloaded because we need to modify
the main page after the query. 

I guess you probably had figured that out... so we can tell you that it
works very well.  Except for one thing... if the identify window already
exists, and it is behind your current browser window, then the call to
window.open() WILL NOT bring it back on top... and your user will think
that the query did not work.

The trick to go around that is to embed the following JavaScript line IN
THE BODY of the identify window so that it is executed as it loads:

	self.focus();

This trick works well with both I.E. and Netscape.

Good Luck!
-- 
------------------------------------------------------------
 Daniel Morissette                       danmo at videotron.ca
              http://pages.infinit.net/danmo/
------------------------------------------------------------
  Don't put for tomorrow what you can do today, because if 
      you enjoy it today you can do it again tomorrow.



More information about the MapServer-users mailing list