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:
- Dynamically place markers on the map based on database critera.
- Color those markers according to the values for each record in the database.
- Create a visually appealing map.
- 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:
- GIS Code
- ASP Code
- JS Code