spacer1
spacer2 1_1 1_2
2_1
 Subscribe
 The MP2K Update!
 
 
 
 Magazine
Front Cover
What's New
Articles
Toolbar
News
Sample Data
Gallery
Advertise
About
 Features
MapPoint 2009
Press Releases
MapPoint Forums
Companies
Link to MP2Kmag
Wish List
MapPoint Trial
Authors
 Sponsors
 Order

MapPoint 2009

Programming MapPoint in .NET

MapPoint Book

  Spatial Community
ViaVirtualEarth
SVG Tutorials
MapPoint

Map Visitors

 Direct Media

IT support London
Connect is a London based Personal Computing company. We can provide you with unlimited access to an IT helpdesk and on-site support.

inks
See our comprehensive range of inks. See our amazing prices. See for yourself. Great value, great range and great customer service.

Cheap flights to Goa
Check out Holiday Hypermarket to book your cheap flights to Goa. A unique and exciting destination. Get set to jet off!

Cheap Holidays in Egypt
Check out the cheap holidays in Egypt with On The Beach. Our low price promise leaves other holiday operators in the dust! See for yourself.

Apartments Bulgaria >>
Apartments are often a much better source of income, even more so in Bulgaria with all its attractions.

Cheap Holidays to Fuerteventura
Searching for cheap holidays to Fuerteventura? Let dealchecker.co.uk make it easier. Use our simple holiday search to bag a bargain holiday.

Cheap Portugal Holidays
Want to know what the best time to book cheap Portugal holidays is? Well have a look on ulookubook.com for some useful information to save your cash. Golf, tennis and cycling are all very popular here.

  ARTICLES  


Finding Sites Within a Specified Distance From an Address

This article demonstrates the use of MapPoint's COM add-in capability to display locations from a database within a specified distance from a reference point.

Assumptions:

Note: This code uses MapPoint North America, but it can be easily modified to use fields more appropriate for European addresses.

In your add-in, create a form. Add a combo box called "cmbPushpin". This will be used to list all pushpins in the "My Pushpins" collection on your map. Create a text box called "txtTolerance" where you will enter the distance around the selected pushpin in which to find addresses. For this example the distance is in miles. Also, add a command button "cmdMap" that will be used to trigger the map creation.

In the Add-in designer procedure fired when the form above will be displayed, add the following code:

You now have a form loaded with a combo box listing any Pushpins that are on the underlying map.

Before going on let me spend a minute on data issues. Unfortunately, MapPoint's ability to handle data is not all that it could be. If you build an ADO recordset, you can't directly import the points into a MapPoint dataset. You can only create pushpins as demonstrated in the code example below. This means that you really only have 2 fields to use for data: Name and Note. The other way to get data in and bring in all desired fields is to use the ImportData method, but with SQL Server that means using a UDL (Universal data link) file and limiting the syntax of how you access SQL Server objects. For example, I don't know how you could use a stored procedure. This is my single biggest gripe with MapPoint. (If I am incorrect about this, someone please set me straight.)

Put the following code behind the "cmdMap" command button. See comments in the code for details of how this works. At a high level, the code determines the latitude and longitude of the selected pushpin, queries the database for points whose latitudes and longitudes are in a rectangle that is slightly larger than the desired radius and uses the MapPoint "Distance" method for each point in the rectangle to determine whether it falls within the desired distance.

To use this:

  1. Put a pushpin on the map,
  2. Select the map form from your add-in options,
  3. Select the desired pushpin and enter the desired distance in the text box,
  4. Click the map button.

You now have all of the points on your database that are within the specified distance from the reference point. Clearly, additional filtering can be done to limit the displayed data and make this even more useful.

Discuss this story in the forum.

Author: Walt Cygan
Email: wcygan(AT)macrogroup.net
URL: http://www.macrogroup.net
Walt is a consultant for The MACRO GROUP, Inc. in Minneapolis, Minnesota. The MACRO GROUP, Inc. is an information systems consulting firm whose customers include public, private and non-profit organizations of all sizes.



Google
 
MP2Kmag Internet


 Recent Discussion
-For sale apple iphone 16gb.......$300usd
-For sale.. Nokia n96. $300usd
-For sale apple iphone 16gb.......$300usd
-can't install MP2009
-Nordstrom
-First 11 Chapters of "Precious Cargo" Featuring Virtual Earth
-FOR SALE : Apple iPhone 3G 16GB @ $350 USD / Sony Playstation 3 (60 GB) @ $250 USD
-CBSA Mapping in MapPoint 2006
-Beginner's Help with MapPoint 2006!
-SQL Server 2008 (ADO.NET)
-Virtual Earth 6.0 Auto-Upgrade Date Now Locked - September 10, 2008
-how to display custom layer by map scale
-Stream Video and Location Together with GPS-Enabled Mobile Video
-Add Listings to Live Search Maps via The New Live Search Local Listings Center
-MapPoint 2009 Export to Pocket Streets
-MapInfo Pro 9.5 Reviews
-VS c++ and Mappoint 2006 Questions
-match records - importing
-Winwaed announce MPMileage v1.0
-Geographic boundaries - DMA's
-Streets & Trips or StreetAtlas type product for Mac?
-25 mile around each places on the map by "COM"
-Hello :)
-mapping 2 sets of locations with distance
-Locate Any Technician Vehicle, Anytime, Anywhere - 24/7
 Resources
Browse GIS books and periodicals
Best Car Contract Hire Lease Save
Find a MapPoint Partner or Consultant
Real Estate Columbia Homes for Sale by Owner


Want Your Site To Appear Here?

   © 1999-2008 MP2K. Questions and comments to: website@mp2kmag.com
  Microsoft and MapPoint 2002/2004/2006 are either trademarks or registered trademarks of Microsoft.

• Replacement Cordless Phone Batteries from DSMiller
Improve your career with a computer degree LocalEDU.com
• Tim Cohn's Marketing Strategy Consultancy
• Buy Toner, Ink Cartridges & Drums at Marquee Office Solutions
• Looking for Dry Erase Boards? See Dry Erase Boards • The Search Starts Here Used Cars
• 5339 - We Know Bikes: Road Bikes / Triathlon Bikes / Mountain Bikes / BMX Bikes
• Buy Your Car Used Cars, Car Lease and Contract Hire