Skip to content

Small utility function to get a direction rendered on a Google Static Maps from an array of locations.

Notifications You must be signed in to change notification settings

bdupiol/php-google-static-map-directions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

php-google-static-map-directions

Small utility function to get a direction rendered on a Google Static Maps from an array of locations. Developed for and used by our website Nabuco.

  • creates a request to Google's direction service via CURL
  • fetches path info from response
  • adds markers with alphabetical order and relevant color for each waypoint
  • creates clean Google Static Map URL

usage

<?php

include "static-map-direction.php";

$origin = "45.291002,-0.868131";
$destination = "44.683159,-0.405704";
$waypoints = array(
    "44.8765065,-0.4444849",
    "44.8843778,-0.1368667"
  );

$map_url = getStaticGmapURLForDirection($origin, $destination, $waypoints);

echo '<img src="'.$map_url.'"/>';
        

result

About

Small utility function to get a direction rendered on a Google Static Maps from an array of locations.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages