Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google maps does not render KML polygons with inner boundaries correctly (one or more polygons never get rendered) #1132

Closed
OlavAa opened this issue Dec 23, 2022 · 3 comments
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.

Comments

@OlavAa
Copy link

OlavAa commented Dec 23, 2022

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:
image

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":
image

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:
image

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:
image

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:

  • com.google.android.gms:play-services-maps:18.0.2
  • com.google.maps.android:android-maps-utils:2.4.0

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:
image

Then using Google Maps:
image

I have also attached the KML for this latter sample (file type altered to "txt", change back to "kml" to use):
sample.txt

@OlavAa OlavAa added triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Dec 23, 2022
@wangela
Copy link
Member

wangela commented Dec 23, 2022

@OlavAa Thank you for opening this issue. 🙏
Please check out these other resources that might help you get to a resolution in the meantime:

This is an automated message, feel free to ignore.

@OlavAa
Copy link
Author

OlavAa commented Dec 25, 2022

After playing around with a sample "depth map" I see the root cause may be some polygons within the KML. The fact that Google Earth is able to correctly render the polygons may also be a result of GE filtering away bad information somehow. Will have to look more closely an how I build my polygons outer and in particular inner boundaries.

@wangela wangela added priority: p4 An issue that should be addressed eventually. needs more info This issue needs more information from the customer to proceed. and removed triage me I really want to be triaged. labels Aug 10, 2023
@wangela
Copy link
Member

wangela commented Aug 10, 2023

@OlavAa Do you still think this is a bug or was the problem all with the input polygons? Feel free to re-open if you've found that it's a bug after fixing the polygons.

@wangela wangela closed this as completed Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

3 participants