[mapserver-users] non spatial MSSQL data in a Layer JOIN

Daniel Morissette dmorissette at mapgears.com
Wed Jan 8 08:23:13 PST 2014


On 14-01-08 11:04 AM, KenHeer1 wrote:
> I have attribute data in a MS SQL database that I want to join in a Mapserver
> layer to data I have in a shapefile, but I cannot find anything that says
> yes you can or no you cannot. Really trying to get away from having to
> maintain this data in two places. The data in MSSQL is not spatial data. I
> found lots of posts on trying to get spatial data out of MSSQL but not what
> I needed. Closest result found was using ODBC connection but I couldn't find
> anything recent or specific examples.
>
> Is this possible and if so, can you point me to some docs on it?
>

You may be able to do it using OGR SQL syntax to join the two data 
sources. Have a look at the JOIN in

   http://www.gdal.org/ogr/ogr_sql.html#ogr_sql_joins

I didn't test with a MS SQL data source specifically to verify if it is 
possible to open a MS SQL table without geometry using OGR, hopefully 
that's supported. You'll find more info on the OGR syntax to connect to 
MS SQL at:

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

and here:

   http://mapserver.org/input/vector/mssql.html

and finally I would advise testing the creation of your connection 
string with "ogrinfo" before you try to add it to your mapfile layer. 
That will save you lots of headaches.


-- 
Daniel Morissette
http://www.mapgears.com/
Provider of Professional MapServer Support since 2000



More information about the mapserver-users mailing list