Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 3 of 3

Custom location returns null when using find nearby in route

This is a discussion on Custom location returns null when using find nearby in route within the MapPoint Desktop Discussion forums, part of the Map Forums category; When using the find nearby method I am having problems retrieving the custom data that I have imported into a ...

  1. #1
    briansbrown is offline Junior Member White Belt
    Join Date
    Nov 2004
    Posts
    1

    Custom location returns null when using find nearby in route

    When using the find nearby method I am having problems retrieving the custom data that I have imported into a MapPoint template. When iterating through the nearby location on a route the location returns null when it hits an imported recorded. All other locations are found.

    The Import data is included in the total count and the custom data is found using the interface but not programmatically. I am just interested in finding the custom location on a particular route. Is there a better solution or does anyone know what I am doing wrong? Any help is appreciated. Here is my code.


    Code:
    oResults = oMap.ActiveRoute.Directions.FindNearby(0.1);
    			int i = oResults.Count;
    			IEnumerator ienum = oResults.GetEnumerator();
    			ienum.Reset();
    			//Loop through the enumerator
    			while(ienum.MoveNext())
    			{
    				MapPoint.Location loc = ienum.Current as MapPoint.Location;
    				if(loc != null)
    				{
    					//process the location
    					ssCat = loc.Location.PlaceCategory.Name.ToString();
    					ssName = loc.Name.ToString();
    				}

  2. #2
    kmcgill is offline Junior Member White Belt
    Join Date
    Nov 2005
    Posts
    1

    Re: Custom location returns null when using find nearby in r

    Quote Originally Posted by briansbrown
    When using the find nearby method I am having problems retrieving the custom data that I have imported into a MapPoint template. When iterating through the nearby location on a route the location returns null when it hits an imported recorded. All other locations are found.

    The Import data is included in the total count and the custom data is found using the interface but not programmatically. I am just interested in finding the custom location on a particular route. Is there a better solution or does anyone know what I am doing wrong? Any help is appreciated. Here is my code.


    Code:
    oResults = oMap.ActiveRoute.Directions.FindNearby(0.1);
    			int i = oResults.Count;
    			IEnumerator ienum = oResults.GetEnumerator();
    			ienum.Reset();
    			//Loop through the enumerator
    			while(ienum.MoveNext())
    			{
    				MapPoint.Location loc = ienum.Current as MapPoint.Location;
    				if(loc != null)
    				{
    					//process the location
    					ssCat = loc.Location.PlaceCategory.Name.ToString();
    					ssName = loc.Name.ToString();
    				}


    I know it's been a while, but did you find a solution to this? I am experiencing the same problem with custom imported data. My code is nearly identical to yours - I am getting a "Count" of results, but I can't seem to iterate the results by casting them as Location objects. Any help would be appreciated. keith.mcgill@gmail.com

  3. #3
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    Code:
    MapPoint.Location loc = ienum.Current as MapPoint.Location;
                if(loc != null)
    Do you mean this evaluate always to null ? Because in that case there is no Location object in the result set.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. find nearby operation
    By edwong in forum Bing Maps and MapPoint Web Service
    Replies: 0
    Last Post: 10-03-2005, 02:41 PM
  2. Find Nearby Places...
    By Labtek in forum MapPoint Desktop Discussion
    Replies: 6
    Last Post: 08-16-2004, 03:39 AM
  3. Find Places Nearby Tool
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 03-29-2004, 11:27 AM
  4. In my application, i am doing a find nearby at a p....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 03-03-2004, 02:50 PM
  5. Export "Find nearby places" along a route?
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 11-06-2003, 10:56 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


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 55 56 57 58 59 60 61 62 63 64 65 66