MapTools.org

[maplab-users] ODBC connection via OGR

joanne cook j.cook@oxfordarch.co.uk
Fri, 19 Mar 2004 15:19:10 -0000
Hi All,

I am a bit of a newbie to maplab and mapserver, and while I've seen this question partially answered I can't seem to get my setup to work!

Basically I am trying to connect to a microsoft access database to get points from a set of x,y coordinates via ogr as described in http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?VirtualSpatialData. I have tested my ovf file with ogrinfo and it works fine, and I can display the points in openev. When I try and display my map in mapserver everything apart from the virtual layer displays and I get no error messages. When I try and display it in mapbrowser the map doesn't display at all. When I try and preview the map in mapeditor I get the following error messages:

Warning: [MapServer Error]: msDrawMap(): Failed to draw layer named 'OAN Sites'. in c:\inetpub\wwwroot\maplab-2.1-RC3\htdocs\mapedit\preview.php on line 469

Warning: [MapServer Error]: msOGRFileOpen(): Open failed for OGR connection `virtual.ovf'. File not found or unsupported format. in c:\inetpub\wwwroot\maplab-2.1-RC3\htdocs\mapedit\preview.php on line 469

Fatal error: Call to a member function on a non-object in c:\inetpub\wwwroot\maplab-2.1-RC3\htdocs\mapedit\preview.php on line 474
Now, I'm sure this is something to do with the connection parameters etc so I've tried many different options but get the same answer each time, so here are the relevant sections of my map file:
MAP
  NAME "test"
  STATUS ON
  EXTENT 338779.212856774 555322.261461872 341264.94672821 557186.754081183 
  SIZE 800 600 
  SHAPEPATH "C:/Inetpub/wwwroot/jo/carlisle/shapefiles/"
  LAYER
    NAME "OAN Sites"
    STATUS ON
    DATA "nmr data"
    TYPE POINT
    CONNECTIONTYPE OGR
    CONNECTION "virtual.ovf"
    UNITS METERS
    SIZEUNITS PIXELS
    LABELITEM "nmrdata.Project_Sitecode"
    TOLERANCE 0
    TOLERANCEUNITS PIXELS
    PROJECTION
      "init=epsg:4326" 
    END
    CLASS
      LABEL
        TYPE BITMAP
        SIZE MEDIUM
        POSITION CC
        OFFSET 0 0 
        BUFFER 0
        MINDISTANCE -1
        MINFEATURESIZE -1
        COLOR 0 0 0
        PARTIALS TRUE
        FORCE FALSE
      END
    END

My ovf file is in the shapefiles folder, and looks like this:
<OGRVRTDataSource>
    <OGRVRTLayer name="nmr data">
        <SrcDataSource>ODBC:user/pass@SitesDatabase</SrcDataSource> 
 	<SrcLayer>nmrdata</SrcLayer> 
	<FID>nmrdata.Project_SiteCode</FID>
	<GeometryType>wkbPoint</GeometryType> 
        <LayerSRS>WGS84</LayerSRS>
	<GeometryField encoding="PointFromColumns" x="Easting" y="Northing"/> 
    </OGRVRTLayer>
</OGRVRTDataSource>
I hope someone can help!
Thanks to everyone for all the great advice that I've already got from these forums!
Jo




This archive was generated by Pipermail.