Created
June 20, 2016 19:27
-
-
Save jwo/5d1f433a80efb3ec6cead57d6d2078e7 to your computer and use it in GitHub Desktop.
http://locationiq.org seems pretty great for Geocoding and reverse geo-coding. * And it works in standard jquery across domains, so it’ won’t trip up people with CORS. * Can work in simple server side queries as well for the same reason * Reverse geocoding works too though not as a replacement for foursquare places. Good for city/state tho. * It…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://code.jquery.com/jquery-2.2.4.js"></script> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<form id="search"> | |
<label for="q">Search</label> | |
<input type="textfield" placeholder="Address / Name" id="q"/> | |
<input type="submit"> | |
<br/> | |
<div id="answer"></div> | |
<div id="lat"></div> | |
<div id="lng"></div> | |
</form> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(window).ready(function(){ | |
$("#search").on("submit", function(event){ | |
event.preventDefault(); | |
var keyGoesHere = ""; // your api key goes here | |
var query = $("#q").val(); | |
$.getJSON("http://osm1.unwiredlabs.com/v1/search.php?key=" + keyGoesHere + "&format=json&q=" + query + "%2C+TX&accept-language=en") | |
.done(function(data){ | |
var found = data[0]; | |
$("#answer").html(found.display_name); | |
$("#lat").html("lat: " + found.lat); | |
$("#lng").html("lon: " + found.lon); | |
}); | |
}); | |
}); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"place_id": "85757998", | |
"licence": "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright", | |
"osm_type": "way", | |
"osm_id": "119420928", | |
"boundingbox": [ | |
"29.6839053", | |
"29.6858227", | |
"-95.4088338", | |
"-95.4066527" | |
], | |
"lat": "29.68480335", | |
"lon": "-95.4077512531093", | |
"display_name": "Reliant Astrodome, Reliant Parkway, Houston, Harris County, Texas, 77054, United States of America", | |
"class": "leisure", | |
"type": "stadium", | |
"importance": 0.101 | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment