ol3 load geojson from external file
HTML
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.5.0/ol.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.5.0/ol.css">
ol3 load geojson from external file
<div class="row-fluid">
<div class="span12">
<div id="map" class="map">
<div id="popup"></div>
</div>
</div>
</div>
CSS
#map {
position: relative;
}
#popup {
padding-bottom: 15px;
}
JavaScript
let geojson = {
'type': 'FeatureCollection',
'crs': {
'type': 'name',
'properties': {
'name': 'EPSG:3857'
}
},
'features': [{"type":"Feature","properties":{"color":"black","description":"חניה","icon":"marker"},"_id":"5c2b0e8f8e2b5722243fb140","geometry":{"type":"Point","coordinates":[35.16091838479042,31.216496947996564,521.1282348632812]}},{"type":"Feature","properties":{"color":"black","description":"מנחת ערד הישן","icon":"marker"},"_id":"5c2b0e8f8e2b5722243fb13f","geometry":{"type":"Point","coordinates":[35.190603733062744,31.229977034773515,591.0806884765625]}},{"type":"Feature","properties":{"color":"blue","description":"","icon":"water"},"_id":"5c2b0e8f8e2b5722243fb13e","geometry":{"type":"Point","coordinates":[35.16724169254303,31.197511010794802,434.6034240722656]}},{"type":"Feature","properties":{"color":"black","description":"חורבת עוזה","icon":"marker"},"_id":"5c2b0e8f8e2b5722243fb13d","geometry":{"type":"Point","coordinates":[35.16551434993744,31.208589662744405,538.22119140625]}},{"type":"Feature","properties":{"color":"black","description":"בורות עוזה","icon":"water"},"_id":"5c2b0e8f8e2b5722243fb13c","geometry":{"type":"Point","coordinates":[35.16523540019989,31.205221926524025,462.361328125]}},{"type":"Feature","properties":{"color":"black","description":"פיצול השביל הכחול...