Thursday, June 30, 2016

How to embed google maps street view PHP based on latitude longitude programmatic

If you want to embed custom made google map street view based on programmatic dynamic PHP code first you must make a separate page for the map, like so THIS based on the google documentation at the time of this writing.

Second you can embed the code in your site like this:
$lat = $result['lat'];
$lng = $result['lng'];
echo '<iframe width="400" height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="ADDRESS/TO/YOUR/streetmap&lat='.$lat.'&lng='.$lng.'"></iframe>';

The iframe will show the map in the size you indicate with the lat and lng given.

If you want to know how to get the lat and lng based on read address read google maps api.

Let me know in the comments below if anything is unclear or any feedback, or if you would like more tutorials/how-to on those or other topics.

No comments: