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 8 of 8

Problem parsing street addresses.

This is a discussion on Problem parsing street addresses. within the MapPoint Desktop Discussion forums, part of the Map Forums category; I have a problem parsing out some addresses that Mappoint returns for lat/on locations. When I try to parse out ...

  1. #1
    PMACAFEE is offline Member Yellow Belt
    Join Date
    Dec 2004
    Posts
    41

    Problem parsing street addresses.

    I have a problem parsing out some addresses that Mappoint returns for lat/on locations.

    When I try to parse out street and city for some returned address that are actually not street addresses I get an error.

    The one that snags the most is an address something like "San Francisco Airport", for a lat/lon around the terminal.

    Is there a way to detect such a non-parsable location such as the one above and then I would display the full address with city zip etc, but otherwise just glean and display the street and city?

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

    Re: Problem parsing street addresses.

    Hi,

    You have to check for null values on each object before parsing it.

  3. #3
    PMACAFEE is offline Member Yellow Belt
    Join Date
    Dec 2004
    Posts
    41

    Re: Problem parsing street addresses.

    I tried something like using the isnull function.

    But as soon as I declare the street item that i want to check if it is null, the error code says that the item does not exist.

    Thanks for the input, by the way.

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

    Re: Problem parsing street addresses.

    Then you also have to check the object where the street belongs to to see if it is not null. eg, you have a collection, you have to check for each item you wants to check if it is not null, if it is a location, if the StreedAddress in the Location is not null. And then you can access Street, Value, etc.

  5. #5
    PMACAFEE is offline Member Yellow Belt
    Join Date
    Dec 2004
    Posts
    41

    Re: Problem parsing street addresses.

    Wilfiied;

    I get the Street Addresses from lat/lon queries. Most of the StreetAddress results parse just fine. But some of the StreetAddress's returned by Mappoint are not exactly street addresses, such at the San Francisco Airport example.

    When I try to parse such a response, I get an error that the street component has not been declared, I cannot just test it for being null.

    I'm stumped

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

    Re: Problem parsing street addresses.

    Hi,

    You also have to check the object type of the collection. For example in your case you want a Location object, but the results could have also other objects witch dont have the StreetAddress property. So you cannot check for its null value if the property does not exists.

    For example in c#:

    Code:
    foreach (object o in results) {
      Location loc = o as Location;
      if (loc == null)
        continue;
      // hier it is a Location
    It s from the top of my head, so there may be typo's.

  7. #7
    PMACAFEE is offline Member Yellow Belt
    Join Date
    Dec 2004
    Posts
    41

    Re: Problem parsing street addresses.

    I looked at the address, and it is separated by commas. Sort of a comma deliminated string.

    I only want the street and city fields, the first 2.

    So I used VBA to detect the commas, and I stripped out the fields that I needed.

    Thanks

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

    Re: Problem parsing street addresses.

    Hi,

    Streetaddress has precides the Value property also a Street and a City property. You can yous them instead of parsing trough the Value I think.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Problem with Hawaii Addresses
    By tedlunt in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 01-11-2006, 01:10 PM
  2. Getting Canadian FSAs for Street Addresses
    By dagheti in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 10-07-2005, 08:23 PM
  3. Problem with parsing countries
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 5
    Last Post: 01-10-2005, 02:41 PM
  4. Calculate Distance Between 2 Street Addresses?
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 10-08-2003, 06:16 AM
  5. Need route that has even and odd street addresses separated
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 02-04-2003, 09:57 PM

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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96