URL and Link repository

Saturday, July 11, 2015

Update to Google Maps API Suddenly Exceeding Quota

Follow these links:
  • The Google Geocoding API
  • Geocoding Strategies
  • The key (no pun intended) here is whether you will use a browser key or a server key. Since my PHP script is using file-get-contents($requestURL), where $requestURL might look like this

    https://maps.googleapis.com/maps/api/geocode/json?latlng=

    I will create and copy the server key from the
    https://console.developers.google.com/project

    Now I am still trying to figure out where to place this code in the PHP/HTML/Javasript page. You'd think that

          src="https://maps.googleapis.com/maps/api/js?key=API_KEY">
        
    would work. But not necessarily so. Stay tuned.

    Thursday, July 9, 2015

    Google Maps API

    Last night while testing the features of SpiderOnFire, I found that step 2 Mark stopped working. After adding an echo,I realized that my call to the maps API using the clever key "abcdefg" stopped working after years of service.

    A quick visit to google developers console allowed me to properly define a key associated with this project: Widespread Augmented Reality

    Get one for yourself be following these steps:

  • Find APIs&Auth in left pane
  • Select APIs
  • Create key for browser
  • Select credentials in left pane to verify
  • Copy key into your web page code
  • Example:
    
    
    define("MAPS_HOST", "maps.google.com");
    define("KEY", "AIzaSyC6Fhp2Q78tcAf3FVmkY--xxxxxxxxx");
    .....
    $base_url = "http://maps.googleapis.com/maps/api/geocode/json?latlng=" ;
       $location = $_POST['latlng'];
       $location = substr($location,1,-1);
       $location = str_replace(" ","",$location); 
       
       $emd_url =  "&sensor=false" ;
       $request_url = $base_url . $location . $emd_url;
       $jsoncontents = file_get_contents($request_url) ;
       $decodedjson = json_decode($jsoncontents);
       $formattedaddy= $decodedjson->results[0] -> formatted_address;