
Perm. Mineral resources owerview.
- function GCD1(lat1, lon1, lat2, lon2) {
- // Return Great Circle Distance between points calculation
- function radians(a) {
- var outNum =Math.PI*a/180;
- return outNum;
- }
-
- var R = 6372.795;
- var d1=Math.sin(radians(lat1))*Math.sin(radians(lat2))+Math.cos(radians(lat1))*Math.cos(radians(lat2))*Math.cos(radians(lon2)-radians(lon1));
- var d2=Math.cos(radians(lat2))*Math.sin(radians(lon2)-radians(lon1));
- var d3=Math.cos(radians(lat1))*Math.sin(radians(lat2))-Math.sin(radians(lat1))*Math.cos(radians(lat2))*Math.cos(radians(lon2)-radians(lon1));
- var len=R*Math.atan2(Math.sqrt(d2*d2+d3*d3),d1);
- return len;
- }
- 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;
- }
Return Longitude by placename- 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;
- }
-
Return Latitude by placename- 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;
- }
-
Reverse geocoding- 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;
- }