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"




Google Map Mashup with WMS

by Jim 12. February 2010 15:41

I have found that Google does a good job with generic data but often a company needs to display their GIS data on a Google Map.  This is often the case when the general public is viewing the data and doesn't want to learn how a 'heavy' IMS website works.  In this case, I often suggest a Google Map Mashup using a WMS.

The Mashup gives us a few great features:

  • Ease of use
  • Speed of deployment
  • Capacity to scale (if using a cache of generated tiles)

You'll need a few things to get started:

  1. A place to host the website (this can be 'localhost' if you are developing and testing on the same machine)
  2. A working WMS (I assume you have one of these if you are trying to create a mashup.)
  3. A Google Map API key
  4. A Snippet of code that helps generate the request to the WMS (Found Here).

I have attached a simple example that you will need to put on your server and change the WMS layers.

WMS_Google_Mashup.txt (2.72 kb)

Tags: , ,



Google Maps Mashup with SQL 2008

by Jim 6. February 2010 10:16

I recently began working with SQL 2008 Spatial tools to build a Google Maps Mashup that was part of a larger work order management system for a land surveying company.  The ease of going from SQL to the Google API made it a breeze.

I had a few requirements:

  1. Dynamically place markers on the map based on database critera.
  2. Color those markers according to the values for each record in the database.
  3. Create a visually appealing map.
  4. Be fast.  My primary users are on a limited 400kbps DSL connection so speed is everything.

First, I used Manifold GIS software to get my data ready for use. This included moving the data into a SQL 2008 DB out of SHP file.  We chose Manifold GIS for a few reasons.  Mostly price, then also the great number of data formats that it can open and save as.

Second, I wrote a ASP page that ran on the server that accepted the bounding box of an area and then return a delemited list of results with Lat,Lon along with other attribute data.  This is very simlilar to a WFS but greatly trimmed down.

Third, I wrote a Javascript HttpXmlRequest function that would get the getBounds() function from the Google Map API and pass it to the script described in the second step.  Upon the ASP script returning a list, the Javascript would parse this list and place markers at appropriate locations on the map.

Code Samples:

  1. GIS Code
  2. ASP Code
  3. JS Code

Tags: , ,


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