0

I'm trying to write KML that displays a polygon with the north point at the north pole, the south point at the south pole, and the east and west points on the equator with 15° longitude separation. I need the left & right (west & east) borders of this shape to accurately reflect a straight line from pole to pole, through the specified point on the equator.

I can easily create stand-alone line elements that accurately render the borders of what I am trying to accomplish (Both 3 points, including both poles and points on the equator separated by 15°.)

The lines are perfect, but I need the whole polygon, not a pair of lines. In Google Earth, the polygon renders properly only at the equator and both poles. Between those points it is inexplicably narrowed.

Adding additional points along the correct path can mitigate but not completely correct the problem.

Here is an image that describes the problem better than 1000 words: https://drive.google.com/file/d/1WZgLztWAqHikXzb3jw2mpfBGCXAHQVFx/view?usp=sharing

The code is here:

    <?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">
<Document>
    <name>Pole to Pole - Polygon v Path.kml</name>
    <Style id="failed">
        <LineStyle>
            <color>ff0000ff</color>
            <width>3</width>
        </LineStyle>
    </Style>
    <StyleMap id="failed0">
        <Pair>
            <key>normal</key>
            <styleUrl>#failed4</styleUrl>
        </Pair>
        <Pair>
            <key>highlight</key>
            <styleUrl>#failed</styleUrl>
        </Pair>
    </StyleMap>
    <Style id="failed1">
        <LineStyle>
            <color>ff00aaff</color>
            <width>3</width>
        </LineStyle>
    </Style>
    <Style id="failed2">
        <LineStyle>
            <color>ff00aaff</color>
            <width>3</width>
        </LineStyle>
    </Style>
    <StyleMap id="failed3">
        <Pair>
            <key>normal</key>
            <styleUrl>#failed2</styleUrl>
        </Pair>
        <Pair>
            <key>highlight</key>
            <styleUrl>#failed1</styleUrl>
        </Pair>
    </StyleMap>
    <Style id="failed4">
        <LineStyle>
            <color>ff0000ff</color>
            <width>3</width>
        </LineStyle>
    </Style>
    <Folder>
        <name>Pole to Pole - Polygon v Path</name>
        <open>1</open>
        <Document>
            <name>Polygon 4 points +1 (point 5 = point 1)</name>
            <StyleMap id="m_ylw-pushpin">
                <Pair>
                    <key>normal</key>
                    <styleUrl>#s_ylw-pushpin</styleUrl>
                </Pair>
                <Pair>
                    <key>highlight</key>
                    <styleUrl>#s_ylw-pushpin_hl</styleUrl>
                </Pair>
            </StyleMap>
            <Style id="s_ylw-pushpin">
                <IconStyle>
                    <scale>1.1</scale>
                    <Icon>
                        <href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
                    </Icon>
                    <hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
                </IconStyle>
                <LineStyle>
                </LineStyle>
                <PolyStyle>
                    <color>8200ff00</color>
                </PolyStyle>
            </Style>
            <Style id="s_ylw-pushpin_hl">
                <IconStyle>
                    <scale>1.3</scale>
                    <Icon>
                        <href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
                    </Icon>
                    <hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
                </IconStyle>
                <LineStyle>
                </LineStyle>
                <PolyStyle>
                    <color>8200ff00</color>
                </PolyStyle>
            </Style>
            <Placemark>
                <name>slice</name>
                <styleUrl>#m_ylw-pushpin</styleUrl>
                <Polygon>
                    <tessellate>1</tessellate>
                    <outerBoundaryIs>
                        <LinearRing>
                            <coordinates>
                                0,90,0 -7.5,0,0 0,-90,0 7.5,0,0 0,90,0 
                            </coordinates>
                        </LinearRing>
                    </outerBoundaryIs>
                </Polygon>
            </Placemark>
        </Document>
        <Placemark>
            <name>Path 1</name>
            <styleUrl>#failed0</styleUrl>
            <LineString>
                <tessellate>1</tessellate>
                <coordinates>
                    0,90,0 7.5,0,0 0,-90,0 
                </coordinates>
            </LineString>
        </Placemark>
        <Placemark>
            <name>Path 2</name>
            <styleUrl>#failed3</styleUrl>
            <LineString>
                <tessellate>1</tessellate>
                <coordinates>
                    0,90,0 -7.5,0,0 0,-90,0 
                </coordinates>
            </LineString>
        </Placemark>
    </Folder>
</Document>
</kml>

1 Answer 1

1

You've got a projection problem - you've given two points on a line and the system is drawing that as a straight line in whatever the current projection is whereas you want a visualization of the great circle/arc.

You've answered your own question when you pointed out you can reduce the "error" by adding points. That's what you'll have to do. It's called "densifying" the line.

2
  • I could easily add enough extra points to make it display ok. But my requirement is that there be no niether overlap of nor gaps between the polygons. That would apparently require an infinite number of points - an obvious impossibility. Because I need to be certain there is neither gap nor overlay between two adjacent polygon "slices". So it appears I cannot do this with google earth and kml. Feb 4 at 23:02
  • I don't understand why you think that polygons using lines with added points will have gaps or overlaps. You are drawing slices 15° wide. Let L0 be the pole-to-pole approximation along the 0 meridian, L15 be likewise for the 15° meridian, L30 for the 30°. Polygon one is the two arcs L0, L1, polygon two is L1, L2. They will exactly match on the boudary.
    – Llaves
    Feb 5 at 2:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.