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

Willem Schwarte willem at giskit.nl
Tue Apr 11 05:17:19 EDT 2006


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.

 

Willem

 

 

________________________________

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

 

Hi,

 

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 

 

Library://Bolsward/Data/Data/totaal_tvg32010101_v.FeatureSource

 

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()->GetDef
aultGeometryPropertyName());

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.

 

Jason

 

 

________________________________

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

Hi,

 

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 ?

 

Thanks,

 

Willem

 

 

<ResourceId>Library://Bolsward/Data/Data/totaal_tvg32010101_v.FeatureSou
rce</ResourceId> 

  <Depth>4</Depth> 

  <Owner>Administrator</Owner> 

  <CreatedDate>2006-04-07T08:32:36Z</CreatedDate> 

  <ModifiedDate>2006-04-07T08:32:36Z</ModifiedDate> 

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

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

  <IconName>FeatureSourceSdf</IconName> 

  </General>

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

  <Inherited>true</Inherited> 

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

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

  <Name>Everyone</Name> 

  <Permissions>r,w</Permissions> 

  </Group>

  </Groups>

  </Security>

  </ResourceDocumentHeader>

  </ResourceDocument>

 

 

________________________________

Van: Jason Birch [mailto:Jason.Birch at nanaimo.ca] 
Verzonden: dinsdag 14 maart 2006 8:19
Aan: users at mapguide.osgeo.org
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:

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

 

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 http://earth.nanaimo.ca/ ) 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:

http://kml.tjworld.net/downloads.php

- 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 :)

 

Jason

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20060411/922d3d79/attachment.html


More information about the Mapguide-users mailing list