Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Get latitude and longitude from german ZIP Code
- *
- * @param string URL for geocode table
- * @return array Array with Latitude and Longitude and the Cities Name like
- * 01067 =>
- * lat => 1.12351
- * lng => 45.4541
- * title => Dresden
- */
- public function getCoordinatesFromZip($geocodeurl = 'http://fa-technik.adfc.de/code/opengeodb/PLZ.tab') {
- $arr = array();
- $table = t3lib_div::getUrl($geocodeurl); // read url
- $lines = t3lib_div::trimExplode("\n", $table, 1); // split every line
- for ($i = 0; $i < count($lines); $i++) { // one loop for every line
- $line = explode("\t", $lines[$i]);
- $arr[$line[1]] = array (
- 'title' => $line[4], // Name of the City
- 'lng' => $line[2], // Latitude
- 'lat' => $line[3] // Longitude
- );
- }
- return $arr;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement