Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Google Maps - Highlight multiple addresses 1

Status
Not open for further replies.

jcairo

Technical User
Jul 23, 2007
10
PT
Can anybody give me any tips on how to highlight more than one address in google maps from within vfp?

I found this code on the internet which displays google maps and highlights one address (Many thanks to whoever posted it), but how can I put a marker on other addresses in the area? i.e. it displays cAddress well enough but I would like to show cAddress2/3 etc. on the same map.

Also.. This code puts up a little marker on the map saying "Address" 5 Parkway or whatever, I wld love to change that "Address" to my own string, "Bar Cuba Libre" 5 Parkway or whatever...

*--------------------------------------------
* Place we are looking for
*--------------------------------------------
*cAddress = "769 Youngs Hill Rd, Easton, PA"
cAddress = "5 parkway, camden, london, england"
*cAddress2 = "10 camden high street, camden, london, england"


LOCAL loIE
*--------------------------------------------
* Open IE
*--------------------------------------------
loIE=CREATEOBJECT('internetexplorer.application')


*--------------------------------------------
* Navigate to Google's Map site. (way cool place).
*--------------------------------------------
loIE.Navigate( " ","+") )
*
* Use this address format for directions:
*
*--------------------------------------------
* Make visible
*--------------------------------------------
loIE.VISIBLE = .T.

T.I.A. Sorry if its a dumb question! but it's bugging me
 
jcairo

It is not a dumb question. Just add "to:"

to:Main St/W Mountain Rd @41.289340, -73.552040

Carefull, copy the whole hyperlink, but it adds a third stop on your route. Is that what you are looking for?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
Many thanks Mike for your reply.

What I was looking for was not directions from one address to another but rather to display multiple addresses from my table on a google map.

Say I have many addresses in a city (e.g. Berlin), I click on one and up pops the map with that address marked, but I would like my other addresses in Berlin to show up on the map as well, so I could go "Oh look it's just around the corner from that other place"

Any tips?

Thanks again, J.

 
jcairo

Not by sending an URL to the Internet explorer, as far as I know you cannot. You would need to use Google Maps API to return you a webpage in your browser (or a webbrowser activex in a form.
You can read about Google Maps API here :

And here is an example of a map showing multiple "pins", right mouse on it in Internet Explorer and view the source to see how it is done.



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
Thanks, that looks like exactly what I was after.
Could you give me any leads on how I would go about incorporating that into my VFP app?
 
It depends what your intent is. Do you want to trace a route and add a few extra "pins" in the area?
Are your routes added by taking textbox values? How do you plan to use this technique?
For example:
1. A form with a webbrowser activex on it.
2. A couple of textboxes on the form, for starting point and ending point.
3. A function in your form, that will take the parameters (the two textboxes value), that fonction will return you an HTML page bases on the result of the Google Map API.

But it is unclear to me the extra "pins", are they points of interests in the area? Restaurants? School?


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
Hi Mike,

I am writing a little app for my girlfriend who has a new job. She has to identify (via internet, trade magazines etc) potential new clients in various european capital cities. Then she needs to phone and schedule a series of meetings over a period of a week or so, then go there for the meetings.

Obviously it would be best to have as many meetings as possible on any given day, in the same part of the city.

So I have my form displaying all the contact's information including their address. On my form I have a button which launches Internet Explorer in its own window, and displays Google Maps with a pin in it showing the clients address. (Using the code in my 1st post)

But I would like it to display pins for other clients in that city so we could see which other clients are in the same area and try to schedule meetings with them on the same day.

Thanks again. J
 
As I stated before in my previous post, I don't think you can do it just by sending parameters to the URL of the internet exporer. You would have to construct to page in the background, and then load it into either a webbrowser activex on a form or the Internet explorer itself.
Here is the same example I showed you before but translate into Foxpro. You need to fix it to add either the GPS coordinates or the real address to make it work for you.
Code:
DECLARE INTEGER ShellExecute IN shell32.dll ; 
  INTEGER hndWin, ; 
  STRING cAction, ; 
  STRING cFileName, ; 
  STRING cParams, ;  
  STRING cDir, ; 
  INTEGER nShowWin



lctempHTML = SYS(2023)+"\"+SYS(3)+".htm"
SET TEXTMERGE ON
SET TEXTMERGE TO (lctempHTML) NOSHOW
\<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
\    "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">[/URL]
\<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] xmlns:v="urn:schemas-microsoft-com:vml">
\  <head>
\    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
\    <title>Google Maps JavaScript API Example: Simple Markers</title>
\    <script src="[URL unfurl="true"]http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-m51RBrvYughuyMxQ-i1QfUnH94QxWIa6N4U6MouMmBA"[/URL]
\            type="text/javascript"></script>
\    <script type="text/javascript">
\    
\    function initialize() {
\      if (GBrowserIsCompatible()) {
\        var map = new GMap2(document.getElementById("map_canvas"));
\       map.setCenter(new GLatLng(37.4419, -122.1419), 13);
\ 
\        // Add 10 markers to the map at random locations
\        var bounds = map.getBounds();
\        var southWest = bounds.getSouthWest();
\        var northEast = bounds.getNorthEast();
\        var lngSpan = northEast.lng() - southWest.lng();
\        var latSpan = northEast.lat() - southWest.lat();
\        for (var i = 0; i < 10; i++) {
\          var latlng = new GLatLng(southWest.lat() + latSpan * Math.random(),
\                                  southWest.lng() + lngSpan * Math.random());
\          map.addOverlay(new GMarker(latlng));
\        }
\      }
\    }
\
\    </script>
\  </head>
\  <body onload="initialize()" onunload="GUnload()">
\    <div id="map_canvas" style="width: 500px; height: 300px"></div>
\  </body>
\</html>
SET TEXTMERGE OFF
=FCLOSE(_TEXT)

lcStr=FILETOSTR(lctempHTML)
STRTOFILE(lcStr,"c:\tmp.htm")
cAction = "open" 
ShellExecute(0,cAction,"c:\tmp.htm","","",1)




Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
Thanks very much. That is just what I was after!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top