-
Code's Tags
-
Your Codes
-
Reffers
-
Linked Codes
|
Code:
Short link for Twitter:
HTML:
HTML view:
Copy Source | Copy HTML- function getKML(placeName) {
- // Return KML by placename
- if (placeName == "") {
- return "You have to write the name the place"
- }
- var url = "http://maps.google.com/maps/geo?q="+ placeName+"&output=kml";
- var response = UrlFetchApp.fetch(url);
- var str = response.getContentText();
- return str;
- }
-
- function getLngLat(placeName) {
- // Return LngLatitude by placename
- if (placeName == "") {
- return "You have to write the name the place"
- }
- var url = "http://maps.google.com/maps/geo?q="+ placeName+"&output=json";
- var response = UrlFetchApp.fetch(url);
- var str=eval('(' + response.getContentText() + ')').Placemark[0].Point.coordinates;
- return str;
- }
-
- function getLng(placeName) {
- // Return Longitude by placename
- if (placeName == "") {
- return "You have to write the name the place"
- }
- var url = "http://maps.google.com/maps/geo?q="+ placeName+"&output=json";
- var response = UrlFetchApp.fetch(url);
- var str=eval('(' + response.getContentText() + ')').Placemark[0].Point.coordinates[0];
- return str;
- }
-
- function getLat(placeName) {
- // Return Latitude by placename
- if (placeName == "") {
- return "You have to write the name the place"
- }
- var url = "http://maps.google.com/maps/geo?q="+ placeName+"&output=json";
- var response = UrlFetchApp.fetch(url);
- var str=eval('(' + response.getContentText() + ')').Placemark[0].Point.coordinates[1];
- return str;
- }
-
- function getAddress(placeCoord) {
- // Return Address by placeCoord (reverse geocoding) placeCoord=lat,lng
- if (placeCoord == "") {
- return "You have to write the name the place"
- }
- var url = "http://maps.google.com/maps/geo?q="+ placeCoord+"&output=json";
- var response = UrlFetchApp.fetch(url);
- var str=eval('(' + response.getContentText() + ')').Placemark[0].address;
- return str;
- }
|