MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




C# FindNearby

This is a discussion on C# FindNearby within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hello, I use the FindNearby fuction in a C# program to determine the nearest street to a position given by ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-26-2005
Member
Yellow Belt
 
Join Date: Feb 2005
Posts: 32
C# FindNearby

Hello,
I use the FindNearby fuction in a C# program to determine the nearest street to a position given by latitude/longitude. I have the following problem: the returned FindResult can contain Location and Pushpin objects. How can I find out the type of each element in the FindResult? It seems to me they are all of the type ComObject. I'm just trying to find out the nearest street.

Bye,

MD
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 04-26-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,112
Hi,

Code:
            FindResults Nearby = PP.Location.FindNearby(10);
            foreach (object o in Nearby) {
                if (o is Pushpin)
                    // this is a pushpin
                else if (o is Location)
                    // this is a Location
If you only need Location and dont need any other you can do following:

Code:
            FindResults Nearby = PP.Location.FindNearby(10);
            foreach (object o in Nearby) {
                Location loc =  o as Location
                if (o != null) {
                    // voila !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 04-26-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,112
Re: C# FindNearby

Hi,

Quote:
Originally Posted by MD2000
I'm just trying to find out the nearest street.
FindNearest only give you "points of interest", so no streets. But of course these points of interest have a streetaddress in many case.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 06-09-2005
Winwaed's Avatar
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 892
Blog Entries: 9

FindNearest only give you "points of interest", so no streets. But of course these points of interest have a streetaddress in many case.


In many cases?

Hmmm, I'm having problems here with FindNearby. I was using it fine, but when you ask for the nearest ATMs within 20 miles say, it isn't much use if a dozen of them are all called "Bank of America". I need some (human) way to distinguish them, eg. street address. At the moment I'm finding StreetAddress is nothing.

Let me see how many are affected, it was looking like all of them a few minutes ago, though...


Richard
__________________
Winwaed Software Technology LLC
http://www.winwaed.com
See http://www.mapping-tools.com for MapPoint Tools
Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 06-09-2005
Winwaed's Avatar
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 892
Blog Entries: 9
Looks like you're right Wilfried. Virtually all the POIs I've tried in the Dallas area have street information. A handful don't - just enough to crash my program unless I check the StreetAddress property for null/nothing!


Richard
__________________
Winwaed Software Technology LLC
http://www.winwaed.com
See http://www.mapping-tools.com for MapPoint Tools
Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 06-12-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,112
Hi Richard,

Quote:
A handful don't - just enough to crash my program unless I check the StreetAddress property for null/nothing!
Yes indeed the null checking filters them out. Is there something you like me to test/help on this ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 06-12-2005
Winwaed's Avatar
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 892
Blog Entries: 9
No I'm fine Wilfried. I was adding my own code to my own program and found it crashing. It is one more thing to check, but at least the data is there in most cases - which I think is enough for this customer.


Richard
__________________
Winwaed Software Technology LLC
http://www.winwaed.com
See http://www.mapping-tools.com for MapPoint Tools
Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
findnearby


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
FindNearby or QueryCircle RickS MapPoint 2006/2009 Discussion 1 12-27-2005 10:53 AM
Problem or Bug using FindNearby Anonymous MapPoint 2006/2009 Discussion 0 09-13-2004 01:05 PM
FindNearby problem webjagger MapPoint 2006/2009 Discussion 0 06-25-2004 06:56 AM
Help with FindNearby BobIDEAS MapPoint 2006/2009 Discussion 1 01-30-2003 11:17 PM
FindNearby Method Anonymous MapPoint 2006/2009 Discussion 0 09-24-2002 10:08 AM


All times are GMT -5. The time now is 11:00 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54