AW: [mapguide-users] RE: MapGuide OS with Google Earth

Thomas Grosser grosser at
Tue Apr 11 08:51:34 EDT 2006

Dear Willem,
may be i didn´t understand the "real" problem, but in my enviroment everything seam to be ok. Can you describe me in detail whats your problem ?

Mit freundlichen Grüßen 

Thomas Grosser 
- Geschäftsleitung - 

Kom21 - Nürnberg 
Großweidenmühlstraße 28 
90419 Nürnberg 
Tel.: 0911 - 378 33 85 
Fax: 0911 - 378 33 86 



Von: Willem Schwarte [mailto:willem at] 
Gesendet: Dienstag, 11. April 2006 13:50
An: users at
Betreff: RE: [mapguide-users] RE: MapGuide OS with Google Earth

Maybe someone can clarify this for me, loading this shape in Studio results in a lot of lines. When using this to export to KML it returns only a very small part. 


Can't seem to figure out how the readNext() works, and why it stops early???


Hope somebody can check this for me, would be nice for a demonstration tomorrow.







Van: Willem Schwarte [mailto:willem at] 
Verzonden: dinsdag 11 april 2006 11:51
Aan: users at
Onderwerp: RE: [mapguide-users] RE: MapGuide OS with Google Earth


Nevermind.... Transforming the coordinates to lat long worked! 





Van: Willem Schwarte [mailto:willem at] 
Verzonden: dinsdag 11 april 2006 11:17
Aan: users at
Onderwerp: RE: [mapguide-users] RE: MapGuide OS with Google Earth


Ok, that worked, now I'm getting coordinates...  but in Google Earth the map is zoomed to completely the wrong place. 


Could this be that our coordinate system differs from what Earth is expecting?


I'm getting this from my resources:


Boundary Line#myBoundaryLine0clampedToGround157086.938,403382.689,0 157078.527,403376.459,0 157074.187,403374.389,0 157070.947,403375.979,0 157068.266,403381.019,0 157069.616,403384.109,0 157080.227,403390.199,0 157082.778,403390.529,0 157084.707,403389.319,0 157087.568,403385.819,0 157086.938,403382.689,0



Our coordinate system is Arbritrary X-Y Meters... the Sheybogan is WGS84.






Van: Jason Birch [mailto:Jason.Birch at] 
Verzonden: maandag 10 april 2006 18:37
Aan: Willem Schwarte
CC: users at
Onderwerp: [mapguide-users] RE: MapGuide OS with Google Earth




Something that I've recently figured out is that it's a lot easier to debug Mg errors if you wrap your code in Try/Catch.  Have a look at some of the code in the mapadmin area, or in the package command line utilities I posted about yesterday.


I wonder if the geometry column for your data source is the same as the sample data (SHPGEOM).

You can see what this is supposed to be by looking at a layer based on that feature source in Studio, under "Feature Data Setup".  You can also get this information by going into the mapagent/index.html file, clicking on Feature Service API in the upper left, then clicking on Describe Feature item, and finally fill in the FeatureSource ID 




The sample data definition looks like this:


  <xs:complexType name="HydrographicPolygonsType" abstract="false" fdo:geometryName="SHPGEOM">


The fdo:geometryName attribute is what you want here.  


A better solution would be to let the code extract the geometry column... hmm... bit of research later:


You could replace this line:


  $byteReader = $featureReader->GetGeometry('SHPGEOM');

With this:


  $byteReader = $featureReader->GetGeometry($featureReader->GetClassDefinition()->GetDefaultGeometryPropertyName());

Note that this isn't very efficient; it checks the default geometry property on each feature object.  It would be better to do this outside of the loop, or at the top of the loop in a section that's only executed once.






From: Willem Schwarte [mailto:willem at] 
Sent: Monday, April 10, 2006 07:38
To: Jason Birch
Cc: users at
Subject: RE: MapGuide OS with Google Earth



I have tried your sample for Google Earth, and it work fine with the sheybogan sample data.


If I paste this in my internet Explorer http://localhost/sites/google_earth\water.php <http://localhost/sites/google_earth/water.php>  I will get a bunch of coordinates.


But when I try to use my own data I get an error:


PHP Fatal error: Uncaught exception 'mgobjectnotfoundexception' in Unknown on line 0


In the water.php file I change this line like so:


$featureReader = $featureService->SelectFeatures(new MgResourceIdentifier("Library://Bolsward/Data/Data/totaal_tvg32010101_v.FeatureSource"), "totaal_tvg32010101_v", null);


As you can see in XML below, this does exist.  Do you might know why I don't get anything ?












- <http://localhost/mapguide/mapagent/mapagent.fcgi?OPERATION=ENUMERATERESOURCES&VERSION=1.0.0&LOCALE=en&RESOURCEID=Library%3A%2F%2F&TYPE=&DEPTH=-1##>  <ResourceDocumentHeader xmlns:xsd="" xmlns:xsi="" xsi:noNamespaceSchemaLocation="ResourceDocumentHeader-1.0.0.xsd">

- <http://localhost/mapguide/mapagent/mapagent.fcgi?OPERATION=ENUMERATERESOURCES&VERSION=1.0.0&LOCALE=en&RESOURCEID=Library%3A%2F%2F&TYPE=&DEPTH=-1##>  <General>



- <http://localhost/mapguide/mapagent/mapagent.fcgi?OPERATION=ENUMERATERESOURCES&VERSION=1.0.0&LOCALE=en&RESOURCEID=Library%3A%2F%2F&TYPE=&DEPTH=-1##>  <Security xsi:noNamespaceSchemaLocation="ResourceSecurity-1.0.0.xsd">


- <http://localhost/mapguide/mapagent/mapagent.fcgi?OPERATION=ENUMERATERESOURCES&VERSION=1.0.0&LOCALE=en&RESOURCEID=Library%3A%2F%2F&TYPE=&DEPTH=-1##>  <Groups>

- <http://localhost/mapguide/mapagent/mapagent.fcgi?OPERATION=ENUMERATERESOURCES&VERSION=1.0.0&LOCALE=en&RESOURCEID=Library%3A%2F%2F&TYPE=&DEPTH=-1##>  <Group>











Van: Jason Birch [mailto:Jason.Birch at] 
Verzonden: dinsdag 14 maart 2006 8:19
Aan: users at
Onderwerp: MapGuide OS with Google Earth


I've uploaded a pretty basic example of using MapGuide OS to serve KML to Google Earth, based on an example that Bob Bray provided with the first preview:


This is totally unsupported, but in my experience it works with the Sheboygan data set.  On a standard Windows/Apache/Php install you should just have to follow the instructions in the readme.txt file.


I had a better example that worked to return data for the current bounding box (you can see it in action at ) but I was unable to get this working with the sample data, so either something has changed with 1.0 or the sample data is different somehow than what I'm serving.  I didn't get any error messages, but seeing all of the exception codes in the API, I guess I should be trapping for these somehow.  Not enough time to research now though.


My to-do list:

- clean up the code, make it more modular, and possibly use TJ's KMLDocument class for generating the KML:

- figure out how to read the default scale ranges and symbology from MapGuide, and return a semblance of those instead of having to custom code each layer.  

- dynamically rewrite the bounding box, so that it shifts to the foreground when the view is tilted, allowing delivery of data without killing the server with a huge extent

- deliver GroundOverlay images as an option for small-scale mapping where serving vectors is inappropriate


Of course Autodesk could just step in any time now and provide a template for default delivery of KML :)




-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Mapguide-users mailing list