MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Problem parsing street addresses.

This is a discussion on Problem parsing street addresses. within the MapPoint 2006/2009 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 ...


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 11-04-2006
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?
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 11-04-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Re: Problem parsing street addresses.

Hi,

You have to check for null values on each object before parsing it.
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 11-08-2006
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.
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 11-09-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
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.
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 11-09-2006
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
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 11-10-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
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.
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 11-12-2006
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 11-13-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
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.
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
addresses, parsing, problem, street


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
Problem with Hawaii Addresses tedlunt MapPoint 2006/2009 Discussion 0 01-11-2006 01:10 PM
Getting Canadian FSAs for Street Addresses dagheti MapPoint 2006/2009 Discussion 1 10-07-2005 08:23 PM
Problem with parsing countries Anonymous MapPoint 2006/2009 Discussion 5 01-10-2005 02:41 PM
Calculate Distance Between 2 Street Addresses? Anonymous MapPoint 2006/2009 Discussion 4 10-08-2003 06:16 AM
Need route that has even and odd street addresses separated Anonymous MapPoint 2006/2009 Discussion 1 02-04-2003 09:57 PM


All times are GMT -5. The time now is 11:08 PM.


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