Archive for the MapGuide Category
James’ recent post about the GIS Interchange File reminded me that I’ve been meaning to discuss some recent activity on the SQLite front in both FDO and OGR.
Traian Stanev recently proposed the creation of an SQLite provider for FDO. He was quickly arm-wrestled into supporting something close to OGC’s Simple Features for SQL specification, and working with Frank Warmerdam hammered out a GIS spec for SQLite that would work for both OGR and FDO. The beauty is that it’s a single file and can be read by any of the existing SQLite tools.
Traian completed initial development of the SQLite provider a couple weeks ago and Frank expanded OGR’s SQLite support to understand this common specification (this work is in the GDAL/OGR trunk for inclusion in the 1.6 release). These implementations have different strengths. The FDO provider was written to be blazing fast, features an in-memory spatial index, and writes to the FDO binary format. The OGR driver was written for maximum portability and allows writing WKT and WKB. Both implementations will read all three geometry formats and understand the dimension and projection information stored in the OGC-derived metadata tables.
You can download a totally unofficial build of the FDO provider from my website if you want to try it out with MapGuide 2.0 or maybe even Autodesk Map 3D 2009. I have successfully tested it in MapGuide with WKT, WKB, and FGF data. Adding this provider to MapGuide is easy:
- Drop the three files in the zipfile into your Server/bin/fdo directory
- Edit your main providers.xml file to include the SQLite provider using the included XML snippet
- Restart MapGuide
You will need some data. Testing can be done with SQLite files from the OGR sample data directory, but you will eventually want to use your own. It’s fairly simple to convert SDF and SHP. Open up a command window in your Server/bin/fdo directory and type something like:
SQLiteConverter.exe c:\src.sdf c:\dest.db
When creating a new data connection to this file, the provider only takes one configuration parameter: the full path to the file. If you run into any bugs, please post them on the FDO Trac instance.
OGR users that are tracking the trunk build can also try this out. With some amazement, I recently found that the enhancements to this driver had already been documented… obviously OGR places a premium on timely docs. ogr2ogr allows you to do a similar import operation, probably something like (untested):
ogr2ogr -f "SQLite" -dsco FORMAT=WKB dest.db src.shp
You can use additional ogr2ogr arguments to ensure that destination spatial reference and geometry type are written to the metadata tables.
Interestingly enough, a common SQLite GIS specification has been kicked around for quite some time. Last year it was discussed on the OSGeo Discuss mailing list, and more recently further discussion was held on the PostGIS mailing list and a wiki page was set up to collaborate on this idea. Obviously, there is considerable interest within the community. My personal hope is that this specification helps the idea of SQLite as a GIS data store take off.
One area where it could be improved is some kind of integration with Alessandro Furieri’s SpatiaLite extension for SQLite that allows common RDBMS GIS functionality in a native SQLite interface. Unfortunately, neither Frank nor Traian had the cycles to integrate this extension’s data format into the specification or the code at this point. Maybe we’ll get lucky and Alessandro will decide to somehow support this spec, but if not I hope there will be some convergence in the long run.
I know that there was more that I wanted to say, but it’s getting late and I don’t even have time to cut the extra gunk out of this post. Happy SQLiting!
-J
Related posts
The recent FDO 3.3.0 release comes with beta support for MS SQL Server Spatial. Adding this provider to MapGuide 2.0.0 on Windows is as simple as copying a few DLLs and updating the XML provider registry.
You’ll have to take my word for it, but all of the layers here are coming from SQL Server 2008:

