Google Maps JS kombiniert Grenzen und KreiseJavaScript

Javascript-Forum
Anonymous
 Google Maps JS kombiniert Grenzen und Kreise

Post by Anonymous »

Ich versuche, zwei Google Map JS API-Beispiele zu kombinieren:
https://developers.google.com/maps/docu ... cle-simple
https://developers.google.com/maps/docu ... ies-simple
Ich möchte eine Karte mit Grenzen erstellen und ihr außerdem eine Kreismarkierung hinzufügen. Der Grenzbereich wird hinzugefügt, aber nicht der Kreis.
HTML:

Code: Select all



JS:

Code: Select all

let featureLayer;
async function initMap() {
(await google.maps.importLibrary('maps'));
const mapElement = document.querySelector('gmp-map');
const innerMap = mapElement.innerMap;

const cityCircle = new google.maps.Circle({
strokeColor: "#FF0000",
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: "#FF0000",
fillOpacity: 0.35,
mapElement,
center:  { lat: 20.773, lng: -156.01 },
radius: 350000,
});

featureLayer = innerMap.getFeatureLayer(google.maps.FeatureType.LOCALITY);

const featureStyleOptions = {
strokeColor: '#810FCB',
strokeOpacity: 1.0,
strokeWeight: 3.0,
fillColor: '#810FCB',
fillOpacity: 0.5,
};

featureLayer.style = (options) => {
if (options.feature.placeId == 'ChIJ0zQtYiWsVHkRk8lRoB1RNPo') {
return featureStyleOptions;
}
};

}
initMap();

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post