Yo Elven brothers and sisters, let's get down with the mapping.
This article will provide a rudimentary implementation of a MapInfo
.TAB flle to SVG converter, initially showing points only.
Note: 2004/03/21, I never did get this posted properly on SourceForge, but Bill Thoen has now adopted the code from this article and has extended it considerably..
essentially, the successor to the effort I made can now be found at MapInfo SVG on GISnet.com.
Mapping with SVG
As I'm sure many of you are aware, SVG lends itself wonderfully
to online presentation of map data. Combined with the capabilities
of Javascript and the DOM, the possibilities for interactivity and
analysis are boundless.
See these articles for excellent implementations of maps with SVG.
Vector-based
Web Cartography: Enabler SVG by Andreas Neumann and Andréas
Winter
Vienna
- Social Patterns and Structures by Andreas Neumann
Preparing data for SVG-mapping
However, massaging mapping data into SVG format can be a tedious
and unforgiving process which may involve countless hours preparing
and fine-tuning Perl scripts.
Ideally what could be done is find some way for users to prepare
the map layout in a common GIS package like MapInfo or ArcView,
and then use a translation program to automatically render the map
in SVG, potentially complete with options for mouse-over events,
data selection, etc.
MapInfo SVG Conversion
This article will limit itself to illustrating the basic programming
techniques involved in exporting data from MapInfo to SVG and initially
only convert points.
First, I'd like to walk you through the conversion process and
then we will step back through the code. You will need MapInfo 5.5
or higher (not tested with earlier versions, probably works fine
down to 4.0?). Download the workspace, caps table, and program with
source code in this package.
Unzip the package and open the StateCapitals.wor workspace (you
may need to hack at it if you are using MapInfo 4.5 or earlier).
Thanks to the Geographic
Names Information System for the data. Next, run the program
(you may need to re-compile it if you are using MapInfo 5.0 or earlier).
Name the output Capitals.svg and save it in the directory where
you unzipped everything else.
If you do not have MapInfo and are trying to follow along, here's
the desired svg output file. Next, open the html file and you should
see the capitals.
MapInfo SVG Converter
Now let's look at the program. I'll just make this very high-level,
you can use the MapBasic reference and the SVG references on this
site for details. Open the .mb file. You may use a text editor if
you do not have MapBasic (preferably something that will give you
line numbers.)
featured resources
- Elizabeth's Baby Nursery Store
- Offers information on divorce, child custody and child support laws, property division, spousal support, and more.
- Cartasite Local Fleet Management - Realtime Operational Intelligence
- Complete GPS Resources UK: BLUETOOTH GPS, CAR GPS, GPS SYSTEM, GPS SOFTWARE, PDA GPS, GARMIN
|
The first section pops up the dialog for output. Obviously there's
a lot of room for enhancements, I always like to do all my MapBasic
as "engines" which only present a user dialog if they
don't find the input in an .ini file. This has not been done yet.
Lines 29-59 do the calculations to map the x/y coordinates to pixels.
Lines 72-125 loop through the layers and each object and convert
any points.
What's Next?
This program as written only does points and doesn't read and
preserve any styles or labeling. There are two really great MapInfo
to SVG exporters out there already which are full-featured and do
a fairly decent job of re-creating a mapper window in SVG, and even
go beyond the capabilities of MapInfo to allow you to use advanced
SVG techniques.
Map2SVG contact
Dr. Franz-Josef Behr
SVGExport Utility
contact Dany Bouchard of DBx Geomatics
I am not aware of any such programs for other GIS platforms. Our
program does not intend to fill the space of either of those programs,
but rather may serve as a nucleus or jumping off point for applications
where you have specific requirements or needs which require access
to the source code such as batch processing.
Let me know if there's anyone who would like to contribute to this
effort. I have applied to put this up on SourceForge.