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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a report - a map 3

Status
Not open for further replies.

wtotten

IS-IT--Management
Apr 10, 2002
181
US
I have addresses in my database. A client wants to take that data and show the addresses on a map. It's an animal control application. For example, he wants a report that will show all licensed dos on the map in blue (a blue marker that is for each licensed animal), and unlicensed dogs with a red marker. I expect I'll first need to get longitude and latitude for the addresses, so I need some direction on how I can get those figures. Then I'll need to create the map report.

I appreciate any suggestions.

Bill
 
Search the forum, geocoding has been addressed many times (no pun intended).

As we had a flood here in germany there were many homepages showing maps of google with flooded areas, which seemed to come from some API, not manually added to, but with marker objects. So take a look around what's possible within the API. This would rather be a job for a developer, in the end you'd not do a report in the VFP sense of an FRX, you'd create a map via google or yahoo or bing maps and print an image or a html page.

Put that as an elance project, perhaps, I'd judge this more complex than you think.

Bye, Olaf.
 
Bill,

What country are the addresses in?

The reason I ask is that in many countries it is possible to geo-code addresses by reference to their postal code. For example, here in the UK, you can find the grid reference (a cartesian co-ordinate) from the postcode. Once you have the grid ref, it's a relatively simple task to convert it to longitude / latitude. Similar systems exist for other countries.

Once you have the long / lats, you can feed them into My Places in Google Maps. That will generate a map showing an icon for each of the addresses. You can use different icons for different types of address, and even create your own icons. If I remember right, you do the whole thing by submitting an XML file containing the long / lats. I investigated this myself once, but never actually got round to doing it.

None of this is relevant to VFP - except perhaps generating the XML. I suggest you start by reading the Help topics for Google Maps (and any similar products).

A couple of articles that might also be of help:


Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Bill,

I've just been browsing around, and found a bit more information that might be helpful to you.

This is from a tutorial I found:

If you want to have dozens of markers on your page, it gets a bit cumbersome ... The preferred method for handling large numbers of markers is to store the data in an XML file.

The above is from
They give the following as an example of the XML. It represents one point that is to be marked on the map:

Code:
   <markers>
     <marker lat="43.65654" lng="-79.90138" label="Marker One">
      <infowindow>Some stuff to display in the&lt;br&gt;First Info Window</infowindow>
     </marker>
   </markers>

Clearly, if the relevant information was in your database, you would have no problem in generating the XML from within VFP.

The other stuff I found was in a Google tutorial:


At a quick glance, it seems clear that you would need a good knowledge of JavaScript for this.

Finally, don't forget that there are other on-line mapping systems, not just Google. You might want to take a look at the relevant products from Bing, Apple, etc.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi Mike,

Thank you for the tips. As I have no experience with Java I will have to do some extra digging. I read the links you sent me but I didn't see anything there I am capable of doing. I'll look further or see if I get other replies.

Thank you Olaf and Mike,
Bill
 
Bill,

Just one other thought:

If you really want to do this properly, and if your client has the budget for it, then the ideal solution would be to invest in a professional geographic information system (GIS) package. I'm thinking of products such as MapInfo. These are designed specifically for the type of application you have in mind; they do not rely on a third-party web-based service such as Google Maps; and they give much greater control over the appearance and contents of the maps.

With a GIS, you would have to do little more than point it to your database, and perhaps set a few parameters. No programming would be needed.

The downside is that such products are expensive - both for the software and the actual maps.

Just something to think about.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Mike, that's a good suggestion. I'll look into it. This client is funny when it comes to money; sometimes they will spend tons of it on the silliest stuff and other times say "no" to something important. They may decide this is worth it!
Bill
 
MGagnon,

By any chance is there any way to convert that page to English?

Bill

 
This client is funny when it comes to money

While the client is laughing, ask them if this is a BUSINESS CRITICAL need.

If it is, then tell them to stop laughing and to prioritize their budget to get the work done - and done RIGHT.

