[AccessD] OT? Mappoint - Virtual Earth - and Access Db

MartyConnelly martyconnelly at shaw.ca
Wed Sep 20 16:23:11 CDT 2006


If you have an address you can get a geocoded Lat/Long from the address  
postal code
It will get you within shooting distance, I know Canada Post sells this 
type of database.
Well I tried looking through Australia Post site I couldn't find it, 
maybe they sell
through third party so phone them.  If you have a lot of addresses maybe 
best.
Although I see Australia moving to a more granular DPID than postal code.

Here is some xml test code to hit a web service that returns Lat/Long
internationally for a postal code and country. if you post in their 
forums they
may give you australian postal code one, it is not posted to avoid spammers
posting a web site with all place names in australia. They have other web
services to find codes within 10 Km etc.

http://www.geonames.org/export/

Public Sub aussiepostalcode()
'Web service location for countries postal codes to return
'latitude and longitude, should write up more generically

'web service descriptions
'http://www.geonames.org/export/#ws
'don't hammer the site with 1000's of postal codes maybe a daily site limit
'see also
'http://support.microsoft.com/?kbid=313372

'need to set  reference to XML 4.0 +

Dim objHTTP As New MSXML2.XMLHTTP
Dim strWebPage As String
'On Error Resume Next

'Retrieve Web Page

' note upper-lowercase important in URL string especially service name
' insert postal code and iso country 2 letter name
'ISO-3166 alpha2 country codes.

' to check just stick url below in IE

strWebPage = 
"http://ws.geonames.org/postalCodeSearch?postalcode=2089&country=AU"

' don't get many postal codes at 90 Lat 0 Long in Canada, but it is 
there ha ha
'strWebPage = 
"http://ws.geonames.org/postalCodeSearch?postalcode=H0H0H0&country=CA"

objHTTP.Open "POST", strWebPage, False
    ' stick in your web page url  above , file type can be anything asp 
txt xml html etc.
    'depends partially on content type
    ' generally request header is first line below for forms
    objHTTP.setRequestHeader "Content-Type", 
"application/x-www-form-urlencoded"
    'objHttp.setRequestHeader "Content-Type", "text/xml"
  
    'Post variables depending on html form
 
 objHTTP.send strWebPage

'Check status of page
If Err.Number Or objHTTP.status <> "200" Then
  
   MsgBox Err.Number & Err.Description
   MsgBox "Cannot retrieve page!"
  
   Exit Sub
End If
' look at the responses
  Debug.Print "1*" & objHTTP.getAllResponseHeaders
  Debug.Print "2*" & objHTTP.statusText
  Debug.Print "3*" & objHTTP.status
  Debug.Print "4*" & objHTTP.responseText

  Dim xmlDoc As New MSXML2.DOMDocument40
  Dim objNodeList As IXMLDOMNodeList
  Dim GeoNode As MSXML2.IXMLDOMNode
 
     xmlDoc.async = False
     xmlDoc.loadXML objHTTP.responseText
     'error check dom load here and use XPath method for node selection
     xmlDoc.setProperty "SelectionLanguage", "XPath"
    
    Set objNodeList = xmlDoc.documentElement.selectNodes("//lat")
    Debug.Print objNodeList.length
      For Each GeoNode In objNodeList
        Debug.Print "Latitude : " & GeoNode.Text
      Next
   Set objNodeList = xmlDoc.documentElement.selectNodes("//lng")
    Debug.Print objNodeList.length
      For Each GeoNode In objNodeList
        Debug.Print "Longitude : " & GeoNode.Text
      Next
End Sub


Borge Hansen wrote:

