[mapserver-users] mimic geonames.org JSON server

Lime, Steve D (DNR) Steve.Lime at state.mn.us
Thu Dec 8 11:26:59 EST 2011


1)      Correct. Templates are just a means of presenting the results of a query operation. I've used templates to return json successfully.

2)      Again, you need to issue a query. So to find a record in a layer you might do something like:

http://localhost/cgi-bin/mapserv?map=mapfile&mode=itemquery&qlayer=layer&qitem=item&qstring=value&qformat=jsonformat

This assumes that: for the layer in question you've setup a validation pattern for qstring and you've defined a output format called 'jsonformat'.

The one limitation I've found (and would like to fix) is that there's no easy way to handle exceptions relative to the output format. For example, if you're outputting json it would be nice to return errors (if possible, certain ones like mapfile not found can't be dealt with other than in the default way) as json too.

Let me know if you have questions.

Steve

From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Mark Volz
Sent: Wednesday, December 07, 2011 10:06 PM
To: mapserver-users at lists.osgeo.org; volzmark at yahoo.com
Subject: [mapserver-users] mimic geonames.org JSON server

Hello,

I recently came across an interesting openlayers application that uses geonames.org for a search functionality.  I would like to be able to use my own gis data on the searches.   I came across http://mapserver.org/trunk/output/template_output.html, which starts to describe how to make a template.  I just have a couple questions.

1)  My understanding is I can use any .map files that have a layer with appropriate fields.  I just need to add another output format so that my .map file references a JSON template, and I can keep the standard image output formats.  Is this correct?

2) How would the html request need to be formatted to search a specific value in a specific layer and return JSON?


Any help and / or examples would be greatly appreciated.

Thanks

Mark

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20111208/e68261ce/attachment.html


More information about the mapserver-users mailing list