Tester for map position helper (Php class)
This helper class can parse urls of a map services
Google maps, Openstreetmap, Yandex and many others. It fetches
the position longitude and latitude from an url.
It generates urls with the same position with other
map services.
Try it yourself!
- Open Google maps or Flightradar 24 or Open street map or Windy or Yandex map,
- Zoom in, go to any position and then
- Copy the url and paste it below.
Output
Get the position
$oMaphelper->getPos("https://www.google.ch/maps/@46.9457237,7.4302919,14z")
Array ( [source] => https://www.google.ch/maps/@46.9457237,7.4302919,14z [provider] => google [lat] => 46.9457237 [lon] => 7.4302919 [zoom] => 14 )
Urls that point to the same position
$oMaphelper->getUrls();OK, we got links of all providers. If not: you should know that there is a healing function that creates compatible values.
Array ( [google] => https://www.google.com/maps/@46.9457237,7.4302919,14z [map1eu] => http://beta.map1.eu/#zoom=14&lat=46.9457237&lon=7.4302919&layers=BT [mapillary] => https://www.mapillary.com/app/?lat=46.9457237&lng=7.4302919&z=14 [fligthtradar24] => https://www.flightradar24.com/46.9457237,7.4302919/14 [osm] => https://www.openstreetmap.org/#map=14/46.9457237/7.4302919 [wikimapia] => http://wikimapia.org/#lang=en&lat=46.9457237&lon=7.4302919&z=14&m=b [windy] => https://windy.com/?46.9457237,7.4302919,14 [yandex] => https://yandex.ru/maps/?ll=7.4302919%2C46.9457237&z=14 )
$oMaphelper->fixPosition();
link generation with position data
With latitude, longitude and zoom you can generate links too.
To get links to all providers:
$oMaphelper->generateUrls(46.9457237, 7.4302919, 14)
Array ( [google] => https://www.google.com/maps/@46.9457237,7.4302919,14z [map1eu] => http://beta.map1.eu/#zoom=14&lat=46.9457237&lon=7.4302919&layers=BT [mapillary] => https://www.mapillary.com/app/?lat=46.9457237&lng=7.4302919&z=14 [fligthtradar24] => https://www.flightradar24.com/46.9457237,7.4302919/14 [osm] => https://www.openstreetmap.org/#map=14/46.9457237/7.4302919 [wikimapia] => http://wikimapia.org/#lang=en&lat=46.9457237&lon=7.4302919&z=14&m=b [windy] => https://windy.com/?46.9457237,7.4302919,14 [yandex] => https://yandex.ru/maps/?ll=7.4302919%2C46.9457237&z=14 )
... or just one provider
$oMaphelper->generateUrl("google", 46.9457237, 7.4302919, 14)
https://www.google.com/maps/@46.9457237,7.4302919,14z
Examples
Click one :-)
http://www.openstreetmap.org/#map=13/46.9384/7.4585
https://www.yandex.ru/maps/99/munich/?ll=11.555422%2C48.085201&z=10
https://www.google.ch/maps/@46.9457237,7.4302919,14z
https://www.google.com.br/maps/@-22.7405789,-47.3313609,20.25z
Ressources
Source: Github
/
Author: Axel Hahn (www.axel-hahn.de)