[mapguide-users] Create programmatically a map

Kenneth Skovhede, GEOGRAF A/S ks at geograf.dk
Thu Feb 12 07:54:50 EST 2009

You could have the problem that .Net emits an utf-8 byte-order-marker 
(BOM), when
writing xml.

To counter this, explicitly create an encoding instance:
System.Text.Encoding enc = new System.Text.UTF8Encoding(false);

Then implement a xml writer, or manually convert the xml to bytes, using 
the encoding.

FYI, the MaestroAPI is LGPL, and so you may use it as a library, even 
for commercial applications,
and it handles this quirk and others.

Regards, Kenneth Skovhede, GEOGRAF A/S

sekko970 skrev:
> Dear all,
> I have created programmatically a map (and its layout) using MG .Net web
> API.
> After creation, the new map and layout are visible in MG Maestro, and using
> the 'Show in browser" button are correctly shown in browser.
> The problem happens when I load the map directly from browser, and the
> following error appears:
> << The type 'OSGeo.MapGuide.MgNullArgumentException' in assembly
> 'MapGuideDotNetApi, Version= 11, Culture=neutral,
> PublicKeyToken=null' is not marked as serializable >>.
> Then, simply saving the new layout from MG Maestro (without any
> modification), and reloading the map directly from browser, the error
> disappears and the map is correctly shown.
> After saving the layout, there aren't differences in map and layout XML
> definitions.
> Have you any idea about?
> Thank you in advance.
> Fabio

More information about the mapguide-users mailing list