You can also bail on JSON and just return HTML from your template. Here's a trivial example that uses GMap2 API and mode=tile for an overlay layer and a straight mapserver point query for handling clicks. The actual calls to the CGI are being proxied but it's straight CGI. I look at the query result and if there's an error I don't display the result. Watch with Firebug to see what's moving between the client and server.
http://www.dnr.state.mn.us/officerpatrolareas/index.html Here's another one with GMap3 API that uses a mod-geocache tileset for an overlay and straight MapServer 6.0 queries for handling a click event tied to the map. I check for an error and if ok I redirect the user to the contents of the template (in this case just a URL to a PDF). Kind of a Google maps imagemap. http://www.dnr.state.mn.us/forestlegacy/hunting.html Steve On Sun, Sep 11, 2011 at 11:41 PM, Rahkonen Jukka <[email protected]> wrote: > Hi, > > If you happen to have a little bit time for considering some day, consider > also using WFS for queries. And if you cannot manage to get the geojson > outputformat work through the OGR outputformat system in a minute, you can > install TinyOWS besides Mapserver. It can read the same mapfiles and it can > output geojson out-of-the-box. > > -Jukka Rahkonen- > > Mr. Puneet Kishor wrote: > >>On Sep 11, 2011, at 10:52 PM, Richard Greenwood wrote: > >>> On Sun, Sep 11, 2011 at 9:37 PM, Mr. Puneet Kishor <[email protected]> >>> wrote: >> >>>> However, since I am not using MapScript (even though I would prefer to), I >>>> would have to implement both CGI and MapScript to do what you are >>>> suggesting above -- CGI to display the map and MapScript to do the query. >> >>> But my point was that you can do the query without mapserver at all if >> the data is in postgis. Use a server-side language such as Perl or PHP >> to pass the request to postgis, which can do a spatial query, and then >> Perl or PHP can format the result as JSON and return it to the page >> (via AJAX). > > >> On second reading, I now get what you are saying. Strange that it never >> occurred to me. Sounds very sensible, and I will implement it tomorrow. That >> way I can get away from CGI `mode=query` and its TEMPLATE-ing vagaries. Yes, >> my data are in Pg, so I can do all my querying with Perl. > >> Wish I could do away with `mode=tile` and also get tiles back via MapScript. >> Then my solution would be complete. > >>Thanks for this really useful hint (more like making me see the obvious that >>I was missing for some reason). > > Puneet._______________________________________________ > mapserver-users mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/mapserver-users > _______________________________________________ > mapserver-users mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/mapserver-users > _______________________________________________ mapserver-users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/mapserver-users