There are a couple small gotchas that I ran into.
If your data contains geometry inconsistencies (basically anything that doesn’t match OGC geometry specs) then the February CTP of SQL Server 2008 will cause spatial queries to fail. Apparently Microsoft may be relaxing this validity requirement in future CTPs, but for now if you have “invalid” geometry, you will have to modify it.
You can find these problems with the GEOM.STIsValid() function and fix them manually, or you can get SQL Server to “fix” the problems with a statement like this:
update dbo.YOURTABLE set GEOM = GEOM.MakeValid();
The second issue was a defect in the provider that causes spatial filters to fail if you set the SRID (spatial reference) on your data. This is because with SQL Server 2008 the SRID of the filter geometry has to match that of the database, and the provider is not setting a SRID for the filter geometry.
For now, you can work around this by removing the SRID from your features with a statement like this:
update dbo.NAN_PARCELS set GEOM.STSrid = 0;
Apart from these two minor glitches, the provider is looking good so far. I’m hoping to get a chance to test it further with later releases of SQL Server 2008 and of the provider to see how well it performs.
If you get a chance to try this out and run into any further problems, please enter a good description of the problem into the FDO Trac issue tracker. The more you test now, the more likely it will work in your production environment later!
-J
P.S. Thanks to Orest at Autodesk for helping me work through these initial issues!
Related posts
If you’re interested in seeing what the recently released MapGuide Open Source 2.0.0 with DM Solutions Fusion (which in turn uses OpenLayers) looks like, you’re in luck!
We’ve put together an experimental / beta server for us to demonstrate and test new features for MapGuide. For now, it’s showing MGOS 2.0.0 Release, with some minor tweaks to the templates to use 8bit PNGs. Have a look here:
http://mapguidebeta.osgeo.org/
-J
Related posts
Fusion is incredibly flexible and cool technology for building web mapping applications. It is also very new technology with limited documentation, leaving more than a few people wondering how to figure it out.
Not to worry, help is on the way!
With the MapGuide Open Source 2.0 Beta2 release, a bit of documentation for Fusion was quietly placed in the MapGuide section of the OSGeo download server.
These docs are still a bit “beta” (ie. incomplete), but there is some good information in there for anyone looking to get their feet wet with Fusion. I would suggest ignoring the “Installing and Configuring” doc. Start with “Introduction” (briefly), go on to “Generic Web Mapping Application Components”, then “Widget Concepts”, and finally “Create A Basic Web Mapping Application”.
Apart from the documentation, there is also a new template called “learn” included in the Beta2 installer. Look familiar?

That’s right, this looks a LOT like the existing “AJAX” viewer. Although it isn’t as fancy as the fusion templates that I posted about previously, it does have a lot of functionality. Fortunately, it is absolutely riddled with comments, and is a lot easier to reverse-engineer. It is a good starting point for beginning to understand some of the more involved Jx layout capabilities, advanced widgets, etc. You can find it in the MapGuide install directory, under
WebServerExtensions/www/fusion/templates/mapguide/learn/.
If you are looking for something more bite-sized to get started with, you might also find this small code sample useful:
http://trac.osgeo.org/mapguide/wiki/CodeSamples/Fusion/SuperSimple
This gives you an _extremely_ basic application that uses a few lines of straight HTML/CSS/XML and no JavaScript other than what Fusion loads itself. I obviously didn’t take too much time to make it look pretty:

I have high hopes that the Fusion documentation will be considerably more complete before MapGuide Open Source 2.0 is released, but now early adopters have something to play with.
If you haven’t downloaded the latest beta, please help us to make it better by trying it out and reporting any problems.
-J
Related posts
Get ‘em while they’re hot, the MapGuide Open Source 2.0 beta installers are ready for your consumption.
Grab the source code or installers, and then head over to the samples page to find some Fusion layout examples to play with. The Milestone, Release, and Release Notes pages provide more information for the details-inclined.
This release absolutely has enough new features to justify a major version jump. Although the list of new features and bug fixes in this release is immense, a few of the biggies (in my mind) are:
- Fusion Support (by DM Solutions Group)
- Introduction of AGG rendering (optional)
- Stability Improvements
- JSON output format from CGI calls for easier AJAX
The initial Fusion technology preview was really cool looking, but this beta shows off what is possible to an even larger extent. Have a look at the following screen shots!





If that doesn’t give you a reasonable idea of the flexibility and capabilities of MapGuide Open Source when coupled with Fusion, I don’t know what will
The AGG renderer, while somewhat less flashy, is nonetheless a major improvement in MapGuide’s ability to deliver nice looking maps to the user. Have a look at the GD version of a zoomed-in area of my cemetery map:

And compare it to the AGG version of the same:

Pay special attention to the accurate rendering of line widths, and the nice smooth anti-aliasing.
Although stability has been addressed throughout the code base, another feature that I have been waiting for is losing FastCGI support in favour of a native Apache module and ISAPI extension. FastCGI caused intermittent service interruptions, and these new modules appear to have addressed this problem. My testing to this point has shown considerably higher stability.
And finally, JSON output from the MapAgent will make application developers’ lives a lot easier. Rather than getting back XML from the MapAgent, you can request JSON so you don’t have to deal with XML parsing any more.
Of course, with the amount of changes that went into this release under the hood, it’s likely that there will be some issues. Please make sure that if you run into a bug you report it.
-J