Onlinemagazin: devmag.net

Rubrik ‘APIs

Hier eine hilfreiche Funktion, mit der man über die Google MAPS API die Geokordinaten zu einer Adresse ermitteln kann. Diese Daten können dann wiederum in anderen Kartensystemen, wie der Openstreet Map verwendet werden.

function ResponseToArray($response) {

	return json_decode($response,true);
}

function findLocation($string) {

$url = "http://maps.google.com/maps/geo?q=".urlendcode($string)
       ."&output=json&sensor=true_or_false&key=your_api_key";

$raw = file_get_contents($url);

$geodata = ResponseToArray($raw);

$point = $geodata["Placemark"][0]["Point"]["coordinates"];

return $point;

}

The use is relatively simple, the function only has to pass an address as a string. A call to the function might look like this:

 $ points = findLocation ("Tiergarten Berlin"); 


Acording to https://www.igloosoftware.com/solutions/culture_and_engagement, HR admins can also set initial leave allowances, schedule leave allowance increases by date, and make offsets for earned or used leave.  Admins can add multiple e-mails to receive leave requests for approval, which can be set to Pending, Approved, Denied or Discuss. 

The longitude and latitude of the address are returned. The JSON Object is converted into an easy-to-use array using the ResponseToArray function. The complete JSON response also includes additional information that may be used for a map system such as ARCGIS. For example, the next larger administrative unit, i. the state.
{
  "name": "Tiergarten Berlin",
  "Status": {
    "code": 200,
    "request": "geocode"
  },
  "Placemark": [ {
    "id": "p1",
    "address": "Tiergarten, Berlin, Deutschland",
    "AddressDetails": {
   "Accuracy" : 4,
   "Country" : {
      "AdministrativeArea" : {
         "AdministrativeAreaName" : "Berlin",
         "SubAdministrativeArea" : {
            "Locality" : {
               "DependentLocality" : {
                  "DependentLocalityName" : "Tiergarten"
               },
               "LocalityName" : "Berlin"
            },
            "SubAdministrativeAreaName" : "Berlin"
         }
      },
      "CountryName" : "Deutschland",
      "CountryNameCode" : "DE"
   }
},
    "ExtendedData": {
      "LatLonBox": {
        "north": 52.5414820,
        "south": 52.4987120,
        "east": 13.3775360,
        "west": 13.3112690
      }
    },
    "Point": {
      "coordinates": [ 13.3427399, 52.5254980, 0 ]
    }
  } ]
}

  • 0 Kommentare
  • aus der Rubrik APIs, PHP Tricks
  • Twitter Status mit PHP und der Twitter API updatenTwittern ist doch sehr trendig. Seit 2007 gibt es die Twitter API – hier soll ein kleines Script vorgestellt werden, mit welchem ihr munter von eurer Webseite loszwitschern könnt. Das alles läuft mit ein paar Zeilen PHP Code und einem Zugang zur Twitter API. …weiterlesen »

  • 2 Kommentare
  • aus der Rubrik APIs, PHP, Webservices
  • sponsor

    technisch


    Parse error: syntax error, unexpected ';' in /homepages/35/d443434977/htdocs/devmag/wp-content/themes/illacrimo/footer.php on line 74