MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




appending census tract to a pushpoint

This is a discussion on appending census tract to a pushpoint within the MapPoint 2006/2009 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 ...


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 02-24-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
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
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 12-02-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
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
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
appending, census, pushpoint, tract


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
Getting Census Tract from a pushpin Anonymous MapPoint 2006/2009 Discussion 2 06-06-2005 12:09 PM
trying to automate lat long (pushpin) to census tract mappin Anonymous MapPoint 2006/2009 Discussion 2 02-02-2005 12:54 PM
census tract format Anonymous MapPoint 2006/2009 Discussion 1 10-17-2003 08:03 PM
Census Tract Input Field Jim Grace MapPoint 2006/2009 Discussion 2 06-03-2003 06:38 PM
MapPoint 2003 and census 2000 tract boundaries Anonymous MapPoint 2006/2009 Discussion 2 04-20-2003 07:03 AM


All times are GMT -5. The time now is 02:45 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