[mapserver-users] RE OGR csv - no field names

Ian Walberg ian.walberg at airborne.aero
Mon Apr 25 16:11:33 PDT 2016


Jeff,

Many thanks that worked great.

Next is there any way of getting the row ID as part of the data passed to mapserver?

We are planning to serve this data as a WFS layer.

Thanks

Ian

-----Original Message-----
From: mapserver-users [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Jeff McKenna
Sent: Monday, April 25, 2016 3:03 PM
To: mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] RE OGR csv - no field names

On 2016-04-25 6:49 PM, Simon Mercier wrote:
> really not sure CSVT file is supported by ogr, but you can easily 
> define field type in VRT
>
>          <Field name="precipitation_mm" src="prec_mm" type="Real"/>
>          <Field name="field_1" src="field_1" type="String" width="100" 
> />
>

Simon is right, very nice, specifying the field name to classify in the vrt works, for a csv without field names:

<OGRVRTDataSource>
     <OGRVRTLayer name="occurrence">
         <SrcDataSource relativeToVRT="1">CSV:occurrence.txt</SrcDataSource>
         <GeometryType>wkbPoint</GeometryType>
         <LayerSRS>WGS84</LayerSRS>
         <GeometryField encoding="PointFromColumns" x="field_37" 
y="field_38"/>
         <Field name="name" src="field_51" type="String" width="100"/>
     </OGRVRTLayer>
</OGRVRTDataSource>



LAYER
   NAME "occurrence"
   TYPE POINT
   STATUS ON
   CONNECTIONTYPE OGR
   CONNECTION "../occurrence.vrt"
   CLASSITEM "name"
   CLASS
     NAME "Occurrences"
     EXPRESSION "ttt"
     STYLE
       SYMBOL 7
       SIZE 10
       COLOR 0 0 0
     END
   END
END # Layer


-jeff





--
Jeff McKenna
MapServer Consulting and Training Services http://www.gatewaygeomatics.com/




_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the mapserver-users mailing list