Skip to content

Instantly share code, notes, and snippets.

@teomanofficial
Created November 24, 2023 21:29
Show Gist options
  • Save teomanofficial/4dd63dfae01a6d6a8ad044f3b03880bf to your computer and use it in GitHub Desktop.
Save teomanofficial/4dd63dfae01a6d6a8ad044f3b03880bf to your computer and use it in GitHub Desktop.
OpenLayers Nasıl Kullanılır ?
fetch('/data.json')
.then(res => res.json())
.then(geojson => {
const reader = new GeoJSON({ featureProjection: 'EPSG:3857' });
const features = reader.readFeatures(geojson);
const vectorSource = new VectorSource({ features });
map.addLayer(new VectorLayer({ source: vectorSource }))
})
.catch((e) => {
alert('hata Oluştu!');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment