Connection to a msSQL server

Frank Warmerdam warmerdam at POBOX.COM
Sat Sep 24 13:23:49 EDT 2005


On 9/24/05, Matthew Edmondson <matt0177 at gmail.com> wrote:
> I'm running Mapserver 4.6 with Chameleon and to this point only utilizing
> local shapefiles. I'm now going to be required to pull data from a msSQL
> table with lat and long points stored. I have a couple of quick questions.
>
>  1: How do I write the connection string to a msSQL db.

Matt,

You would use CONNECTIONTYPE OGR and a CONNECTION string like
"ODBC:MyDSN" where MyDSN is the DSN you setup for the Microsoft
SQL Server dataset in question.   You might want to skim the OGR ODBC
driver page at:

  http://www.gdal.org/ogr/drv_odbc.html

>  2: What format does the geo data need to be in the table. Currently, the
> lat/long is in decimal degrees in 2 different columns, is that appropriate,
> if not, what format does it need to be in.

That should be fine, but there is still the issue of identifying the columns
to be used as spatial columns.  For this you will need to setup an
OGR Virtual File (often extension .ovf).  These are documented at:

  http://www.gdal.org/ogr/drv_vrt.html

There is also a detailed wiki topic on the use of virtual files to access data
from ODBC connections such as yours.  I don't recall the url but you could
dig around for it if the above isn't enough info.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the mapserver-users mailing list