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.yandex.ru/maps/99/munich/?ll=11.555422%2C48.085201&z=10")
Array ( [source] => https://www.yandex.ru/maps/99/munich/?ll=11.555422%2C48.085201&z=10 [provider] => yandex [lat] => 48.085201 [lon] => 11.555422 [zoom] => 10 )
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/@48.085201,11.555422,10z [map1eu] => http://beta.map1.eu/#zoom=10&lat=48.085201&lon=11.555422&layers=BT [mapillary] => https://www.mapillary.com/app/?lat=48.085201&lng=11.555422&z=10 [fligthtradar24] => https://www.flightradar24.com/48.085201,11.555422/10 [osm] => https://www.openstreetmap.org/#map=10/48.085201/11.555422 [wikimapia] => http://wikimapia.org/#lang=en&lat=48.085201&lon=11.555422&z=10&m=b [windy] => https://windy.com/?48.085201,11.555422,10 [yandex] => https://yandex.ru/maps/?ll=11.555422%2C48.085201&z=10 )
$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(48.085201, 11.555422, 10)
Array ( [google] => https://www.google.com/maps/@48.085201,11.555422,10z [map1eu] => http://beta.map1.eu/#zoom=10&lat=48.085201&lon=11.555422&layers=BT [mapillary] => https://www.mapillary.com/app/?lat=48.085201&lng=11.555422&z=10 [fligthtradar24] => https://www.flightradar24.com/48.085201,11.555422/10 [osm] => https://www.openstreetmap.org/#map=10/48.085201/11.555422 [wikimapia] => http://wikimapia.org/#lang=en&lat=48.085201&lon=11.555422&z=10&m=b [windy] => https://windy.com/?48.085201,11.555422,10 [yandex] => https://yandex.ru/maps/?ll=11.555422%2C48.085201&z=10 )
... or just one provider
$oMaphelper->generateUrl("google", 48.085201, 11.555422, 10)
https://www.google.com/maps/@48.085201,11.555422,10z
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)