Import MSSQL Spatial Data into Manifold via .vbs script

by Jim 16. January 2011 17:55

A project I am working on requires me to import and overwrite everchanging data from a SQL database into a Manifold .map file.  This .map file is then used to generate WMS tiles that are overlaid over Google Maps.  Here is the quick and dirty script to bring in a table/view from SQL into Manifold and save the .map.

wscript.echo "Beginning Import"
set app = createobject("Manifold.Application")
set doc = app.NewDocument("C:\test_dir\map.map", false)
Set SQLImport=doc.NewDataSource()
SQLImport.ConnectionString = "DRIVER={SQL Server};SERVER=.\SQLExpress;UID=user;PWD=pass;DATABASE=database"
SQLImport.ConnectionType ="SQL Server"
TableName= "dbo.TABLE_NAME.Geometry"
SQLImport.ImportDrawing (TableName)
set SQLImport = nothing
set doc = nothing
set app = nothing
wscript.echo "Ended Import"



Powered by BlogEngine.NET
Original Design by Laptop Geek, Adapted by onesoft