Community of VE/MapPoint Users and Developers
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 ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Problem parsing street addresses. 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? |
| |||
| Re: Problem parsing street addresses.
Hi, You have to check for null values on each object before parsing it.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| 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. |
| |||
| 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.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| 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 |
| |||
| 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
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| 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 |
| |||
| 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.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
![]() |
| Tags |
| addresses, parsing, problem, street |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| 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 |