We are setting up a sales website for users to sell their own unique products.
We want the buyer to be able to see the location of the seller, down to their street name, in an embedded window.
I saw this:
http://html.shellcreeper.com/map-bound/
But it has to do it with the Long and Lat which we cannot get the seller to location.
So how do we do it? Does that information get sources dynamically from a Google API, and stored in a variable which then goes into our database, and if so, how?
How do we use Google Maps to show locations of sellers?
Moderator: General Moderators
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
How do we use Google Maps to show locations of sellers?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: How do we use Google Maps to show locations of sellers?
You can use the Google Maps API server-side to look up the seller's address and get a lat/long. Store that in your database and use it with the map.
You could do the lookup on the client, but it will be the same value every time so there's no sense waiting until then.
You could do the lookup on the client, but it will be the same value every time so there's no sense waiting until then.
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: How do we use Google Maps to show locations of sellers?
I just found a brilliant bit of code that does it.
Works just fine. No need for Lat and Long, even though I have since found a script that can gather it.
Code: Select all
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<?php
$address_variable = "street here, town, postcode";
$address = str_replace(" ", "+",$address_variable);
?>
<iframe style="width:100%;height:50%;" frameborder="0" id="cusmap" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.it/maps?q=<?php echo $address; ?>&output=embed"></iframe>
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
-
thinsoldier
- Forum Contributor
- Posts: 367
- Joined: Fri Jul 20, 2007 11:29 am
- Contact:
Re: How do we use Google Maps to show locations of sellers?
The google maps team has a github account with lots of example code for many thing you'd want to do like this and others
https://googlemaps.github.io/libraries
example: https://github.com/googlemaps/js-marker-clusterer
https://googlemaps.github.io/libraries
example: https://github.com/googlemaps/js-marker-clusterer
Warning: I have no idea what I'm talking about.
-
pass4sureguide
- Forum Newbie
- Posts: 1
- Joined: Tue May 31, 2016 1:17 am
Re: How do we use Google Maps to show locations of sellers?
good point:
use the Google Maps API server-side to look up the seller's address and get a lat/long. Store that in your database and use it with the map..
use the Google Maps API server-side to look up the seller's address and get a lat/long. Store that in your database and use it with the map..
Last edited by requinix on Tue May 31, 2016 2:53 am, edited 1 time in total.
Reason: removing advertising
Reason: removing advertising