capacitor-plugins icon indicating copy to clipboard operation
capacitor-plugins copied to clipboard

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

Open AE1NS opened this issue 2 years ago • 4 comments

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 https://github.com/ionic-team/capacitor-plugins/issues/1604

AE1NS avatar May 23 '23 07:05 AE1NS

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.

AE1NS avatar Aug 01 '23 05:08 AE1NS

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.

theproducer avatar Aug 01 '23 14:08 theproducer

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 avatar Aug 02 '23 13:08 AE1NS

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

AE1NS avatar Mar 03 '24 11:03 AE1NS

Moved https://github.com/ionic-team/capacitor-google-maps/pull/19

AE1NS avatar Jun 18 '24 08:06 AE1NS