Reputation: 4739
How to generate a KML layer for polygon of coordinates so that the outside of the polygon should be disabled such that that area cannot be clicked or drawing manager disabled etc.
[33.832681,-84.504041], [33.889129,-84.361905],[33.756788,-84.285001],[ 33.642536,-84.427823],[ 33.744798,-84.556226],[ 33.832681,-84.504041]
Upvotes: 0
Views: 972
Reputation: 1385
Below is a basic KML Polygon for the coordinates you provided. I assumed that they represented [latitude,longitude] (in the Atlanta area), and not [longitude,latitude] (in Antarctica). Note that in the KML file, the coordinate sets are written as longitude,latitude,altitude which is the reverse of what many people expect. To preview it, you can either save it as a KML file and open it with Google Earth, or just copy the xml code below and paste it into Google Earth.
<?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">
<Placemark>
<name>Polygon Demo</name>
<Style>
<LineStyle>
<color>ff0000ff</color>
<width>3</width>
</LineStyle>
<PolyStyle>
<color>880000ff</color>
<fill>1</fill>
<outline>1</outline>
</PolyStyle>
</Style>
<Polygon>
<tessellate>1</tessellate>
<outerBoundaryIs>
<LinearRing>
<coordinates>
-84.504041,33.832681,0 -84.361905,33.889129,0 -84.285001,33.756788,0 -84.427823,33.642536,0 -84.556226,33.744798,0 -84.504041,33.832681,0
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
</kml>
The color for a polygon's fill is specified in the KML's "PolyStyle" section, and the color for its outline is specified in "LineStyle". Note that KML colors are defined as "aabbggrr". There are also options in "PolyStyle" for specifying whether or not (1 or 0) to draw the polygon outline and fill:
In order to keep the polygon from being clickable, make sure that it has neither a description (empty or no tag), and that any styles which are applied do not have a "BalloonStyle". If you're using it in the Google Maps API, you can set the option "suppressInfoWindows: true".
Upvotes: 1