Google maps does not render KML polygons with inner boundaries correctly (one or more polygons never get rendered) #1132
Labels
needs more info
This issue needs more information from the customer to proceed.
priority: p4
An issue that should be addressed eventually.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Background
While creating bathymetric maps as KML I like to make the map earier to read by adding different colored polygons to each 1m level. If using completely filled polygons, the KML is rendered differently each time I do a addLayerToMap (leading me to believe Google Maps have no way to control the order the polygons are added like Google Earth has).
Problem
To solve this I altered the KML to also include inner boundaries to "cut out" the inner and eliminate the need for the rendering of the polygons to come in a particular order. Using Google Earth I can verify that the filled polygons never overlap. Google Earth also renders this KML perfectly. But Google Maps can no longer render them all. No clear pattern. On one water every other, on another water perhaps one or two of them are missing.
Expected behavior
Using Google Earth: Sample water with all colored polygons selected. Each meter level rendered:
Also using Google Earth, I deselected the all levels but 2-3 meters to illustrate that its inner is "cut out". All other polygons but the deepest one have their inner "cut out":
I have built my KMLs in two ways: The "hard way" by writing strings with tabs and tags "manually" and by using Python and "simpleKml". I first thought the problem (see below) was caused by simpleKml adding multiple (when applicable, often needed for a water) "LinerarRing" within a single "innerBoundaryIs". So I dropped simpleKml and coded manually to get multiple "innerBoundaryIs" with a single "LinearRing" inside each. But for Google Maps that did not matter, behaviour is identical.
Sample from the KML-file for the illustrated 2 meter polygon (coordinates are abbreviated - this polygon has one outer boundary (always) and 1+ inner boundaries, this one has 3):
<Placemark> <name>2</name> <styleUrl>#2</styleUrl> <Polygon> <tessellate>true</tessellate> <altitudeMode>clampToGround</altitudeMode> <outerBoundaryIs> <LinearRing> <coordinates>10.592408209489095,59.64232214633835,0 ... 10.592408209489095,59.64232214633835,0</coordinates> </LinearRing> </outerBoundaryIs> <innerBoundaryIs> <LinearRing> <coordinates>10.592191189077477,59.642402279689236,0 ... 10.592191189077477,59.642402279689236,0</coordinates> </LinearRing> </innerBoundaryIs> <innerBoundaryIs> <LinearRing> <coordinates>10.590486028700466,59.643027621876,0 ... 10.590486028700466,59.643027621876,0</coordinates> </LinearRing> </innerBoundaryIs> <innerBoundaryIs> <LinearRing> <coordinates>10.589741958717772,59.64305730583021,0 ... 10.589741958717772,59.64305730583021,0</coordinates> </LinearRing> </innerBoundaryIs> </Polygon> </Placemark>
The KML code is not easy to read in the code editor, here's a picture to easier see the typical structure:
Observed behavior
As stated and visualized above, while Google Earth renders each polygon and also the entire "depth map" perfectly, Google Maps using Android does not. For this particular depth map only one colored polygon is missing. On another water depth map every second is invisible. Here's a screen shot:
Environment details
Multiple devices used, all experience the same behaviour. My development device is a Samsung Galaxy Tab S6 lite (SM-P610), running Android 12 and One UI 4.1.1.
Environment for the app is:
Steps to reproduce
The behaviour in Google Maps is fairly consistent, at least it never displays all polygons properly. But the amount of polygons gone missing is not consistent.
Using a second water map, first in Google Earth:
Then using Google Maps:
I have also attached the KML for this latter sample (file type altered to "txt", change back to "kml" to use):
sample.txt
The text was updated successfully, but these errors were encountered: