Hallo again to everybody,
I try to get from nominatim data, latitude and longitude to compare the distance between two object.
When I cal the nominatim I call it with ajax on this way:
$.ajax({ type: "GET",
url: "https://nominatim.openstreetmap.org/search?q="+street_to_find+"&format=json",
async: true,
success : function(text)
{
response = text;
alert(JSON.stringify(response));
risposta = JSON.stringify(response);
alert(risposta);
}
});
(the alert are to control the program)
in my case the complete request become:
https://nominatim.openstreetmap.org/search?q=viale+dell'ingegneria+perugia&format=json
and this is the data that I get
[{"place_id":249038748,"licence":"Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright","osm_type":"way","osm_id":702281107,"boundingbox":["43.1129387","43.1143331","12.3562089","12.3619221"],"lat":"43.1134662","lon":"12.359101","display_name":"Viale dell'Ingegneria, Santa Lucia, Perugia, Umbria, 06127, Italia","class":"highway","type":"tertiary","importance":0.50001}]
As you can see I receive data between square bracket and I canât parse it.
Yes, I can remove the bracket, (is not possible to parse the [0] item) , but is not elegance.
How can I solve it?
Cheers,
Sergio