PDA

View Full Version : Finding addresses within drivetime zone



BigBen
01-09-2006, 08:51 AM
I am an amateur programmer in VB and am pretty proficient in database design and programming in SQL. I also do some website design. I am currently working on a project for a restaurant delivery business and recently purchased mappoint.

I generated a drive time zone and am currently working on refining the delivery area. What I need to do now is to create a program that can be used to verify if an address is within the delivery area. I see two solutions to this:

1) Simply have the program generate a pushpin at the delivery location and then generate coordinates to see if they are within the delivery zone.

2) Generate a database/spreadsheet of all street address ranges within the delivery zone.

I found one post discussing this, but it didn't go into enough detail. Here are the pro's and con's I see with each solution:

1) Pros: It would be easy to update. It would be rather accurate. Cons: I don't know anything about programming in mappoint. I would have to have mappoint running on each computer running the program. I would either have to integrate mappoint into the ordering software (meaning it couldn't be used without it, unless I wrote code to go around it) or I would have to write an entirely seperate program to do the calculation and then intergrate that into my ordering software.

2) Pros: I know how to work with DBs rather well. I can simply keep the DB on the systems running my order software and not need mappoint. I could also keep a printed list of all street numbers in a delivery area. Cons: It would require me to regenerate the DB if the delivery area is changed.

I would really like to go with option 2 since it would be easier on myself. So, is there a way to export a list of all address ranges in a selected area? If not, what information (book or articles on here) do I need to read to be able to use mappoint in my VB projects.

Winwaed
01-09-2006, 10:15 AM
I think you're going to be out of luck. MapPoint could export all pushpins within a polygon, but not all addresses. Assuming this was possible, I doubt it would be allowed in the EULA. The EULA or api tend to restrict large data extraction due to data licensing issues.

Also, there's quite a bit of evidence that MapPoint does not store the location of every single address - instead it only stores basic street number info. Eg. "houses on this side of the road run from A to B between these two locations". So the houses would appear to be evenly spaced and not take into account gaps, fields, etc.


Richard

BigBen
01-09-2006, 10:38 AM
I didn't think that it was going to be possible to export all the data. However I think most street number data that is stored by blocks (within metro areas anyway) so I think it would be fairly accurate.

So.... That leaves option number one. Where do I need to get started reading to learn how to have my apps interact with MapPoint? Any tutorials online or should I buy a book?

Winwaed
01-09-2006, 10:58 AM
The Help that comes with MapPoint 2004 is actually a pretty good start - you say you know VB already, so it should be easy enough. The main gotchas involve things like recordsets and variants - all things you will already be familiar with (the documentation assumes you know about certain things in VB).

This site has quite a few articles about performing different actions.
Then there are two books. The latest is Chandu Thota's "MapPoint in .NET" book in the O'Reilly series. Eric Frost (owner of this site) has some for sale. This has just been published. Don't be discouraged by the title, it also covers the desktop version of MapPoint.

The other book in existence is the "MapPoint for Dummies" book. It is based on the 2002 version and only gives an introduction to the api. On the positive side, the api has barely changed between 2002 and 2004. 2006 should also be backwards compatible when it is released.


Richard

DL
01-20-2006, 08:01 PM
I've been throught something like that in the past. Not the same kind of project, but mapping is mapping :)

So first, (after getting MapPoint) I've bought a "National ZIP+4 Address Database" from www.zipinfo.com

Then I've found the Location of the lowest address of every street address range in the needed cities with: oMap.FindAddressResults([Street], [City], [OtherCity], [Region], [PostalCode], [Country])

Then, you can put on the map all your Locations (found previously) with the oMap.AddPushpin(AtLocation, [Name]) method and move the pushpins in a dataset. (I would put some kind of ID of the street address range in the [Name] property so you can refer it later)

You have to create an Shape object that will hold your DrivingTimeZone and then you can query your dataset with the oDataSet.QueryShape(oDrivingTimeZoneShape)

This will return a recordset that will hold all your street address range pushpin that you had created.

With this recordset you can then go through all the records and get all your street address range that is within your driving time zone.

I hope it was clear :)

If you need help with the Methods/Objects I have written, you can take a look at MSDN Library for the MapPoint Visual Basic Reference at: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mappoint2004/BIZOMMMoveNext.asp

Have fun! :D