[mapserver-dev] Template driven output - issue with PostGIS connection
Havard Tveite
havard.tveite at umb.no
Thu Jun 6 07:55:11 PDT 2013
Thanks to Thomas, I found out that the problem is the use
of the attribute name "id" ([id]) in the template.
When I changed the attribute name to "testid" (using "id as
testid" in the PostGIS DATA string), and used "testid"
instead of "id" in the template, the output was as
expected.
Should this be filed as a documentation bug or a mapserver
bug?
Håvard
On 6/6/2013 4:06 PM, Havard Tveite wrote:
> I am not sure what you are after. But here is some information:
>
> Outputformat:
>
> OUTPUTFORMAT
> NAME "OGR_GeoJSON"
> DRIVER "OGR/GeoJSON"
> FORMATOPTION "STORAGE=stream"
> FORMATOPTION "FORM=simple"
> END
>
> Layer template:
>
> TEMPLATE "dummy"
>
> Håvard
>
> On 6/6/2013 3:54 PM, thomas bonfort wrote:
>> ok... what template are you using?
>>
>> [id] maps to the process id of the mapserver instance. are you using that instead of [shpidx] ?
>>
>> --
>> thomas
>>
>>
>> On 6 June 2013 15:50, Havard Tveite <havard.tveite at umb.no <mailto:havard.tveite at umb.no>> wrote:
>>
>> The OGR based GeoJSON option seems OK. No trouble
>> with the "using unique" attribute there.
>>
>> Håvard
>>
>>
>> On 6/6/2013 2:00 PM, Smith, Michael ERDC-RDE-CRREL-NH wrote:
>>
>> You could also try to isolate it to the template output by trying ogr
>> based geojson output (http://mapserver.org/output/__ogr_output.html <http://mapserver.org/output/ogr_output.html>)
>>
>> OUTPUTFORMAT
>> NAME "OGR_GeoJson"
>> DRIVER "GeoJson"
>> FORMATOPTION "STORAGE=stream"
>> FORMATOPTION "FORM=simple"
>> END
>>
>>
>>
>> Mike
>>
>> On 6/6/13 7:49 AM, "Havard Tveite" <havard.tveite at umb.no <mailto:havard.tveite at umb.no>> wrote:
>>
>> I have not tried with other data sources, so this may not be
>> PostGIS related.
>> I have sent Thomas the information from the PostgreSQL logs
>> (the queries seemed to be the same for GML and geojson).
>>
>> Håvard
>>
>> On 6/6/2013 1:26 PM, thomas bonfort wrote:
>>
>> Havard,
>> The postgis driver hasn't changed in trunk since 6.2. Can you enable
>> debugging on your postgis layer and post the query that is being sent to
>> the postgres backend?
>>
>> regards,
>> thomas
>>
>>
>> On 6 June 2013 13:17, Havard Tveite <havard.tveite at umb.no <mailto:havard.tveite at umb.no>
>> <mailto:havard.tveite at umb.no <mailto:havard.tveite at umb.no>>> wrote:
>>
>> I have a PostGIS connection, and want to provide GeoJSON
>> output.
>>
>> After some stumbling (and updating of the Mapserver docs!),
>> I got it to work, except for the "using unique" part.
>>
>> The interesting parts of my DATA string is like:
>> DATA "geom from (select x.id <http://x.id> <http://x.id> as id, ...) as test
>> using unique id using SRID=4326"
>>
>> This works well for WFS with GML, but when I add
>> "&outputformat=geojson" (to get GeoJSON output), the returned
>> id is a very large number (for instance 137051404431549 - it
>> changes for each request), and it is the same number for all
>> the features. The actual ids are between 1 and 1000.
>>
>> I have the same issue when not using WFS
>> (&mode=nquery&qformat=geojson)____.
>>
>> My template for geojson output is according to the documentation
>> (and everything else is returned as it should).
>>
>> Could this be a bug?
>>
>> mapserv -v
>> MapServer version 6.2.1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG
>> SUPPORTS=PROJ SUPPORTS=GD SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO
>> SUPPORTS=OPENGL SUPPORTS=ICONV SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT
>> SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER
>> SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS
>> INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE
>>
>> I have not checked trunk.
>>
>>
>> Håvard
>> --
>> Håvard Tveite
>> Department of Mathematical Sciences and Technology, UMB
>> Drøbakveien 31, POBox 5003, N-1432 Ås, NORWAY
>> Phone: +47 64965483 <tel:%2B47%2064965483> <tel:%2B47%2064965483> Fax: +47 64965401 <tel:%2B47%2064965401>
>> <tel:%2B47%2064965401> http://www.umb.no/imt/
>> ___________________________________________________
>> mapserver-dev mailing list
>> mapserver-dev at lists.osgeo.org <mailto:mapserver-dev at lists.osgeo.org> <mailto:mapserver-dev at lists.__osgeo.org <mailto:mapserver-dev at lists.osgeo.org>>
>> http://lists.osgeo.org/____mailman/listinfo/mapserver-dev <http://lists.osgeo.org/__mailman/listinfo/mapserver-dev>
>> <http://lists.osgeo.org/__mailman/listinfo/mapserver-dev <http://lists.osgeo.org/mailman/listinfo/mapserver-dev>__>
>>
>>
>>
>> --
>> Håvard Tveite
>> Department of Mathematical Sciences and Technology, UMB
>> Drøbakveien 31, POBox 5003, N-1432 Ås, NORWAY
>> Phone: +47 64965483 <tel:%2B47%2064965483> Fax: +47 64965401 <tel:%2B47%2064965401> http://www.umb.no/imt/
>> _________________________________________________
>> mapserver-dev mailing list
>> mapserver-dev at lists.osgeo.org <mailto:mapserver-dev at lists.osgeo.org>
>> http://lists.osgeo.org/__mailman/listinfo/mapserver-dev <http://lists.osgeo.org/mailman/listinfo/mapserver-dev>
>>
>>
>>
>>
>>
>> --
>> Håvard Tveite
>> Department of Mathematical Sciences and Technology, UMB
>> Drøbakveien 31, POBox 5003, N-1432 Ås, NORWAY
>> Phone: +47 64965483 <tel:%2B47%2064965483> Fax: +47 64965401 <tel:%2B47%2064965401> http://www.umb.no/imt/
>>
>>
>
--
Håvard Tveite
Department of Mathematical Sciences and Technology, UMB
Drøbakveien 31, POBox 5003, N-1432 Ås, NORWAY
Phone: +47 64965483 Fax: +47 64965401 http://www.umb.no/imt/
More information about the mapserver-dev
mailing list