>Hello List,
>This may be a somewhat OT, but here it is:
>
>I've been asked to come up with a solution for showing information coming from an Access Db onto Maps.
>
>In a nutshell :
>We have Acme Enterprises that operates a number of Acme Centres over a large geographical area.
>Around 20,000 people are employed in total.
>Each day around 2.5% of the work force due to sickness and other reasons for not turning up need to be replaced by relief staff.
>We have : permanent relief staff, casual relief staff and relief sourced through agencies
>
>We need to show various types of information on a map for a particular region:
>- all Acme Centres in the region (pinned to their location address)
>- For a particular Acme Centre the available pool of permanent and casual relief staff (each pinned to their home address) and
>various info about each person (available or not, highest qualification (worker, team manager, centre manager) etc.
>.... etc....
>
>So the web page showing a map has to be rendered in a suitable zoom level, and data pulled from an Access Db will give the necessary
>information to create some pushpins in various shapes and colours ... off the top of my head for example: for staff various shape
>according to qualification and different colour according to whether available or not; and yet another shape for displaying an Acme
>Centre.....
>
>Now, the question is what tools to use?
>
>I've been just starting looking into (i.e. reading about mostly) Mappoint 2006, Mappoint Web Services and Virtual Earth - and all is
>totally new to me.
>
>Microsoft's Mappoint 2006 only have maps for North America and Europe.
>We need it for Downunder!
>As I understand it it's a desktop application with a lot of functionality :
>- Enter an address and it will give you the latitude, longitude coordinates
>- Different types of pushpins to display on the maps
>- Many built in functions and 3rd party add ins for performing a wide variety of tasks and optimization calculations
>
>?? Does anyone know if and when an Australia / New Zealand map set will be available?
>
>Then there is MS Mappoint Webservices - I've downloaded the SDK and established a developer account with MS and will have a closer
>look.... but I understand a subscription license is somewhere in the five digit figures.... Any one having experience with this?
>
>Then there is MS Virtual Earth..... which is the application (?) I've been poking at the most:
>
>I came across the following example of overlaying pushpins from Mappoint 2006 onto Virtual Eath Map:
>http://www.gilleskohl.de/mappoint/PinsToFile2006/Samples/Addressestable.htm
>
>Gilles' add-in can be found here: http://www.gilleskohl.de/mappoint/PinsToFile2006/
>
>I imported the source from the htm web page above into Frontpage, allowed active content, and pre-viewing it in the browser I get
>the same map rendering.
>Too easy...
>
>But I can't make use of his pinstofile function because... no map set for Australia!
>
>I read the following article by Chandu Thota introducing Virtual Earth APIs:
>http://msdn.microsoft.com/msdnmag/issues/06/09/EarthlyDelights/default.aspx
>
>which gives a very good intro to the whole subject...
>
>Now, instead of viewing all of US as the starting map by changing (from the source view of Addressestable.htm) :
>the ShowMap function to the following, we are now rendering a map starting in our backyard and zoomed to a suitable level
>
>*****code snip *****
>         function ShowMap()
>         {
>            map = new VEMap('pinsToFileMap');
>            map.LoadMap(new VELatLong(-28.000344,153.408422), 15, "r", false);
>
>            AddPins();
>         }
>***********************
>
>and if you want some pushpins to appear on the eastcoast of Australia you can try to insert these lines in the function Addpins()
>
>
>****snip****   beware of linebreaks
>            AddPin(-28.025344,153.412311,'Sherri Hart Trey Research','<table><tr><td><b>Street Address</b></td><td>501 Corporate
>Centre Drive</td></tr><tr><td><b>City</b></td><td>Franklin</td></tr><tr><td><b>State</b></td><td>TN</td></tr><tr><td><b>ZIP
>Code</b></td><td>37067</td></tr><tr><td><b>Country</b></td><td>US</td></tr></table>','000');
>            AddPin(-28.100344,153.412311,'Don Funk Woodgrove Bank','<table><tr><td><b>Street Address</b></td><td>One City Place
>Drive </td></tr><tr><td><b>City</b></td><td>Creve Coeur</td></tr><tr><td><b>State</b></td><td>MO</td></tr><tr><td><b>ZIP
>Code</b></td><td>63141</td></tr><tr><td><b>Country</b></td><td>US</td></tr></table>','000');
>            AddPin(-28.200344,153.412311,'John Kelly Adventure Works','<table><tr><td><b>Street Address</b></td><td>One Perimeter
>Park South</td></tr><tr><td><b>City</b></td><td>Birmingham</td></tr><tr><td><b>State</b></td><td>AL</td></tr><tr><td><b>ZIP
>Code</b></td><td>35243</td></tr><tr><td><b>Country</b></td><td>US</td></tr></table>','000');
>*********
>
>So, what I am thinking at this point is that the API set for Virtual Earth appear easy to work with and it's free!
>
>????
>But:
>
>1) How do we get latitude and longitude coordinates for a large number of records?
>Is there any third party software that will go through address information file and return lat long coordinates for an Australian
>map set?
>
>2) Sample of code structure that will read Access table / query and give us data - similar to the data 'hardcoded' into the function
>"function AddPins()" in the htm source code:
>
>.....
>Thanks for reading on .... If any one has input or pointers where to get more information .... much appreciated.....
>
>Regards
>Borge
>
>
>
>
>
>
>  
>

-- 
Marty Connelly
Victoria, B.C.
Canada




More information about the AccessD mailing list