android-maps-utils icon indicating copy to clipboard operation
android-maps-utils copied to clipboard

GeoJSON doesn't load as expected (in BETA version)

Open programmeraditya opened this issue 5 years ago • 5 comments

I have a GeoJSON file with a point and a hole. The point is basically the whole map and a specific area is the whole.

GeoJSON file: https://pastebin.com/raw/krmeEeV0

The issue is that I get this type of rendering: Screenshot_20210103-180459__01

It used to work fine on the stable Maps SDK. However with the BETA version of Maps SDK and Utils, it's loading like this.

programmeraditya avatar Jan 03 '21 12:01 programmeraditya

@programmeraditya I'm not sure the GeoJSON file that you linked to is valid. Here's what http://geojson.io/ renders:

image

...and https://geojsonlint.com/ says:

image

Could you double-check the GeoJSON to make sure it's valid?

Some of the polygon drawing gets unpredictable on the Maps SDK if the GeoJSON file isn't valid.

barbeau avatar Jan 04 '21 19:01 barbeau

Thank you for linking to geojsonlint.com. This gives me a clearer idea that the GeoJSON's first set of coordinates didn't follow the right-hand rule. I have converted the first set to follow the right-hand rule.

For anyone else looking to fix the right-hand rule, they can easily convert the GeoJSON using this online page: https://mapster.me/right-hand-rule-geojson-fixer/

programmeraditya avatar Jan 04 '21 19:01 programmeraditya

@barbeau I may have responded too quickly. It looks like there is indeed something wrong in the Beta version of Maps SDK.

Corrected GeoJSON file: https://pastebin.com/raw/99hjSMGc

Even after correcting the file, the SDK loaded it incorrectly. This file works perfectly on both https://geojson.io and https://geojsonlint.com. Also I'm pretty sure the previous version of the file worked well with the stable Maps SDK.

Screenshot_20210105-010353

You can see in the above screenshot that the hole was created but it was also colored.

programmeraditya avatar Jan 04 '21 19:01 programmeraditya

@programmeraditya Thanks for the fixed GeoJSON! If you're still seeing issues the problem is likely with the Maps SDK v3 beta and not this android-maps-utils library.

If you could confirm that this works as intended when using implementation 'com.google.maps.android:android-maps-utils:2.2.0' instead of implementation 'com.google.maps.android:android-maps-utils-v3:2.2.0', please open an issue on the Maps SDK v3 beta at https://issuetracker.google.com/issues/new?component=541018&template=1201436.

barbeau avatar Jan 04 '21 21:01 barbeau

@programmeraditya I tested the GeoJSON at https://pastebin.com/raw/99hjSMGc with both the v2 and v3 beta libraries using the gms and v3 product flavors respectively that I created in PR https://github.com/googlemaps/android-maps-utils/pull/811. I loaded the GeoJSON up in the GeoJsonDemoActivity of the demo app (by just dumping the GeoJSON into the earthquakes_with_usa.json file) and this is what I see on a Samsung Galaxy S8+ w/ Android 9:

image

So they both look the same to me. Is it possible that something else is going on that's impacting what you're seeing in your screenshots?

barbeau avatar Jan 06 '21 22:01 barbeau

Closing since the v3 beta has been deprecated.

wangela avatar Sep 14 '22 08:09 wangela