For wms layers to show up in Google Earth, you generate a groundoverlay. The projection of the mapfile or layers itself is not so important, as long as the wms service is able to publis in epsg:4326.

This means that in your map metadata you need to have something like:

METADATA
  "wms_title" "My WMS map"
  "wms_srs" "EPSG:4326 EPSG:28992"
"wms_onlineresource" "http://www.myserver.com/cgi-bin/mapserv.exe?map=somemap.map";
 END

where you separate the supported projections with spaces.


When you create a GroundOverlay, Google generates the following kml snippet:

Make sure to add the STYLES= to the end of the request or mapserver will generate a wrong result (this is for my 5.0 installation)

<GroundOverlay>
           <name>Terreincontouren</name>
           <color>adffffff</color>
           <Icon>
<href>http://www.myserver.com/cgi-bin/mapserv.exe?map=somemap.map&amp;VERSION=1.1.1&amp;REQUEST=GetMap&amp;SRS=EPSG:4326&amp;WIDTH=1024&amp;HEIGHT=1024&amp;LAYERS=aLayer&amp;TRANSPARENT=TRUE&amp;FORMAT=image/png&amp;STYLES=&amp;</href>
               <viewRefreshMode>onStop</viewRefreshMode>
           </Icon>
           <LatLonBox>
               <north>52.43886219516767</north>
               <south>52.19180808173348</south>
               <east>5.137624941169889</east>
               <west>4.652306951338773</west>
           </LatLonBox>
       </GroundOverlay>



It is also possible to show a mapserver legend in Google Earth with the following kml snippet:

<ScreenOverlay>
       <visibility>1</visibility>
           <name>Legenda - Percelen</name>
           <Icon>
<href>http://www.myserver.com/cgi-bin/mapserv.exe?map=somemap.map&amp;VERSION=1.1.1&amp;REQUEST=GetLegendGraphic&amp;LAYER=aLayer&amp;Format=image/png</href>
           </Icon>
           <overlayXY x="0" y="1" xunits="fraction" yunits="fraction"/>
           <screenXY x="0" y="1" xunits="fraction" yunits="fraction"/>
<rotationXY x="0.5" y="0.5" xunits="fraction" yunits="fraction"/>
           <size x="-1" y="-1" xunits="pixels" yunits="pixels"/>
       </ScreenOverlay>


If you embed these snippets in a kml file, you can see what happens.


Hans Castorp schreef:

Hi to all,

It's possible to visualize wms layers from mapserver using Google Earth?? I'm trying to do it but I'm always receiving an error saying that the wms server does not have layer that google earth could process. I think this could be something about my map file configuration. Is there any trick??

PD: I'm serving GeoTiff and shape layers.

Thanks in advance.

Hans Castorp


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.16.17/1176 - Release Date: 06/12/2007 23:15



--


        

Milo van der Linden
skype: milovanderlinden <skype:milovanderlinden?add>
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
http://www.3dsite.nl

                

De informatie in dit bericht reflecteert mijn persoonlijke mening en niet die van een bedrijf of instantie. Aan de informatie kunnen geen rechten worden ontleend. Indien dit bericht onderdeel is van een forum, mailing-list of community dan gelden automatisch de bij het betreffende medium behorende voorwaarden. The information in this message reflects my personal opinion and not that of a company or public body. All rights reserved.If this message is contained in a mailing-list or community, the rights on the medium are automatically adapted.

Reply via email to