[mapserver-users] querying in mode=tile

Mr. Puneet Kishor punk.kish at gmail.com
Sun Sep 11 10:48:48 EDT 2011


On Sep 11, 2011, at 8:03 AM, Richard Greenwood wrote:

> On Sat, Sep 10, 2011 at 1:35 PM, Mr. Puneet Kishor <punk.kish at gmail.com> wrote:
>> Now that I have mode=tile working with Google Maps API v3, I am on my way to implement querying like so
>> 
>>    0. Bind an infowindow.close() to a click event listener on the map
>>    1. Bind an infowindow.open() to a click event listener on the MapServer layer
>>    2. Fill the infowindow content with the result from an Ajax query to MapServer
>>    3. When the user clicks on the MapServer layer, the Ajax query is fired
>>    4. MapServer responds with the query result as a JSON object
>>    5. Fill the infowindow with the JSON result
>>    6. Close any already open infowindow via #0 above
>>    7. Open a new infowindow with the result
>> 
>> Is the general approach outlined above sound? Any pointers to existing code samples for the above?
> 
> 
> Puneet,
> 
> I'm doing pretty much that here:
>   http://records.sublettewyo.com/mapserver/map.html
> I'm using jQuery in this example and putting the info into a jQuery
> dialog, however I have used a standard browser window in the past.
> Only thing is that I don't thinnk you really need step 0, simply
> replace the contents of the container with the new info.


Yup, I don't have to worry about #0. Howerver, #1 above is problematic, and I don't have a resolution for it yet. Seems like in Google Maps API v3 I can't addListener to an ImageMapType overlay. See, I am adding a MapServer layer as ImageMapType overlay like so

  "mapserverLayer" : new google.maps.ImageMapType({ .. })
  map.overlayMapTypes.insertAt(0, mapserverLayer);


If I do the following --

  google.maps.event.addListener(map, "click", function (event) { }

it works, however, the following doesn't work at all

  google.maps.event.addListener(mapserverLayer, "click", function (event) { }

Which is silly, isn't it? I don't want the entire map to be listening to the "click" events. I just want the MapServer layer to be doing so. Haven't yet found a resolution to this.


> 
> Also, if your data is in PostGIS you can skip mapserver for attribute
> queries and do an info query against the PostGIS db via PHP or other
> server-side tool.
> 

Ok, I am very interested in the above, but I am not sure I understand you. For the most part, I want to click on the map, and find out more about what I clicked on. In order to do that query via Perl MapScript (I don't know PHP) and Pg, I would need to create the $mapObj. I am able to do that fine, but I don't know how to run MapServer in `mode=tile` via MapScript. This is the question I have asked a couple of times -- if I have a pure MapScript app (no map files involved at all, which is what I want), how no earth do I tell the app to use `mode=tile`?

Puneet.



More information about the mapserver-users mailing list