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

feat(google-maps): Implemented map feature functions (i.e. GeoJSON support) #1605

Closed
wants to merge 1 commit into from

Conversation

AE1NS
Copy link
Contributor

@AE1NS AE1NS commented May 23, 2023

This PR adds support (first implementation scoped to geoJson) for map features.

Examples

addFeatures(type: FeatureType, data: any, idPropertyName: string, styles: FeatureStyles): string[]

await map.addFeatures(
    FeatureType.GeoJSON,
    {
        type: 'Feature',
        geometry: GeoJSONData,
        properties: {
            id: 'my-identifier',
        },
    },
    'id',
    {
        ['my-identifier']: {
            strokeColor: '#123456',
            strokeOpacity: 0.8,
            strokeWeight: 1,
            fillColor: '#654321',
            fillOpacity: 0.1,
            geodesic: true,
        }
    }
)

getFeatureBounds(featureId: string)

map.getFeatureBounds('my-identifier')

removeFeature(featureId: string)

map.removeFeature('my-identifier')

Closes #1604

Copy link
Contributor

@theproducer theproducer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a page in the test app for testing out GeoJSON support, and grabbed a sample object from Google Map's documentation site. It works on web, but doesnt work on iOS or Android (on Android it hard crashes). From looking at it briefly it looks like its due a missing idPropertyName within the features.

If that's actually the issue I would rework it so that supplying a id property isn't needed, or, have it throw an appropriate error.

@AE1NS
Copy link
Contributor Author

AE1NS commented Aug 1, 2023

I see. Seems that I only took the case with an id into account, because I only use it with styles :) You are absolutely correct, this should be an optional parameter.

Did you mean that you are going to rework it, or advised me to do so? I would be glad about support.

@theproducer
Copy link
Contributor

Sorry, I meant for you to make the changes. If you can't, no big deal, we'll slot some time for us to work on it.

@AE1NS
Copy link
Contributor Author

AE1NS commented Aug 2, 2023

I just pushed some more changes to make the idPropertyName and styles parameter optional. Looks good for me in Android. In iOS I just made the code adjustments but I am not able to test it right now. Would be great if you could have another look.

@AE1NS
Copy link
Contributor Author

AE1NS commented Mar 3, 2024

Well, I think with the commit in August I broke it completely. Should be fixed now.

@AE1NS
Copy link
Contributor Author

AE1NS commented Jun 18, 2024

@AE1NS AE1NS closed this Jun 18, 2024
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

Successfully merging this pull request may close these issues.

[@capacitor/google-maps] Data layer support
3 participants