2

I'd like to display spatial data in Google Earth and I think the best way to do it is with polygons. I'd like both the height of a polygon as well as its color to both represent the data. The height is no problem, but I can't figure out how to force the polygon to have a constant color and/or shading. If I set a polygon's color to blue (FFFF0000), it appears light blue when viewed from one direction, but dark blue from another. For example, in the code below I have two polygons at 90 degrees to each other. Both of them should be the same color. However, when viewed in Google Earth, they clearly have a different color (or perhaps just different shading because they are at a different angle with respect to the viewer). Presumably this is by design, but I'd like to make polygons that have a constant color (or shading), irrespective of viewing angle. Does anybody know if this can be done?

Thanks

<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2">
<Document>
  <name>kml toolbox tests</name>
  <Folder>
     <name>kml.poly3</name>
     <id>kml.poly3</id>
     <Placemark id="kml_poly3tpfc275749_9c60_474d_b419_d29a903da8be">
        <name>30</name>
        <visibility>1</visibility>
        <description/>
        <Style>
           <LineStyle>
              <color>FFFFFFFF</color>
              <width>5</width>
           </LineStyle>
           <PolyStyle>
              <color>FFFF0000</color>
           </PolyStyle>
        </Style>
        <Polygon id="Polygon_kml_poly3tpfc275749_9c60_474d_b419_d29a903da8be">
           <extrude>0</extrude>
           <tesselate>1</tesselate>
           <altitudeMode>relativeToGround</altitudeMode>
           <outerBoundaryIs>
              <LinearRing id="LinearRing_kml_poly3tpfc275749_9c60_474d_b419_d29a903da8be">
                 <coordinates>-111.98,40.6,0 
-111.97,40.6,0 
-111.97,40.6,1500 
-111.99,40.6,1500 
-111.99,40.6,0 </coordinates>
              </LinearRing>
           </outerBoundaryIs>
        </Polygon>
     </Placemark>
     <Placemark id="kml_poly3tpb12d0de1_b554_45ed_b9fd_63d120582f23">
        <name>31</name>
        <visibility>1</visibility>
        <description/>
        <Style>
           <LineStyle>
              <color>FFFFFFFF</color>
              <width>5</width>
           </LineStyle>
           <PolyStyle>
              <color>FFFF0000</color>
           </PolyStyle>
        </Style>
        <Polygon id="Polygon_kml_poly3tpb12d0de1_b554_45ed_b9fd_63d120582f23">
           <extrude>0</extrude>
           <tesselate>1</tesselate>
           <altitudeMode>relativeToGround</altitudeMode>
           <outerBoundaryIs>
              <LinearRing id="LinearRing_kml_poly3tpb12d0de1_b554_45ed_b9fd_63d120582f23">
                 <coordinates>-111.97,40.6,0 
-111.97,40.62,0 
-111.97,40.62,2000 
-111.97,40.6,2000 
-111.97,40.6,0 </coordinates>
              </LinearRing>
           </outerBoundaryIs>
        </Polygon>
     </Placemark>
<Camera id="ID">
  <TimePrimitive>...</TimePrimitive>
  <gx:ViewerOptions>
    <option> name="camera" type="boolean"></option>
  </gx:ViewerOptions>
  <longitude>-111.94</longitude>            <!-- kml:angle180 -->
  <latitude>40.53</latitude>              <!-- kml:angle90 -->
  <altitude>7500</altitude>              <!-- double -->
  <heading>340</heading>                <!-- kml:angle360 -->
  <tilt>60</tilt>                      <!-- kml:anglepos180 -->
  <roll>0</roll>                      <!-- kml:angle180 -->
  <altitudeMode>absolute</altitudeMode>
</Camera>
</Folder>
</Document>
</kml>
Logan
  • 21
  • 1
  • 3

2 Answers2

0

The KML standard as well as Google Earth doesn't allow you to specify advanced rendering options such shading options. The current Google Earth KML extensions do not allow this to be changed and setting slightly transparent color also has no effect.

If the viewing angle and the face of polygon are perpendicular to each other then the color is at maximum but as you the angle tilts and angle approaches 0 degrees then the color blackens. At less than 5-10 degrees the color is nearly completely black.

Only get uniform coloring if polygons are on the ground and view is looking straight down. That allows you to create heat map visualizations.

To request a new feature you can try the following steps:

  1. Click "Send Feedback" under the Help menu and fill out a detailed response to Google.
  2. Start a discussion of the feature in the Google Earth forum.
  3. Submit feature request via https://code.google.com/p/earth-issues/issues/list
Community
  • 1
  • 1
CodeMonkey
  • 22,825
  • 4
  • 35
  • 75
  • Hmm, this doesn't seem like it should be that hard to do, and I doubt that I'm the only one who would like to do something like this. Do you know if it would be possible to request this feature? Where would one do it? – Logan Feb 11 '14 at 00:18
  • To request a new feature see updated answer with 3 options to try. – CodeMonkey Feb 11 '14 at 14:27
0

This polygon shading issue is much worse on more recent versions of Google Earth. In recent versions a comment was added saying that now only one side of polygons is rendered so my next step will be to place polygons back to back with opposite point order rotation. This way, all polygons viewed from the sun angle direction can appear constantly shaded at least.