[mapserver-users] OGR and MSSQL non-specific error

Anzel, Phil - NRCS, Fort Collins, CO Phil.Anzel at ftc.usda.gov
Sun Feb 26 09:44:52 PST 2012


All,

I'm a bit confused: does MapServer 6.0.1 and OGR "officially" work with Sql Server 2008? I can see how use of the native SqlGeometry objects might be a bonus and would like to put it to the test.

MSSQL access via the plugin works with this LAYER:
  LAYER
    NAME 'States'  STATUS ON
    PROJECTION 'proj=latlong' 'ellps=GRS80' 'datum=NAD83' END
    CONNECTIONTYPE PLUGIN
    PLUGIN ...\msplugin_mssql2008.dll'
    CONNECTION 'server=xxx;database=;uid=xxx;pwd=xxx'
    PROCESSING 'CLOSE_CONNECTION=DEFER'
    DATA "ShapeGeometry from NAV_STATE as base_table using unique OBJECTID using SRID=4269"
    TYPE POLYGON
    CLASS STYLE OUTLINECOLOR '#e1dd00' WIDTH 2 END END
  END

This variant, changed to use OGR, fails:
  LAYER
    NAME 'States'  STATUS ON
    PROJECTION 'proj=latlong' 'ellps=GRS80' 'datum=NAD83' END
    CONNECTIONTYPE OGR
    CONNECTION 'MSSQL:server=xxx;database=;uid=xxx;pwd=xxx'
    PROCESSING 'CLOSE_CONNECTION=DEFER'
    DATA "ShapeGeometry from NAV_STATE as base_table using unique OBJECTID using SRID=4269"
    TYPE POLYGON
    CLASS STYLE OUTLINECOLOR '#e1dd00' WIDTH 2 END END
  END

Using shp2img (from MapServer 6.0.1 distribution for Win32/VS2010 retrieved 2011-07-18) with "-all_debug 5" yields:
  msOGRFileOpen(): OGR error.
  GetLayer(ShapeGeometry from NAV_STATE as base_table using unique OBJECTID using SRID=4269)
  failed for OGR connection `MSSQL:server=xxx;database=xxx;uid=xxx;pwd=xxx'.
There is no further detail as to the failure.

By way of reference,
1. In mapserver-users Digest, Vol 49, Issue 58, Tamas Szekeres states "BTW: With the current approach, connecting to mssql via OGR provides better performance than using the mssql plugin."
2. Tamas also indicates that OGR can talk to MSSQL in "[gdal-dev] OGR MS SQL Spatial driver has been added", http://www.osgeo.org/pipermail/gdal-dev/2010-September/026055.html.
3. MapServer documentation at http://mapserver.org/input/vector/ogr.html does not list MSSQL as a data provider.
4. MapServer documentation at http://mapserver.org/input/vector/mssql.html still shows use of the msplugin_mssql2008.dll plugin.

I must also wonder: has a measurable improvement been demonstrated by eliminating the plugin and going to the direct OGR to MSSQL connection?

Yours in confusion,

- Phil Anzel
       Contractor for USDA/NRCS
       ITC Web Soil Survey Team Member

This electronic message contains information generated by the USDA solely for the intended recipients. Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject the violator to civil or criminal penalties. If you believe you have received this message in error, please notify the sender and delete the email immediately.



More information about the mapserver-users mailing list