![]() |
![]() |
Sometimes something that sounds complicated turns out to be easy. I was creating a page that would display details of councils taken from an xml page, I wanted to embed a google map zoomed in on the latitude or longitude and showing a map marker.
Declare two variables one for latitude and One for longitude, in this case I'm getting them from an xml file, but you could easily get them from a database
<?
$lat = $council->lat;
$lng = $council->lng;
?>
We are using a static map, for simplicity I am avoiding the javascript or iframe routes. I have set the map type to hybrid.
<img src="https://maps.google.com/maps/api/staticmap?center=<?php echo $lat ?>,<?php echo $lng ?>&zoom=14&markers=<?php echo $lat ?>,<?php echo $lng ?>&maptype=hybrid&&size=400x300&sensor=false" style="width: 400px; height: 400px;" />
Keywords: php, google map, marker, embed
Latest Posts |
27/04/20 |
How to Make a Model Anderson Shelter |
25/04/20 |
How to make a Model Roman Villa |
15/04/20 |
How to Make a Tetrahedron |
07/04/20 |
Octahedrons and how to draw their net |
17/11/15 |
How to Create a Time Sheet in Excel |
15/11/15 |
Handling time and dates in PHP |
03/02/15 |
How to Enhance Photographs with the Gimp |
25/01/15 |
How to Cook Pigeon |
25/01/15 |
Telling the Time |
24/01/15 |
An Old Travel Card |