Link to google map itinerary

Phoca Maps - displaying maps in Joomla! CMS
pcharra
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 31 Dec 2022, 18:16

Link to google map itinerary

Post by pcharra »

Hello
I would like to create a link in each marker to
https://www.google.com/maps/dir//latitude,longitude/
for example
https://www.google.com/maps/dir//45.091 ... 452854568/
retrieving the marker's latitude and longitude data, with variables.
Currently I enter the data manually.
Just so you know, this allows me to have all the route options (alternative, toll-free etc...) which I can't get with the button proposed by phocamap.
Thanks in advance for your help

https://imgur.com/a/ERLB167

Translated with DeepL.com (free version)
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48568
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Link to google map itinerary

Post by Jan »

Hi, for now, there is no such option so this needs to be customized directly in the code. :idea:

Jan
If you find Phoca extensions useful, please support the project
pcharra
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 31 Dec 2022, 18:16

Re: Link to google map itinerary

Post by pcharra »

Thank you very much.
What are the variables longitude, latitude (in decimal form) of the markers?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48568
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Link to google map itinerary

Post by Jan »

Hi, what do you mean with variables?

Jan
If you find Phoca extensions useful, please support the project
pcharra
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 31 Dec 2022, 18:16

Re: Link to google map itinerary

Post by pcharra »

Hello
I would like to add this line in the php script default.php or default_osm.php after the markers title. I would like to retrieve the numerical values of the marker's gps coordinates, longitude and latitude.

// Ajouter le lien d'itinéraire Google Maps
$text .= '<div><a href="https://www.google.com/maps/dir/?api=1&destination=' . $markerV->latitude . ',' . $markerV->longitude . '“ target=”_blank">Itinéraire Google Maps</a></div>';

Translated with DeepL.com (free version)
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48568
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Link to google map itinerary

Post by Jan »

Hi, depends on where you want to get them, the coordinates are just stored in the $markerV variable:

$markerV->latitude
$markerV->longitude

Mabye I don't fully understand what do you exactly mean?
If you find Phoca extensions useful, please support the project
pcharra
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 31 Dec 2022, 18:16

Re: Link to google map itinerary

Post by pcharra »

Hello
Thanks to Mistral AI. It works. You had to modify the scripts phocamapsmap.php and phocamapsmaposm.php in
administrator/components/com_phocamaps/helpers
I have the modified files available for those who are interested.
Problem solved for me.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48568
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Link to google map itinerary

Post by Jan »

Hi, great to hear it, will be great e.g. to get links to such modified files (e.g. on github, etc.).

Thank you, Jan
If you find Phoca extensions useful, please support the project
pcharra
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 31 Dec 2022, 18:16

Re: Link to google map itinerary

Post by pcharra »

Hello
Here is the link to the 2 modified files.

https://www.dropbox.com/scl/fi/9yvqowv6 ... acgmv&dl=0

It displays ‘Itinéraire Googlemaps’ in French.
You still have to modify the code for the language files
Post Reply