I have this script I am trying to use to search for a value within a CartoDB table. I can't seem to figure out how to reverse the order of the lat & long coordinates so they appear as lonlat
... instead of latlon
Here is what I am trying to do:
function parcelSearch(layer) {
var sql = new cartodb.SQL({ user: 'dchadney' });
var $options = $('#searchParcel');
$options.click(function(e) {
var streetNam = document.getElementById('parcelid').value;
if(streetNam === "") {
alert("Please enter the parcel ID");
} else {
query = "SELECT * FROM parcels_sa WHERE parcel_id ILIKE '%" + streetNam + "%'";
console.log(query);
layer.getSubLayer(0).show();
sql.getBounds(query).done(function(bounds) {
latlon = bounds[0];
console.log(latlon);
$('.latlongit').val(latlon);
// map.fitBounds(bounds);
});
$('#step1').modal('hide');
$('#step1A').hide('fast');
setTimeout(function() {
$("#submitModal").modal({
backdrop: 'static'
});
}, 7000);
$('button#step3indicator').addClass('active');
$('.line2').css('width', '42%');
}
// change the query in the layer to update the map
layer.setSQL(query);
});
Seems to me that latlon is a function coming from leaflet? How do I modify this?