Thursday, 25 August 2011

Something (even more) revolutionary this way comes

When I announced that Maestro 4.0 would give you the revolutionary ability to connect to multiple sites at the same time, there was actually a reason for that. Because also coming in Maestro 4.0 is an entirely new way of managing and authoring your MapGuide resources.

Introducing the Local Connection Mode



When you click Connect Locally, you still have to supply a configuration file as you would a TCP/IP connection, exception this file will be provided by the Maestro installation.



And it functions and operates like any other connection



But here's the main difference. Unlike the TCP/IP connection, which is just a wrapper around the official MapGuide API, and thus requires a connection to the MapGuide Server and a cumbersome assembly signing process to properly set up, the Local Connection does not require any MapGuide Server at all!

This is because the Local Connection wraps our very own implementation of the MapGuide API, which runs entirely on the desktop allowing for fully client-side spatial data access and map rendering/stylization.

With the Local Connection mode, you can completely author up a whole bunch of Maps completely disconnected from any MapGuide Server and when you're done, use the magic of packages to instantly load this onto a given MapGuide Server without having to leave the application at all!

Because the MapGuide API uses FDO, we have the (near) full capabilities of FDO available to us, allowing my grand vision of merging FDO Toolbox together with Maestro to finally become reality. Here's some ideas that are possible with Local Connection mode:

  • Bulk Copying of feature source data with support for re-projecting features provided by the MgCoordinateSystem API

  • On a similar theme: Creating optimized datasets from Feature Sources containing Feature Joins

  • Supporting the Convert to SDF and Generalize Data options of Load Procedures

  • Fully client-side previewing of Maps, Layers and Feature Sources with the exact rendering/stylization engine

  • Every other conceivable feature that currently exists in FDO Toolbox, but not in Maestro

  • Super blazing fast localized tile-generation^


Now sadly, this groundbreaking new feature has one small caveat just like FDO Toolbox. It will be windows-only :( Because even though the MapGuide Desktop API itself was written in the most portable fashion of C++, it is the glue libraries that allow a .net application like Maestro to interop with it that are not compatible with Mono in Linux/Mac. But hey, having one revolutionary new feature is just as good as two revolutionary new features is it not?

Stay tuned for a more in-depth overview of the Desktop implementation of the MapGuide API that powers this new feature.

^ This idea is predicated on the fact that the Desktop implementation of the Tile Service APIs is nearly identical to the MapGuide Server, thus it would be theoretically possible to generate the tile cache client-side and copy the tile cache directory over to its corresponding directory in the MapGuide Server installation.

Tuesday, 16 August 2011

Something revolutionary this way comes

Each release of Maestro until now has brought with it a series of enhancements that are mostly incremental and evolutionary in nature that improves your MapGuide authoring productivity.

Coming to the next release of Maestro (4.0) is a new feature which I can safely say will be nothing but revolutionary



That's right! Maestro 4.0 will let you connect to and work with multiple sites at the same time! Can you imagine the possibilities?

Monday, 15 August 2011

Announcing: MapGuide Maestro 3.5 final + SDK

I'm happy to announce the final release of MapGuide Maestro 3.5 and SDK

New Features from 3.5 beta 2:

  • Layer editor now supports multiple composite styles per scale range

  • New informative progress dialog for map definition extent calculation

  • New "Copy Resource IDs to clipboard" context menu command

  • New Symbol Definition Validation rules

  • Client-side support for transforming coordinates to WGS84.PseudoMercator. It should now be possible to change your Map Definition coordinate system to WGS84.PseudoMercator, and have the extents automatically transformed to match, and immediately usable in a Fusion Application Definition with a Google/Yahoo/Bing backdrop


New in the SDK is a new sample: StandaloneWebLayoutEditor. This sample illustrates how to use the Maestro.Editors library to re-use the Maestro resource editors from outside of MapGuide Maestro.

Download
Download SDK

Saturday, 6 August 2011

Announcing: MapGuide Maestro 3.5 beta 2

I'm happy to announce the second beta release of MapGuide Maestro 3.5

One of the interesting new features is in-place upgrading of resources to the latest schema version. You know that pale yellow bar at the top with that upgrade button that's always disabled?



It's now enabled, and when you click it it will upgrade the edited resource to the latest schema version supported by the MapGuide Server you're connected to.



Once upgraded, the editor refreshes itself and the new editor features for that schema version become activated.


This is supported for all resource editors. Currently the conversion is one-way (always to the latest schema version. I may look at converting to a specific version in a future release.

Other new features and changes include

  • Enhanced Autodesk Infrastructure Map Server 2012 support

  • Previewing is now enabled for Watermark Definitions

  • Map Definition support for re-ordering layer groups

  • Layer Definition editor now supports inline symbol definitions for composite symbolization

  • A whole bunch of assorted productivity improvements (too many to detail, but you'll recognise it when you see it)

  • The usual assortment of bugfixes


This is the last beta release before the final 3.5 release

Download

Friday, 5 August 2011

Maestro API: 3 ways to create and work with resources

As explained previously, the Maestro API allows you to work with MapGuide resources in an object-oriented manner, completely avoiding the need to work with raw XML content (although the Maestro API provides such facilities should you require them)

What I didn't fully explain was how one actually can create retrieve and work with these objects. In the Maestro API, there are 3 ways to do this.

First way: Using the ObjectFactory class

The ObjectFactory class allows you to create resource objects from scratch. This method was available in the previous version of the Maestro API, but because you were working with generated classes, there was a very high chance of NullReferenceExceptions and DBXML errors being thrown at your face because you forgot to instantiate one or more of its many child properties.

The ObjectFactory class insulates these concerns away for you. Any resource you create via this approach satisfies the minimum content model requirements of its respective XML schema.

Here's an example of creating a feature source object to a SQL Server 2008 Express database from scratch

IFeatureSource fs = (IFeatureSource)ObjectFactory.CreateFeatureSource(conn, "OSGeo.SQLServerSpatial");
fs.SetConnectionProperty("Service", "(local)\\SQLEXPRESS");
fs.SetConnectionProperty("DataStore", "MyDatabase");
fs.SetConnectionProperty("Username", "mapguide");
fs.SetConnectionProperty("Password", "maestro");

where conn is an instance of the IServerConnection interface

Second way: Using the IResourceService

The GetResource method of the IResourceService interface automatically fetches XML content for the specified resource id and returns a strongly-typed IResource object.

Here's an example of fetching a feature source object

IFeatureSource fs = (IFeatureSource)conn.ResourceService.GetResource("Library://Test/Data/SQLServer.FeatureSource");


where conn is an instance of the IServerConnection interface

Final way: Using ResourceTypeRegistry

The final way is to use the ResourceTypeRegistry class to go from raw XML content to IResource objects and vice versa.

Here's an example of creating a feature source object from an feature source XML document on disk.

string xml = File.ReadAllText("FeatureSource.xml");
IFeatureSource fs = (IFeatureSource)ResourceTypeRegistry.Deserialize(xml);
fs.CurrentConnection = conn; //Need to assign a connection if you want to use any extension methods
where conn is an instance of the IServerConnection interface

And here's one example of going the other way, from feature source object to file

IFeatureSource fs = ...;
using(Stream sr = ResourceTypeRegistry.Serialize(fs))
{
using(FileStream fs = File.OpenWrite("FeatureSource.xml"))
{
Utility.CopyStream(sr, fs); //Or if you use .net 4.0 use the new CopyTo() method
}
}


So there you have it, 3 simple ways of working with resources in the Maestro API

Debugging with the Edit As Xml command in Maestro

Here'a a useful tip to assist in reporting bugs and debugging in Maestro.

At the heart of Maestro is the editors to let you edit the various types of resources that can be stored in a MapGuide Server. Now these editors are fully functional for most general cases, but should some part of a resource editor not work as advertised, here's what you can do.

Use the Edit As Xml command to view the XML form of the resource you are editing.


This command is not only convenient in that it allows you to bypass the editor and work on the actual XML content, if you know what you're trying to edit, but it also shows the xml content of the edited resource in its current state.

The resource editors in Maestro do not operate on raw XML content, instead they operate on a deserialized in-memory object form of that content. It is here that certain properties and attributes may be set incorrectly or missed due to bugs in the editor.

By invoking that command, Maestro is instructing the in-memory resource object to serialize itself back into XML, thus allowing you to see for yourself whether edits you have made in the editor have actually been applied.

This command has been very useful for me personally when implementing new resource editors or enhancing existing ones because the XML you see is exactly what gets sent back to the MapGuide Server when you hit the Save button, thus it has proven invaluable for me in debugging editor functionality and XML content model errors.