ramazanalic / kml-samples

Automatically exported from code.google.com/p/kml-samples
0 stars 0 forks source link

Add Circle geometry to gx:kml extensions #389

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Which products are relevant to this feature request?

Google Earth/Google Maps

What should this feature enhancement do?

Adding a circle to the gx:KML extension schema would eliminate bloated KML 
associated with polygons using an arbitrary number of points (e.g. 32, 64, 
etc.) to represent a circle. This would also reduce duplication of having every 
content creator recreate the algorithm to generate a circle as n-points around 
a given center point.

  <element name="Circle" type="gx:CircleType"
    substitutionGroup="kml:AbstractGeometryGroup"/>
  <complexType name="CircleType" final="#all">
    <complexContent>
      <extension base="kml:AbstractGeometryType">
        <sequence>
          <element ref="kml:extrude" minOccurs="0"/>
          <element ref="kml:tessellate" minOccurs="0"/>
          <element ref="kml:altitudeModeGroup" minOccurs="0"/>
          <element ref="kml:coordinates" minOccurs="0"/>
          <element ref="gx:radius" minOccurs="0"/>
          <element ref="gx:CircleSimpleExtensionGroup" minOccurs="0"
            maxOccurs="unbounded"/>
          <element ref="gx:CircleObjectExtensionGroup" minOccurs="0"
            maxOccurs="unbounded"/>
        </sequence>
      </extension>
    </complexContent>
  </complexType>
  <element name="CircleSimpleExtensionGroup" abstract="true"
    type="anySimpleType"/>
  <element name="CircleObjectExtensionGroup" abstract="true"
    substitutionGroup="kml:AbstractObjectGroup"/>
  <element name="radius" type="double" default="0.0">
    <annotation>
        <documentation>The radius of the circle in meters from center</documentation>
    </annotation>
  </element>

Google Earth could provide an option to define the number of points in 
Tools/Options to generate to represent a circle so the content creator just 
needs to create a circle and the end-user defines the precision through the 
number of points to approximate a circle. Google Earth could further optimize 
the circle generation with anti-aliasing, etc. when the intention of the shape 
is known as a circle vs an arbitrary polygon.

The PolyStyle values would also apply to a circle geometry.

Related user requests:

* http://www.google.com/support/forum/p/earth/thread?tid=7e2c7013d787a39f&hl=en
* http://www.google.com/support/forum/p/earth/thread?tid=72b28bb48e84dd81&hl=en

Are there any currently known workarounds that produce the same, or
similar, result?

Without such an enhancement, users must create circle using polygons generating 
bloated KML with coordinates for each point.

Original issue reported on code.google.com by gjmath...@gmail.com on 19 May 2011 at 12:45

GoogleCodeExporter commented 8 years ago
Alternatively, the Polygon could be extended using existing 
PolygonObjectExtensionGroup to allow KML to be created that still supports 
older GE client versions as well as other Earth browsers that don't support the 
gx:Circle extension.

  <element name="Circle" type="gx:CircleType"
    substitutionGroup="kml:PolygonObjectExtensionGroup"/>
  <complexType name="CircleType">
    <annotation>
      <documentation>The polygon outerBoundaryIs element could still represent the polygon coordinates for backwards compatability to older clients, but advanced clients that support this circle extension would override polygon definition with the Circle elements below. The Location would be the coordinates of the center of the circle.
</documentation>
    </annotation>
    <complexContent>
      <extension base="kml:AbstractObjectType">
        <sequence>
          <element ref="kml:Location" minOccurs="0"/>
          <element ref="gx:radius" minOccurs="0"/>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <element name="radius" type="double" default="0.0">
    <annotation>
        <documentation>The radius of the circle in meters from center</documentation>
    </annotation>
  </element>

Using this approach using the PolyStyle for circles is intuitive.

Example:

<?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">
    <Placemark>
        <name>test circle</name>
        <Style>
            <LineStyle>
                <width>1.5</width>
            </LineStyle>
            <PolyStyle>
                <color>ffffffff</color>
                <fill>1</fill>
                <outline>1</outline>
            </PolyStyle>
        </Style>
            <Polygon>
                <tessellate>1</tessellate>
                <outerBoundaryIs>
                    <LinearRing>
                        <coordinates>-76.0031983,36.92143473064811 -76.00543766213661,36.922179454908445 -76.00636531066532,36.923977407782495 -76.00543776730223,36.92577540232853 -76.0031983,36.92652016826084 -76.00095883269778,36.92577540232853 -76.00003128933467,36.923977407782495 -76.00095893786337,36.922179454908445</coordinates>
                    </LinearRing>
                </outerBoundaryIs>
                <gx:Circle>
                    <Location>
                        <longitude>-76.003198</longitude>
                        <latitude>36.923977</latitude>
                    </Location>
                    <gx:radius>282.181317</gx:radius>
                </gx:Circle>
            </Polygon>
    </Placemark>
</kml>

Original comment by gjmath...@gmail.com on 20 May 2011 at 2:38