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

MapPoint Control from Visual C++ : Getting a postal code

This is a discussion on MapPoint Control from Visual C++ : Getting a postal code within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi everyone: I want the postal code of a region on which the user clicks to be returned. So I ...

  1. #1
    geouser is offline Junior Member Yellow Belt
    Join Date
    Jun 2006
    Posts
    13

    MapPoint Control from Visual C++ : Getting a postal code

    Hi everyone:
    I want the postal code of a region on which the user clicks to be returned. So I use the 'OnBeforeClickControl1()' event handler and what I do is the following:

    void CMapPointTest1View::OnBeforeClickControl1(long Button, long Shift, long X, long Y, BOOL FAR* Cancel)
    {

    m_location=m_map.XYToLocation(X,Y);
    m_location.GoTo();
    m_location.Select();
    CStreetAddress sa = m_location.GetStreetAddress();
    CString postalcode=sa.GetPostalCode();
    }
    m_location is a CLocation object, m_map is a CMap1 object.
    But the CString 'postalcode' is empty! WHY ???

  2. #2
    Mohamed is offline Member Green Belt
    Join Date
    Mar 2005
    Posts
    97
    Hi geouser,

    When you click somewhere in your region, you have to check if it is a GOOD ADDRESS. If not, you have to look for the NEAREST one. Thus, you can get the street, the postal code, and so on.

    Look in this forum for the REVERSE GEOCODING discussion.
    I remember, I've seen here a good article about getting nearest address.

    Hope this will help

    Ciao

  3. #3
    WonderMonkey is offline Junior Member Yellow Belt
    Join Date
    Apr 2006
    Posts
    22
    I think a spiral approach was used in finding the nearest good location.

  4. #4
    geouser is offline Junior Member Yellow Belt
    Join Date
    Jun 2006
    Posts
    13
    exactly! From what I know so far it should be a loop searching for good results. And it seems to work. But even the good locations do not return a postal code from the CFindResults object. Anyway: Good location or not, it should be possible to have the postal code or - better - the FIPS code for any spot in the US. If you click somewhere in the desert of Nevada with no popular place around, there must be a FIPS code for that region.....
    geouser

  5. #5
    WonderMonkey is offline Junior Member Yellow Belt
    Join Date
    Apr 2006
    Posts
    22
    FIPS ?

    First Intersection Partly Somewhere?

  6. #6
    geouser is offline Junior Member Yellow Belt
    Join Date
    Jun 2006
    Posts
    13
    Hi: Federal Information Processing Standard (FIPS) codes for counties used by the U. S. Census Bureau, see http://www.census.gov/geo/www/fips/f...a/national.txt
    every county has one. IM searching for the possibility to have the county returned after the user clicks on the map.
    geouser

  7. #7
    WonderMonkey is offline Junior Member Yellow Belt
    Join Date
    Apr 2006
    Posts
    22
    Thanks. Good information.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Problem with MapPoint control redraw in Visual c++
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 11-21-2004, 05:04 PM
  2. Control of MapPoint 2002 using Visual Basic .Net
    By DogsWorld in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 02-26-2004, 11:53 PM
  3. MapPoint 2004-Create Territories Using Full Cdn Postal Code
    By wkcarreg in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 01-30-2004, 12:46 PM
  4. MapPoint 2002 ActiveX control and Visual Studio .NET 2003
    By chulaka in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 09-30-2003, 11:35 AM
  5. How to get a postal code
    By huelsi in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 07-27-2003, 01:00 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