Benutzerdefinierte Markierungen für die Punkte, die von einem geoJson-Datei mit Google-Maps
Ich bin mit GeoJSON als Daten-Quelle für Google Maps. Ich bin mit v3 API zum erstellen einer Daten-layer wie folgt:
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
<script>
var map;
function initialize() {
//Initialise the map
var myLatLng = new google.maps.LatLng(53.231472,-0.539783);
map = new google.maps.Map(document.getElementById('map-canvas'), {
zoom: 17,
center: myLatLng,
scrollwheel: false,
panControl: false,
zoomControl: false,
scaleControl: true,
disableDefaultUI: true
});
//Initialise base folder for icons
var iconBase = '/static/images/icons/';
//Load the JSON to show places
map.data.loadGeoJson('/api/geo');
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<div id="map-canvas"></div>
Die Quelle meiner GeoJSON-Daten wie folgt:
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"icon": "/static/images/icons/map-marker-do.png",
"coordinates": [
-0.53743,
53.23437
]
},
"properties": {
"name": "Cathedral",
"description": "One of Europe’s finest Gothic buildings, once the tallest building in the world that dominates Lincoln's skyline.",
"icon": "/static/images/icons/map-marker-do.png"
}
}
]
}
Was ich versuche zu machen, ist das marker-Symbol auf der Karte kommen aus der "Symbol" - Eigenschaft in der JSON, aber kann nicht herausfinden, wie man die Daten zu ändern, die Standard-marker. Kann mir jemand einen Rat? Danke.
InformationsquelleAutor der Frage doubleplusgood | 2014-06-26
Du musst angemeldet sein, um einen Kommentar abzugeben.
Verwenden Sie ein styling-Funktion(styling-Funktionen aktivieren Sie Formatvorlagen anwenden, basierend auf einem bestimmten Merkmal)
InformationsquelleAutor der Antwort Dr.Molle