#4063 closed defect (invalid)
trimlast does not work in templated JSON output
Reported by: | davidfawcett | Owned by: | sdlime |
---|---|---|---|
Priority: | normal | Milestone: | 6.0.2 release |
Component: | MapServer C Library | Version: | 6.0 |
Severity: | normal | Keywords: | json template trimlast |
Cc: | sdlime |
Description
In the template-driven output section of the MapServer docs, the geoJSON example demonstrates the use of 'trimlast' to remove the trailing delimiter in the output.
http://mapserver.org/output/template_output.html
When trying to use this functionality in MapServer 6.0.1, I can't get trimlast to work. Others have also had the same issue.
http://www.osgeo.org/pipermail/mapserver-users/2011-September/070257.html
Attached is a simple map file with a shapefile containing one feature (the state of MN). The URL used to make the query call is:
http://localhost/cgi-bin/mapserv?mode=nquery&map=/test/trimlast.map&mapxy=-94+45&layers=state
Attachments (3)
Change History (10)
by , 13 years ago
comment:1 by , 13 years ago
I forgot to include an example of the output.
The CGI call:
http://localhost/cgi-bin/mapserv?mode=nquery&map=/test/trimlast.map&mapxy=-94+45&layers=state
Returns the result:
{ "state": [ { "perimeter": "2.22222e+006", "area": "3.33333e+007" }, ] }
comment:2 by , 12 years ago
Status: | new → assigned |
---|
comment:3 by , 12 years ago
Milestone: | → 6.0.2 release |
---|
follow-up: 5 comment:4 by , 12 years ago
David: What happens if you use double quotes instead of single quotes inside the feature tag. That is [feature trimlast=","].
Steve
comment:5 by , 12 years ago
Replying to sdlime:
David: What happens if you use double quotes instead of single quotes inside the feature tag. That is [feature trimlast=","].
Steve
Steve,
When I change the quotes around the 'character to be trimmed' to be double quotes, the trim functionality works.
Since MapServer is pretty agnostic on the type of quotes used (as long as they are properly nested), I hope that the fix will be make it work with both types of quotes.
David.
Here is the template text that works"
mapserver template [resultset layer=state] {
"state": [
[feature trimlast=","] {
"perimeter": "[PERIMETER]", "area": "[AREA]"
}, feature
]
comment:6 by , 12 years ago
Resolution: | → invalid |
---|---|
Status: | assigned → closed |
The issue is in the tag attribute parsing not the template tags themselves. I'm going to close this as invalid and open a new, more specific ticket.
Steve
Simple shapfile with one polygon feature