RE: [mapserver-users] mimic geonames.org JSON server

2011-12-12 Thread Lime, Steve D (DNR)
1)  Use mode=itemnquery and a regex search, something like 
qstring=/^value/. You’ll need to account for this in your validation string.

2)  There is an outstanding bug regarding trimlast (see 
http://trac.osgeo.org/mapserver/ticket/4063) but I’m starting to think it’s a 
problem with single vs. double quotes in tag arguments. Try using double quotes…

3)  There are a number of counter tags that should be available. See 
http://mapserver.org/mapfile/template.html and search for the [nr] tag and 
you’ll see the others documented below.
Steve

From: Mark Volz [mailto:volzm...@yahoo.com]
Sent: Thursday, December 08, 2011 10:11 PM
To: Lime, Steve D (DNR); mapserver-users@lists.osgeo.org
Subject: Re: [mapserver-users] mimic geonames.org JSON server

Steve,

Thank you for your assistance.  The code is starting to work.  I just have a 
couple more questions.

1)  How can I change the query on the html call to use regular expressions, or 
more particularly make the search a begins with search. Using 
qlayer=myLayerqitem=MyFieldqstring='myValue' obliviously returns only one 
result, however I would like to search for n items

2) In the JSON template, I have a comma separating each result.  I thought that 
I could remove the final comma by adding [feature trimlast=','].  The final 
comment was not removed.  how do I correctly use [feature trimlast=',']

3)  for JSON templates is a variable for total results?  If not is there 
another way to get a record count?

Thanks


From: Lime, Steve D (DNR) steve.l...@state.mn.us
To: Mark Volz volzm...@yahoo.com; mapserver-users@lists.osgeo.org 
mapserver-users@lists.osgeo.org
Sent: Thursday, December 8, 2011 10:26 AM
Subject: RE: [mapserver-users] mimic geonames.org JSON server


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=mapfilemode=itemqueryqlayer=layerqitem=itemqstring=valueqformat=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-boun...@lists.osgeo.org 
[mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Mark Volz
Sent: Wednesday, December 07, 2011 10:06 PM
To: mapserver-users@lists.osgeo.org; volzm...@yahoo.com
Subject: [mapserver-users] mimic geonames.orghttp://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


___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


RE: [mapserver-users] mimic geonames.org JSON server

2011-12-08 Thread Lime, Steve D (DNR)
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=mapfilemode=itemqueryqlayer=layerqitem=itemqstring=valueqformat=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-boun...@lists.osgeo.org 
[mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Mark Volz
Sent: Wednesday, December 07, 2011 10:06 PM
To: mapserver-users@lists.osgeo.org; volzm...@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

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users