CSV/VRT with WKT LINESTRING() Problem

Adam Hill adam.hill at GMAIL.COM
Thu Dec 8 13:43:38 PST 2005


I am having issues with setting up a CSV datasource with LINESTRINGS()
as the WKT geometry. Reading the archived MS-U emails I have ensured
that

1) There is at least two columns defined in my CSV and
2) The LINESTRING() has double quotes around it.

Ogrinfo returns the correct CRS, but each feature's geometry column is
getting interpreted as a string eg.
>ogrinfo -ro -al bb

(...SRS info omitted)

OGRFeature(bb):2
  id (String) = 1
  api (String) = 60816400980
  proj (String) = 316
  wkt (String) = LINESTRING(1288565.0 10549215.0,1288565.0
10549215.0,1288565.0.... (more points omitted)

When I try and render it via MS (CGI or shp2img) I get a large colored
rectangle (IMAGECOLOR). I have overlayed a GRID to ensure I am seeing
the correct extents.

Two questons I also have from looking at the scarce examples is
1) Does the LAYER NAME in the .map file need to match the 
<OGRVRTLayer name="xxxx">
2) Do I need a <GeometryType>wktLineString</GeometryType> in the VRT?
The only values that are mentioned in the docs are wkbXXX types.


Relavant file bits:

bb.csv
------
id,api,proj,wkt
0,60816400900,316,"LINESTRING(1283074.0 10562093.0,1283074.0
10562093.0,1283074.0 10562093.0,1283074.0 10562093.0)"

bb.ovf
---------
<OGRVRTDataSource>
    <OGRVRTLayer name="bb">
        <SrcDataSource relativeToVRT="1">bb.csv</SrcDataSource>
        <SrcLayer>bb</SrcLayer>
        <GeometryField encoding="WKT" field="wkt"/>
        <LayerSRS>+proj=utm +zone=16 +north +datum=NAD27 +ellps=clrk66
+units=ft +no_defs</LayerSRS>
    </OGRVRTLayer>
</OGRVRTDataSource>

bb.map
-------
MAP
  NAME "BB"
  STATUS ON
  SIZE 1000 864
  #L/L
  EXTENT -90 26 -84 32
  IMAGETYPE png
  IMAGECOLOR 255 0 0
  UNITS DD
  DEBUG ON
  WEB
    IMAGEPATH "/var/tmp"
    IMAGEURL "/tmp/"
    METADATA
     "wms_title" "Bob Brown Test"
     "wms_onlineresource" "http://houwck-n-s00002:8083/cgi-bin/bobbrowtest?"
     "wms_srs" "EPSG:4326"
     END
   END
  PROJECTION
      "init=epsg:4326"
   END

  OUTPUTFORMAT
    NAME png24
    MIMETYPE "image/png"
    DRIVER "GD/PNG"
    EXTENSION "png"
    IMAGEMODE RGBA
  END

  LAYER
    NAME "bb"
    CONNECTION "bb.ovf"
    DATA "bb"
    CONNECTIONTYPE OGR
    TYPE LINE
    STATUS ON
     METADATA
      WMS_TITLE  "BB TEST"
      WMS_SRS    "+proj=utm +zone=16 +north +datum=NAD27 +ellps=clrk66
+units=ft +no_defs"
    END
    CLASS
      STYLE
         COLOR 255 0 0
      END #STYLE
    END #CLASS
    PROJECTION
          "+proj=utm"
          "+zone=16"
          "+north"
          "+datum=NAD27"
          "+ellps=clrk66"
          "+units=ft"
          "+no_defs"
    END
  END #LAYER

END #MAP
-------------------------------------------------
Any help appreciated.

Adam Hill



More information about the MapServer-users mailing list