get city from geocoder results?

Got this working in the end using: var arrAddress = item.address_components; var itemRoute=””; var itemLocality=”; var itemCountry=”; var itemPc=””; var itemSnumber=””; // iterate through address_component array $.each(arrAddress, function (i, address_component) { console.log(‘address_component:’+i); if (address_component.types[0] == “route”){ console.log(i+”: route:”+address_component.long_name); itemRoute = address_component.long_name; } if (address_component.types[0] == “locality”){ console.log(“town:”+address_component.long_name); itemLocality = address_component.long_name; } if (address_component.types[0] == “country”){ … Read more

Get latitude and longitude based on location name with Google Autocomplete API

You can use the Google Geocoder service in the Google Maps API to convert from your location name to a latitude and longitude. So you need some code like: var geocoder = new google.maps.Geocoder(); var address = document.getElementById(“address”).value; geocoder.geocode( { ‘address’: address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { // do something with the … Read more

Converting latitude and longitude to decimal values

To parse your input use the following. function ParseDMS(input) { var parts = input.split(/[^\d\w]+/); var lat = ConvertDMSToDD(parts[0], parts[1], parts[2], parts[3]); var lng = ConvertDMSToDD(parts[4], parts[5], parts[6], parts[7]); } The following will convert your DMS to DD function ConvertDMSToDD(degrees, minutes, seconds, direction) { var dd = degrees + minutes/60 + seconds/(60*60); if (direction == “S” … Read more

Create or update mapping in elasticsearch

Generally speaking, you can update your index mapping using the put mapping api (reference here) : curl -XPUT ‘http://localhost:9200/advert_index/_mapping/advert_type’ -d ‘ { “advert_type” : { “properties” : { //your new mapping properties } } } ‘ It’s especially useful for adding new fields. However, in your case, you will try to change the location type, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)