Archive for the Utilities Category

Listing MapGuide Data File Locations

Over on the MapGuide Users mailing list, Zac said: "it would be nice to add a text file listing the unmanaged resources"

Happy to oblige! :)

OK, not quite, but I’ve created a simple command-line PHP script that talks to the MapGuide repository and outputs a CSV containing the ResourceID and File Path for all data sources that I’ve recognised as file-based. I’ll leave it as an exercise for the reader to filter this to only show unmanaged data sources.

Sample output:

C:\MgTest\listpaths>php cli_listfiles.php admin

“Library://Test/Data/MyImages.FeatureSource”,”C:\TestData\img_ecw”
“Library://Test/Data/MyImages2.FeatureSource”,”C:\TestData\img_ecw”
“Library://Test/Data/MyImages3.FeatureSource”,”C:\TestData\img_sid”
“Library://Test/Data/ABC123.FeatureSource”,”C:\TestData\img_ecw\”
“Library://Test/Data/MyImages4.FeatureSource”,”C:\TestData\img_sid\”
“Library://ImageTest/Data/ImageTest.FeatureSource”,”C:\ImageTest”
“Library://ImageTest/Data/Tiled.FeatureSource”,”C:\ImageTest\”
“Library://SdfTest/Data/bc_border.FeatureSource”,”%MG_DATA_FILE_PATH%”

I think this shows how easy it is to throw around the XML that MapGuide uses in its repositories.

-J

Related posts

FeatureServer Rules The Universe!

OK, not quite, but MetaCarta’s decision to release FeatureServer as open source makes me extremely happy.

Between OpenLayers (an OSGeo incubating project), TileCache, and FeatureServer, MetaCarta deserves a lot of credit for its innovative contributions to the open source geospatial community. I only have two thoughts:

  • This is a real boost for a RESTful GeoWeb
  • I wonder how long it will be before MetaCarta gets acquired

Taking into consideration tile caching, RESTful interfaces, and growing consensus on RFC-2 for GeoJSON, I see some real momentum for a geospatial web that actually scales.

Update: I missed crschmidt’s post about this. Sounds like a proud parent :)

-J

Related posts

fdo2fdo Geospatial Data Tool

Today, Haris Kurtagic over at SL-King announced the latest release of his cool fdo2fdo utility.

This application hasn’t got much attention yet, but it sure deserves some. Initially used as a test platform for Haris’ open source King.Oracle FDO provider, it has quickly evolved into a general purpose FDO data transfer and inspection toolkit.

FDO2FDO Express Copy Example

Haris does a much better job of describing the functionality of this tool than I ever could in his flash movie. I really encourage you to have a look, but set your resolution to at least 1280×1024 for best viewing. As you’re watching, keep in mind that there is a command line utility included which can perform all of the common schema-related (ExportSchema, CreateDatastore, ApplySchema, CopyData) tasks. For usage you can just navigate to the isntallation folder and type f2fcmd from the Windows command line.

The demo shows SHP, SDF, and Oracle as datastores, but you can easily add any FDO provider to the application. These include things like MySQL, ArcSDE 9.1, and (read-only) any OGR-supported data format. The utility of this application is simply outstanding.

If you paid attention to the movie (and know where I work) you’ll be able to figure out my personal interest in this tool. It has allowed the City to set up a low cost one-click data synchronization between a remote field application and a corporate database. All this required was the judicial use of the “Filter” option, some saved XML transfer tasks, and pre-defined schemas. One cool feature (that we didn’t use) is that you can apply geometry filters, allowing you to transfer a specific area of interest.

fdo2fdo is currently only available in a windows binary download (with Oracle instant client bundled, which is why it’s so big), but Haris has assured me that after he cleans up the code he will be submitting at least the command line and API code to the FDO SVN repository under an appropriate OSI-approved license. Haris is new to the open source world, but he’s catching on really fast.

I believe that the API and command line tool were coded in standard C++, so I’m hoping that they can be ported to Linux shortly after he uploads them. I’m also hoping that the GUI portion of the application will be uploaded. It’s apparently written in MFC, so there isn’t an easy translation to Linux. However, it could act as a model to help someone else build a Linux-based GUI.

-J

Related posts

WMS on Steroids - KML 2.1 Regions Application

I hate the way Google keeps making me lose sleep :)

By now most of you know that Google has released version 4 of Google Earth. This version comes with a new revision of the KML format, with some really cool goodies. If you haven’t already, make sure you download the latest version before trying out any of the live demos in this post.

I’ve just finished hacking together a PHP script that distributes WMS services as nested Region-based KML layers, what Google is calling SuperOverlays.

You can download the WMS2KML script as a zipfile, or view the source online. And no comments on the sloppy style… I’m tired :)

Looking for some good WMS sites to try this out with, I picking up on Matt Perry’s post about his favourite WMS servers a few months ago and used some of these for my examples. The following images show what each of the WMS reflectors gives for an area off the east coast of Florida near Jacksonville.

Base

Jacksonville - Base

USGS DOQ

Jacksonville - DOQ

Live Example - Source Code

USGS DRG

Jacksonville - DRG

Live Example - Source Code

NEXRAD Base Reflectivity

Jacksonville - NEXRAD

Live Example - Source Code

Well, that’s it… I’m off to work. Let me know what you think, and please pass along links to any services you put in place!

Related posts

MapGuide Open Source Package Utilities

MapGuide Open Source uses a binary XML data structure to store its site configuration. This contains things such as data1, layer definitions, map definitions, web layouts, and just about everything else. The existing data management tools don’t provide an easy way to reference external data2, but the advantages far outweigh this disadvantage.

The recent 1.0.0 release of MapGuide comes with a great feature that allows you to import and export portions of this XML data store, including any referenced spatial data, into something called a “package”. A package is just a zipfile with an .mgp extension, which contains XML data and any referenced files.

The only problem with this feature is that it could only be accessed via the web-based site administrator. I wanted to use this ability to automate data transfers from my intranet site to my externally hosted internet site, and really didn’t want to be staying up until midnight each night. Fortunately, MapGuide Open Source is, well, open source. The site administration interface is written in PHP, and uses the same well-documented web API as the web maps.

Armed with a hammer (what else would you use to drive screws?) I attacked the site administration import/export code, and came up with a couple PHP utilities for importing and exporting packages from the command line using the php CLI.

cli_loadpackage.php
Usage: php cli_loadpackage.php AdministratorPassword PackageName.mgp

cli_makepackage.php {watch line wrap}
Usage: php cli_makepackage.php AdministratorPassword PackageName.mgp Library://FolderPath "Package Description"

You can download mgpackageutils.zip from my site, but only with the understanding that I accept no responsibility for your use of these tools. Even if you turn into a chicken. This archive contains the PHP utilities, a readme file, a copy of the LGPL license, and a couple DOS batchfiles for testing:

http://www.jasonbirch.com/files/mgpackageutils.zip

Next job? Create a utility to unzip the .mgp file, rsync the results to the external site, and zip it back up before importing on the other side. I’ll just file that at the bottom of my 10-page TODO list…

Footnotes:

1. Although the data itself could potentially be stored as a byte stream in the XML file, spatial data is typically stored within the Library repository on the server.

2. At some point I hope to be able to provide some tools to define external data sources, based on a conversation on the MapGuide Users List)

.

Related posts