Created
November 24, 2023 22:11
-
-
Save teomanofficial/7435cfcbf9c428b9a2c589937c0c4d19 to your computer and use it in GitHub Desktop.
OpenLayers Nasıl Kullanılır ?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetch('/data.kml') | |
.then(res => res.text()) | |
.then(geojson => { | |
const reader = new KML({ showPointNames: false }); | |
const features = reader.readFeatures(geojson, { featureProjection: 'EPSG:3857' }); | |
const vectorSource = new VectorSource({ features }); | |
map.addLayer(new VectorLayer({ source: vectorSource as any })) | |
}) | |
.catch(() => { | |
alert('hata Oluştu!'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment