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

Tamas Szekeres szekerest at gmail.com
Sun Feb 26 11:25:03 PST 2012


Phil,

You should not specify the data section in the OGR layer definition unless
you would define and sql select statement preceding with the 'where'
keyword. The terms 'using unique' and 'using srid' are not meaningful for
the ogr driver these parameters are automatically retrieved from the
geometry_columns metadata table. You should however specify the table name
(and probably the geometry column name) in the connection string, something
like:

 CONNECTION ' MSSQL:server=xxx;database=;uid=xxx;pwd=xxx;tables=NAV_STATE'

or

 CONNECTION
' MSSQL:server=xxx;database=;uid=xxx;pwd=xxx;tables=NAV_STATE(ShapeGeometry)'


The difference in performance may be investigated by reading large number
of shapes at a given scale.
I'm also planning to improve the mapserver mssql plugin to read native
SqlGeometries, but I'm now working on a QGIS mssql driver right now.

Best regards,

Tamas



2012/2/26 Anzel, Phil - NRCS, Fort Collins, CO <Phil.Anzel at ftc.usda.gov>

> 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.htmldoes not list MSSQL as a data provider.
> 4. MapServer documentation at http://mapserver.org/input/vector/mssql.htmlstill 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.
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20120226/ff694ed3/attachment.htm>


More information about the MapServer-users mailing list