[ka-Map-users] Query how to

Steve Lime steve.lime at dnr.state.mn.us
Mon Dec 5 18:40:21 EST 2005


Nope, the straight CGI can use map x/y coordinates too. I've actually had
it working both ways with ka-map . Before you added the query tool I had to 
use image coords. Wasn't a big deal though. You know the size of the ka-map 
canvas and it's extent, plus you can get the image x/y and there you go. You 
don't care that it's tiled on the back end, just treat the canvas as a normal
MapServer image. kaQuery makes it even easier.

In both cases you query the raw data that is used to build the tiles.

The code I've used is very simple. Here's the event handler for queries:

function myQuery( eventID, queryType, coords )
{    
    var url = "http://maps.dnr.state.mn.us/cgi-bin/mapserv48?map=COMPASS_MAPFILE&mode=query";
    url += "&mapxy=" + coords[0] + "+" + coords[1];

    window.open(url);
}

This just opens a new window, but you could nab the content using AJAX and plop
it in a div or whatever.

Steve


>>> Paul Spencer <pspencer at dmsolutions.ca> 12/05/05 5:27 PM >>>
Doesn't it expect query coords in image coordinates?  How would this  
work in a tiled universe?  Seems like the ideal solution though

Paul

On 5-Dec-05, at 5:55 PM, Steve Lime wrote:

> Or just use the straight MapServer CGI application.
>
>>>> Paul Spencer <pspencer at dmsolutions.ca> 12/05/05 4:48 PM >>>
> The query capability just gives you the geographic coordinates that
> the user wants to query.  You will need to:
>
> 1) make an XmlHttpRequest call to the server to request a query of
> your data.  the call() function in xhr.js can do this for you.
>
> 2) write a PHP (or some other) script that actually takes the
> geographic coordinates and queries your data.  Depending on your
> data, you could approach querying in a number of ways.  MapScript is
> probably the most generic way, but if you have a postgis dataset it
> probably makes more sense to query it directly
>
> 3) return results to the client page that can be interpreted by
> javascript.  I have typically done this by returning javascript that
> gets eval'd by the client.  You could also return an XML document and
> navigate it using the DOM.
>
> Cheers
>
> Paul
>
> On 5-Dec-05, at 5:26 AM, Bahi AL_Fkharany wrote:
>
>> Please can one tell me how to get data about specific
>> point i click or tell me how to get real vertices of
>> specific point.
>>
>>
>> 		
>> __________________________________
>> Start your day with Yahoo! - Make it your home page!
>> http://www.yahoo.com/r/hs 
>> _______________________________________________
>> ka-Map-users mailing list
>> ka-Map-users at lists.maptools.org 
>> http://lists.maptools.org/mailman/listinfo/ka-map-users 
>>
>
> +-----------------------------------------------------------------+
> |Paul Spencer                           pspencer at dmsolutions.ca   |
> +-----------------------------------------------------------------+
> |Applications & Software Development                              |
> |DM Solutions Group Inc                 http://www.dmsolutions.ca/| 
> +-----------------------------------------------------------------+
>
>
>
>
> _______________________________________________
> ka-Map-users mailing list
> ka-Map-users at lists.maptools.org 
> http://lists.maptools.org/mailman/listinfo/ka-map-users 
>
>

+-----------------------------------------------------------------+
|Paul Spencer                           pspencer at dmsolutions.ca   |
+-----------------------------------------------------------------+
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/| 
+-----------------------------------------------------------------+








More information about the ka-Map-users mailing list