ionic-team / capacitor-google-maps

12 stars 16 forks source link

feat: Implemented map feature functions (i.e. GeoJSON support) #19

Open AE1NS opened 2 months ago

AE1NS commented 2 months ago

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-google-maps/issues/20