Select to view content in your preferred language

KmlLayer does not display images

4516
13
Jump to solution
01-21-2012 11:28 PM
NataliaEvsyuchenya
Emerging Contributor
Hello!

I am try to add KmlLayer to the Map. I place kmz file at the  C:\inetpub\wwwroot\KML_TEST_FILES\. If unzip the my kmz file you can see:


[INDENT]<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<GroundOverlay>
<name>????????? ??? ????????</name>
<Icon>
  <href>files/4_9.jpg</href>
  <viewBoundScale>0.75</viewBoundScale>
</Icon>
<LatLonBox>
  <north>52.95165833333334</north>
  <south>52.70903611111112</south>
  <east>27.76611666666667</east>
  <west>27.37067500000001</west>
</LatLonBox>
</GroundOverlay>
</kml>
[/INDENT]


I add the following code to my page:

              [INDENT]  public MainPage()
  {
   InitializeComponent();
                        Map.Layers.Add(new KmlLayer()
                                                       {
                                                              Url = new Uri("http://localhost/KML_TEST_FILES/radar.kmz"),
                                                              ID = "Kml layer"
                                                        });
  }
[/INDENT]


There is no errors but image is not shown on the map. What's the problem?
0 Kudos
1 Solution

Accepted Solutions
DominiqueBroux
Esri Frequent Contributor
I could display image when I set for Basic Layer Url = "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" instead of "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer". But why KmlLayer depends on Basic Layer?

That rings a bell.
The extent of the images is set with the geographical coordinates found in the KML file but this extent is not the right one when your map is using projected coordinates.

In fact, KML Groundoverlays don't support autoprojection to non geographic coordinates. It's identified as a possible future enhancement but not planned at this time.

It's probably possible to project the extent by yourself (not tested and probably not that easy though):
- go through the KML layer hierachy to find all ElementLayers
- for each ElementLayer, loop on the elements
- for each element, project the extent from Geographical coordinates to Mercator

Sorry I should have thought about that sooner.

View solution in original post

0 Kudos
13 Replies
JenniferNery
Esri Regular Contributor
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Which ArcGIS SL version are you using?

Only the 2.3 version takes care of GroundOverlays.

Also does the file 'files/4_9.jpg' exist in the kmz file (after unzipping as you did)?
0 Kudos
NataliaEvsyuchenya
Emerging Contributor
Which ArcGIS SL version are you using?

Only the 2.3 version takes care of GroundOverlays.

Also does the file 'files/4_9.jpg' exist in the kmz file (after unzipping as you did)?


I have the 2.3 version installed. And file "files/4_9.jpg" exists.
0 Kudos
NataliaEvsyuchenya
Emerging Contributor
Have you looked at this blog post: http://blogs.esri.com/Dev/blogs/silverlightwpf/archive/2009/08/24/Troubleshooting-blank-layers.aspx?


I run the Fiddler2, but there is no errors. You can see screenshot [ATTACH=CONFIG]11365[/ATTACH]. And also layer appears in the Map legend.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Could you share the KMZ file so I can test with it?

Thanks
0 Kudos
NataliaEvsyuchenya
Emerging Contributor
Could you share the KMZ file so I can test with it?

Thanks


http://ge.tt/8Igs2hC?c
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Thanks for the link.

From my tests, it's working.  You can test it here with the KML Viewer using the version 2.3 of the API.
0 Kudos
NataliaEvsyuchenya
Emerging Contributor
Thanks for the link.

From my tests, it's working.  You can test it here with the KML Viewer using the version 2.3 of the API.


Could you show your code, please. Maybe the problem that I use localhost? Do you have any ideas?
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Could you show your code, please.


The code is published here .

Maybe the problem that I use localhost?


Localhost should not be the problem. Nevertheless feel free to test your program with this public Url : http://broux.dominique.free.fr/Silverlight/test/radar.kmz

Do you have any ideas?


No idea. Just double check that you are using the 2.3 final (version 2.3.0.746)
0 Kudos