Commit 2c448ef9 authored by Manggar Mahardhika's avatar Manggar Mahardhika

+ search koordinat

parent 0fe38c34
......@@ -164,6 +164,7 @@
<li><input type="hidden" value="bangunan" /><a href="#"><i class="icon-home4 text-muted text-size-base" style="color: #5A9AFB;"></i> Bangunan</a></li>
<li><input type="hidden" value="jalan" /><a href="#"><i class="icon-git-branch text-muted text-size-base" style="color: #5A9AFB;"></i> Jalan</a></li>
<li><input type="hidden" value="point" /><a href="#"><i class="icon-location4 text-muted text-size-base" style="color: #5A9AFB;"></i> Point</a></li>
<li><input type="hidden" value="koordinat" /><a href="#"><i class="icon-location4 text-muted text-size-base" style="color: #5A9AFB;"></i> Koordinat</a></li>
<li><input type="hidden" value="reset" /><a href="#"><i class="icon-reset text-muted text-size-base" style="color: #5A9AFB;"></i> Reset</a></li>
</ul>
</div>
......@@ -449,12 +450,19 @@
dar = tes
if (dar == ' Point') {
$("#pilihcari").html('<i class="icon-location4 text-muted text-size-base" style="color: #5A9AFB;"></i>')
$("#input_search").attr('placeholder', 'Search...')
} else if (dar == ' Bangunan') {
$("#pilihcari").html('<i class="icon-home4 text-muted text-size-base" style="color: #5A9AFB;"></i>')
$("#input_search").attr('placeholder', 'Search...')
} else if (dar == ' Jalan') {
$("#pilihcari").html('<i class="icon-git-branch text-muted text-size-base" style="color: #5A9AFB;"></i>')
$("#input_search").attr('placeholder', 'Search...')
} else if (dar == ' Koordinat'){
$("#pilihcari").html('<i class="icon-location4 text-muted text-size-base" style="color: #5A9AFB;"></i>')
$("#input_search").attr('placeholder', '-4.04663, 103.915915')
} else if (dar == ' Reset') {
$("#pilihcari").html('')
$("#input_search").attr('placeholder', 'Search...')
}
});
......@@ -533,7 +541,7 @@
var geocodeService = L.esri.Geocoding.geocodeService();
var geocoderNominatim = new L.Control.Geocoder.Nominatim();
var dapoin = [data[0][0]['geometry']['coordinates'][1], data[0][0]['geometry']['coordinates'][0]]
//console.log(data[0])
console.log(dapoin)
// map.setView([data[0]['geometry']['coordinates'][0][0][0][1], data[0]['geometry']['coordinates'][0][0][0][0]], 19);
// var result_point = JSON.parse("" + data + "")
// //console.log(result_point)
......@@ -2527,6 +2535,57 @@
});
}
});
} else if (dar == ' Koordinat'){
var geocodeService = L.esri.Geocoding.geocodeService();
var geocoderNominatim = new L.Control.Geocoder.Nominatim();
var str = $('#input_search').val()
var dapoin = str.split(',').map(Number);
console.log(dapoin)
var geo_koor = L.marker(dapoin)
conten = `
<div id="bottom-justified-data" style="text-align: center;">
<div >
<div style="font-family: Google Sans,Roboto,Arial,sans-serif;
letter-spacing: 0">
<p>
` + str + `
</p>
</div>
</div>
</div>
`;
geo_koor.bindTooltip(conten, {
permanent: true,
className: "my-label",
direction: 'top',
offset: [0, -25]
});
geo_koor.addTo(map);
map.setView(dapoin, 19);
$(document).on("click", "#btn_search_spes", function() {
geo_koor.remove();
});
$('#search_spes li a').on('click', function() {
$('#input_search').val(null)
tes = $(this).text();
dar = tes
if (dar == ' Reset') {
// geo_koor.clearLayers();
geo_koor.remove();
// map.eachLayer((geo_koor) => {
// layer.remove();
// });
}
});
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment