Source Code for Me (s-c.me)

Allows you to paste souce code to blogs! Adapted for Twitter! Here is Search Form in case you missed your code.
Code:
Selected Language:
Show Linenumbers:
Short link for Twitter:
HTML:

HTML view:

Copy Source | Copy HTML
  1. function getKML(placeName) {
  2. // Return KML by placename
  3.   if (placeName == "") {
  4.     return "You have to write the name the place"
  5.   }
  6.   var url = "http://maps.google.com/maps/geo?q="+ placeName+"&output=kml";
  7.   var response = UrlFetchApp.fetch(url);
  8.   var str = response.getContentText();
  9.   return str;
  10. }
  11.  
  12. function getLngLat(placeName) {
  13. // Return LngLatitude by placename
  14.   if (placeName == "") {
  15.     return "You have to write the name the place"
  16.   }
  17.   var url = "http://maps.google.com/maps/geo?q="+ placeName+"&output=json";
  18.   var response = UrlFetchApp.fetch(url);
  19.   var str=eval('(' + response.getContentText() + ')').Placemark[0].Point.coordinates;
  20.   return str;
  21. }
  22.  
  23. function getLng(placeName) {
  24. // Return Longitude by placename
  25.   if (placeName == "") {
  26.     return "You have to write the name the place"
  27.   }
  28.   var url = "http://maps.google.com/maps/geo?q="+ placeName+"&output=json";
  29.   var response = UrlFetchApp.fetch(url);
  30.   var str=eval('(' + response.getContentText() + ')').Placemark[0].Point.coordinates[0];
  31.   return str;
  32. }
  33.  
  34. function getLat(placeName) {
  35. // Return Latitude by placename
  36.   if (placeName == "") {
  37.     return "You have to write the name the place"
  38.   }
  39.   var url = "http://maps.google.com/maps/geo?q="+ placeName+"&output=json";
  40.   var response = UrlFetchApp.fetch(url);
  41.   var str=eval('(' + response.getContentText() + ')').Placemark[0].Point.coordinates[1];
  42.   return str;
  43. }
  44.  
  45. function getAddress(placeCoord) {
  46. // Return Address by placeCoord (reverse geocoding) placeCoord=lat,lng
  47.   if (placeCoord == "") {
  48.     return "You have to write the name the place"
  49.   }
  50.   var url = "http://maps.google.com/maps/geo?q="+ placeCoord+"&output=json";
  51.   var response = UrlFetchApp.fetch(url);
  52.   var str=eval('(' + response.getContentText() + ')').Placemark[0].address;
  53.   return str;
  54. }




Based on Manoli.Net's CodeFormatter. Made by Topbot (c) 2008-2016