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

Jeff McKenna jmckenna at gatewaygeomatics.com
Mon Apr 25 15:03:12 PDT 2016


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/






More information about the mapserver-users mailing list