If they do that then they will no longer be 'shooting themselves in the foot' in regards to having their business work effectively.

Also: I just used Babelfish.com (one of many free on-line translator services) to translate a part of the page

Original: Le quatrième parametre (nAccuracy) donne le niveau de précision de la réponse. Par exemple si tu roule le code comme il est la réponse est:
-77.0366260,38.8987480,200,8 , le niveau de précision est (French)
Translated: The fourth parameter (nAccuracy) gives the level of accuracy of the answer. For example if you drive the code as it is the answer is:-77.0366260,38.8987480,200,8, the level of precision is (English)

You might have to do your own translation piece-by-piece.

Good Luck,
JRB-Bldr

 
Mike Gagnon,

Does the routine you have on the web page you linked to have the ability to create a lot of data points on one map and have those data points marked with colors determined by what I want? It looks like it's for mapping one address, but since it's in French, I can't tell.

Bill
 
Each of the codes is for one address or one lat/long coordinate. Atoutfox is just demostrating 2 of many api calls to maps.google.com, the ones, which convert the coordinate to adress or vice versa, none of them mark anything in a map, but there are calls for that,too. You have to dig into the developer documentation, the principle is shown by making http requests. If you can't cope with that, hire someone.


Bye, Olaf.
 
By any chance is there any way to convert that page to English?

Allow me to do that.

As you can see, most of the page is an example of the code needed to geocode a page, that is, to determine the "GPS co-ordinates" (longitude / latitude) from a physical address, using the White House in the USA as an example.

The only bit of the code that needs translating is the comment about precision (see also JRB-Bldr's post, above):

Code:
Le quatrième parametre (nAccuracy) donne le niveau de précision de la réponse. Par exemple si tu roule le code comme il est la réponse est: 
-77.0366260,38.8987480,200,8  , le niveau de précision est 8 (le plus haut niveau)
Mais si on  enlève l'adresse (1600), la réponse est:
-77.0345150,38.8987730,200,6 avec un niveau de précision de 6.

In English, this would be:

The fourth parameter (nAccuracy) determines the precision level of the reply. For example, if you run the code as shown, the reply would be: -77.0366260,38.8987480,200,8, and the precision level would be 8 (which is the highest level). But if you were to omit the address (1600) [I think he means the house number], then the reply would be 77.0345150,38.8987730,200,6, indicating a precision level of 6.

In the discussion following the code, someone asked what you get if you give an incomplete address, such as just the street or the name of a town. Would the co-ordinates refer to the centre of the town (or street, or whatever). Mike's answer was Yes. Someone then asked what the third parameter was for, to which Mike replied that it is the error code, as shown at the end of the code sample.

Just to be clear, the code shows how to use Google maps to obtain the co-ordinates. It doesn't actually cause the location to appear on a map. It's just the first step towards that. You would still need to create the XML file, or a GIS, or whatever.

Mike







__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Another point about Mike Gagnon's code:

If you were using a full GIS package such as MapInfo, you wouldn't need to do any of this. The package would do the geo-coding for you - but only if you purchase the appropriage data module for your country (or state, or province).

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
You might also take a look at Microsoft MapPoint. It's an entry-level GIS, aimed at small businesses, and is probably much more economical than the likes of MapInfo (but I haven't checked any prices recently). It's only available for North America and Europe (that's two sepearate products).

If MapPoint does what you want, you could connect it to a VFP table via ODBC, or export your VFP data to Excel, which MapPoint can work with directly.

I don't know much else about it, so check for yourself that it will meet your client's needs.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Another online map service I like is explaining itself very well with samples online, you can modify and interact with:

For example creating an interactive map and setting markers on it:

To make use of that in VFP all you need is a webbrowser control and the HTML including javascript to create the map.

See the functionalities explained interactive here:

This is from Nokia.

Bye, Olaf.
 
Sorry for coming back to you so last. But it seems you have all the answers you need from Mike and Olaf regarding my suggestion.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top