SV: [UMN_MAPSERVER-USERS] Point data from SQL Server

Sture Dingsøyr candalt at ONLINE.NO
Sat Sep 8 09:51:49 EDT 2007


Hi there 

I suggest that you use OGR and ODBC..

Make an DSN (odbc) connection to your database...you do this on your server (windows)...

Then make an Mapserver OGR layer...

You will ned a Mapserver version compiled with the OGR library, e.g. MS4W (Mapserver for windows)...

Check out http://ms.gis.umn.edu/docs/howto/ogr_howto

You could make an OGR Layer in mapserver with something like this:

LAYER
	CONNECTION "<OGRVRTDataSource><OGRVRTLayer name='test'><SrcDataSource>ODBC:@test,TABLENAME</SrcDataSource><SrcLayer>TABLENAME</SrcLayer><GeometryField encoding='PointFromColumns' x='XCOLUMN' y='YCOLUMN'/><GeometryType>wkbPoint</GeometryType></OGRVRTLayer></OGRVRTDataSource>"
	CONNECTIONTYPE OGR
	DATA "test"
	NAME "test"
	STATUS ON
	TYPE POINT
	CLASS
		MAXSCALE 100000000
		MINSCALE 0	
		NAME "test"
		COLOR 255 255 255
		SYMBOL "circle"
		SIZE 5
	END
END

You see that the CONNECTIONTYPE is ogr and that the CONNECTION string is an OGR spesific inlay XML..where you put the name of the DSN, tablename, x and y column...

See also: http://www.gdal.org/ogr/drv_odbc.html to see how to spesify the connectionstring...with username and password..

And:
http://mapserver.gis.umn.edu/docs/reference/vector_data/VirtualSpatialData?set_language=de&cl=de

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

If you need to transform your data into another coordinate system...you can also use the Mapserver PROJECTION tagg as normal in the LAYER... e.g.
PROJECTION
	"init=epsg:4326"
END

Cheers
Sture
--------------------------------------------------------------------------------
Fra: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] På vegne av Jerry O'Sullivan
Sendt: 8. september 2007 15:13
Til: MAPSERVER-USERS at LISTS.UMN.EDU
Emne: [UMN_MAPSERVER-USERS] Point data from SQL Server



Hi,

I have point data in SQL Server (X,Y Columns in a table), what is the best way to display this in
mapserver..ideally without having to transform it to another data format. 

Thanks in advance
Jerry





More information about the mapserver-users mailing list