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

KmlDocument ParseGeojson Not Working With Multipolygon #357

Closed
khnoize opened this issue Jan 11, 2019 · 4 comments
Closed

KmlDocument ParseGeojson Not Working With Multipolygon #357

khnoize opened this issue Jan 11, 2019 · 4 comments

Comments

@khnoize
Copy link

khnoize commented Jan 11, 2019

Hello.

I've tried to use KmlDocument to parse geojson this way (from a link in medium):

                KmlDocument kmlDocument = new KmlDocument();
                kmlDocument.parseGeoJSON(stringGeoJson);

                Drawable defaultMarker = getResources().getDrawable(R.drawable.marker_default);

                Bitmap defaultBitmap = ((BitmapDrawable) defaultMarker).getBitmap();

                Style defaultStyle = new Style(defaultBitmap,
                        Color.argb(0, 0,0,0),
                        5f,
                        Color.argb(75, 255,0,0));

                FolderOverlay geoJsonOverlay =
                        (FolderOverlay) kmlDocument.mKmlRoot.buildOverlay(
                                mv, defaultStyle, null, kmlDocument);

                mv.getOverlays().add(geoJsonOverlay);
                mv.invalidate();

And it works wonderfully. However, when I was trying to parse a geojson url with type "multipolygon" instead of "polygon", it won't work. No errors or anything, it's just won't show the polygon.

Is there anything I can do to make it work? Thank you.

@MKergall
Copy link
Owner

MultiPolygon is not supported currently.
Refer to https://github.com/MKergall/osmbonuspack/wiki/GeoJSON for supported GeoJSON types.

Franckly, with GeometryCollection type available, I don't understand why GeoJSON spec added all those "multi" types, that's a pain to handle.
But we can implement it (as done for MultiPoint), if needed.

@khnoize
Copy link
Author

khnoize commented Jan 14, 2019

Oh, okay. Would be great for multi polygon users if later versions can handle that.

@MKergall
Copy link
Owner

Not tested yet. Give this commit a try.

@MKergall
Copy link
Owner

included in v6.6.0, now published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants