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