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

appending census tract to a pushpoint

This is a discussion on appending census tract to a pushpoint within the MapPoint Desktop Discussion forums, part of the Map Forums category; I am trying to find a way to take data (street address) in mass and assign census tract #'s to ...

  1. #1
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    appending census tract to a pushpoint

    I am trying to find a way to take data (street address) in mass and assign census tract #'s to them via export from mappoint

  2. #2
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137

    VB.Net Code

    Here is some code I wrote to assist with something like that with MapPoint 2004. This code is provided AS IS, so use it at your own risk: I don't have all the bugs worked out. You need to decode the artifical line breaks from the posting, if any, yourself (sorry). Note: though you can run this without starting mappoint, don't.

    I used MSDN's example for ""MapPoint Get MSAs Add-in" as a base and tweaked it accordingly.

    Call it from some form:

    Dim objCTF as MyClass.CensusTrackFindfer = New MyClass.CensusTrackFinder

    MsgBox(objCTF.CensusTrack("1 Main Street, Big City, CA 90001"))

    The Class:

    Public Class CensusTrackFinder
    Private App As MapPoint.Application
    Private Map As MapPoint.Map
    Private NewApp As Boolean
    Private MapStyle As MapPoint.GeoMapStyle
    Private MapAltitude As String
    Private MapLocation As MapPoint.Location
    Private BlockMapStyle As Boolean ' If true, don't active swtich the map style after each find

    Public Sub New()
    NewApp = False
    Try
    App = GetObject(, "MapPoint.Application")
    Catch ex As System.Exception
    NewApp = True
    App = New MapPoint.Application
    End Try
    Map = App.ActiveMap
    BlockMapStyle = False
    End Sub

    Protected Overrides Sub Finalize()
    If NewApp Then App = Nothing
    MyBase.Finalize()
    End Sub

    Public WriteOnly Property LockMapStyle() As Boolean
    Set(ByVal Value As Boolean)
    If Value And Not BlockMapStyle Then ' If off and turned on, record the current map style
    BlockMapStyle = True
    MapStyle = Map.MapStyle
    MapAltitude = Map.Altitude.ToString
    MapLocation = Map.Location
    Map.MapStyle = MapPoint.GeoMapStyle.geoMapStyleData
    Map.Altitude = "15"

    ElseIf Not Value And BlockMapStyle Then ' If on and turned off, revert to the old map style
    BlockMapStyle = False
    Map.MapStyle = MapStyle
    Map.Altitude = MapAltitude
    MapLocation.GoTo()
    End If
    End Set
    End Property


    Public Function CensusTrack(ByVal Address As String) As String
    With Map.ParseStreetAddress(Address)
    Return FindCensusTrack(Map.FindAddressResults(.Street, .City, , , .PostalCode, .Country)(1))
    End With
    End Function

    Public Function CensusTrack(ByVal Street As String, ByVal City As String, ByVal State As String, ByVal Zip As String) As String
    Return FindCensusTrack(Map.FindAddressResults(Street, City, , , Zip, "USA")(1))
    End Function


    Private Function FindCensusTrack(ByVal Location As MapPoint.Location) As String
    Dim Result As String
    Dim FindResults As MapPoint.FindResults
    Dim OldMapStyle As MapPoint.GeoMapStyle
    Dim OldAltitude As String
    Dim OldLocation As MapPoint.Location
    With Map
    If Not BlockMapStyle Then
    OldMapStyle = .MapStyle ' Not Block, so record current map style
    OldAltitude = .Altitude.ToString
    OldLocation = .Location
    If (OldMapStyle <> MapPoint.GeoMapStyle.geoMapStyleData) Then .MapStyle = MapPoint.GeoMapStyle.geoMapStyleData
    If (OldAltitude <> "15") Then .Altitude = "15"
    End If

    Location.GoTo()

    FindResults = .ObjectsFromPoint(.LocationToX(Location), .LocationToY(Location))
    If FindResults.Count > 0 Then
    For Each Loc As Object In FindResults
    If Loc.Name.Trim.Length > 0 Then
    Result = Loc.Name
    Exit For
    End If
    Next
    Else
    Result = ""
    End If

    If Not BlockMapStyle Then
    If (OldMapStyle <> MapPoint.GeoMapStyle.geoMapStyleData) Then .MapStyle = OldMapStyle
    If (OldAltitude <> "15") Then .Altitude = OldAltitude
    OldLocation.GoTo()
    End If
    End With

    Return Result

    End Function



    End Class


    vbnet@grahamlower.com

  3. #3
    bjhughes is offline Junior Member White Belt
    Join Date
    Sep 2010
    Posts
    6

    Re: appending census tract to a pushpoint

    I've tried this code and couldn't get it to work. Does anyone out there know how to programmatically find the census tract for a pushpin in MapPoint?

  4. #4
    Mattys Consulting's Avatar
    Mattys Consulting is offline Senior Member Black Belt
    Join Date
    Dec 2002
    Posts
    1,040

    Re: appending census tract to a pushpoint

    We use an SQLS 2008 database to do it.
    Michael R Mattys
    Business Process Developers
    www.mattysconsulting.com

  5. #5
    bjhughes is offline Junior Member White Belt
    Join Date
    Sep 2010
    Posts
    6

    Re: appending census tract to a pushpoint

    Could you elaborate a bit? Ideally we would like to use the existing data in MapPoint to determine census tract for an address - where did you get the database from? Do you need to input latitiude/longitude?

  6. #6
    Mattys Consulting's Avatar
    Mattys Consulting is offline Senior Member Black Belt
    Join Date
    Dec 2002
    Posts
    1,040

    Re: appending census tract to a pushpoint

    If your pushpins are on the map, they already have a latitude and longitude in the Location object, so the next step is to find out which polygon the coordinates are in. We serialized all the shapes (added the lat and lon points for each shape to a table) from the census.gov website and then run SQL to determine the exact polygon for each pin. The SQL is non-trivial since some tracts contain other tracts. We hope you'll consider hiring our services.
    Michael R Mattys
    Business Process Developers
    www.mattysconsulting.com

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Getting Census Tract from a pushpin
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 06-06-2005, 12:09 PM
  2. trying to automate lat long (pushpin) to census tract mappin
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 02-02-2005, 12:54 PM
  3. census tract format
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 10-17-2003, 08:03 PM
  4. Census Tract Input Field
    By Jim Grace in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 06-03-2003, 06:38 PM
  5. MapPoint 2003 and census 2000 tract boundaries
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 04-20-2003, 07:03 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 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