Matthew
10-10-2007, 01:32 PM
Hello,
Great little community you got going here. I hope you can help me.
I'm incredibly new to this stuff.......only been at it for 2 days.
I've got a series of text files that I want to read into MapPoint one by
one.
I've almost done it but.........
Currently my code does:
Import text file
Plot as shaded postcode sectors
Copy & Pastes map back into excel
The problem I have is that it does not map the right variable in my data.
I want it to map PSECTOR_TYPE, but I think it is just mapping CLUB_CODE.
Or is it mapping all the PSECTORs in the file and the name it gives it is the
name of the file.
The data I am trying to map looks like this:
CLUB_CODE PSECTOR PSECTOR_TYPE
5400 MK12 6 CORE
5400 MK13 7 CORE
5400 MK14 6 CORE
5400 MK14 7 CORE
5400 MK16 0 CORE
5400 MK2 2 CORE
5400 MK2 3 CORE
5400 MK3 6 CORE
5400 MK3 7 CORE
5400 MK6 2 CORE
5400 MK6 3 CORE
5400 MK6 4 CORE
5400 MK6 5 CORE
5400 MK10 9 SECONDARY
5400 MK11 1 SECONDARY
5400 MK12 5 SECONDARY
5400 MK13 0 SECONDARY
5400 MK13 8 SECONDARY
5400 MK13 9 SECONDARY
5400 MK14 5 SECONDARY
5400 MK15 9 SECONDARY
5400 MK16 8 SECONDARY
5400 MK16 9 SECONDARY
5400 MK18 1 SECONDARY
5400 MK3 5 SECONDARY
5400 MK4 1 SECONDARY
5400 MK4 2 SECONDARY
5400 MK5 6 SECONDARY
5400 MK5 7 SECONDARY
5400 MK7 8 SECONDARY
5400 MK8 0 SECONDARY
5400 MK8 8 SECONDARY
<tab-delimited>
The code as it currently stands:
Sub attempt3()
Dim objField As MapPoint.Field
Dim objDataMap As MapPoint.DataMap
Dim objDataSet As MapPoint.DataSet
Dim PSECTOR_TYPE As MapPoint.Field
Set objMapPoint = CreateObject("MapPoint.Application")
Set objMap = objMapPoint.NewMap
'objMapPoint.Visible = True
'objMapPoint.UserControl = True
Set colDatasets = objMapPoint.NewMap.DataSets
Set objDataSet = colDatasets.ImportData("C:\Documents and Settings\Matthew Southgate\My Documents\_HOMEWORK\Samples\5400.txt", , geoCountryEurope, geoDelimiterTab)
objDataSet.ZoomTo
Set objDataMap = objDataSet.DisplayDataMap(geoDataMapTypeShadedArea , , , , geoRangeTypeUniqueValues, geoRangeOrderLowToHigh, 2)
objDataMap.LegendTitle = "Core & Secondary Postcode Sectors"
objMap.SaveAs ("C:\Documents and Settings\Matthew Southgate\My Documents\_HOMEWORK\Saved File.ptm")
objMap.CopyMap
ActiveSheet.Paste
End Sub
The map currently looks like:
http://homepage.ntlworld.com/mrsouthg/LooksLikeNow.JPG
and I want it to look like:
http://homepage.ntlworld.com/mrsouthg/WantToLookLike.JPG
Can anyone of you helpful people assist?
Great little community you got going here. I hope you can help me.
I'm incredibly new to this stuff.......only been at it for 2 days.
I've got a series of text files that I want to read into MapPoint one by
one.
I've almost done it but.........
Currently my code does:
Import text file
Plot as shaded postcode sectors
Copy & Pastes map back into excel
The problem I have is that it does not map the right variable in my data.
I want it to map PSECTOR_TYPE, but I think it is just mapping CLUB_CODE.
Or is it mapping all the PSECTORs in the file and the name it gives it is the
name of the file.
The data I am trying to map looks like this:
CLUB_CODE PSECTOR PSECTOR_TYPE
5400 MK12 6 CORE
5400 MK13 7 CORE
5400 MK14 6 CORE
5400 MK14 7 CORE
5400 MK16 0 CORE
5400 MK2 2 CORE
5400 MK2 3 CORE
5400 MK3 6 CORE
5400 MK3 7 CORE
5400 MK6 2 CORE
5400 MK6 3 CORE
5400 MK6 4 CORE
5400 MK6 5 CORE
5400 MK10 9 SECONDARY
5400 MK11 1 SECONDARY
5400 MK12 5 SECONDARY
5400 MK13 0 SECONDARY
5400 MK13 8 SECONDARY
5400 MK13 9 SECONDARY
5400 MK14 5 SECONDARY
5400 MK15 9 SECONDARY
5400 MK16 8 SECONDARY
5400 MK16 9 SECONDARY
5400 MK18 1 SECONDARY
5400 MK3 5 SECONDARY
5400 MK4 1 SECONDARY
5400 MK4 2 SECONDARY
5400 MK5 6 SECONDARY
5400 MK5 7 SECONDARY
5400 MK7 8 SECONDARY
5400 MK8 0 SECONDARY
5400 MK8 8 SECONDARY
<tab-delimited>
The code as it currently stands:
Sub attempt3()
Dim objField As MapPoint.Field
Dim objDataMap As MapPoint.DataMap
Dim objDataSet As MapPoint.DataSet
Dim PSECTOR_TYPE As MapPoint.Field
Set objMapPoint = CreateObject("MapPoint.Application")
Set objMap = objMapPoint.NewMap
'objMapPoint.Visible = True
'objMapPoint.UserControl = True
Set colDatasets = objMapPoint.NewMap.DataSets
Set objDataSet = colDatasets.ImportData("C:\Documents and Settings\Matthew Southgate\My Documents\_HOMEWORK\Samples\5400.txt", , geoCountryEurope, geoDelimiterTab)
objDataSet.ZoomTo
Set objDataMap = objDataSet.DisplayDataMap(geoDataMapTypeShadedArea , , , , geoRangeTypeUniqueValues, geoRangeOrderLowToHigh, 2)
objDataMap.LegendTitle = "Core & Secondary Postcode Sectors"
objMap.SaveAs ("C:\Documents and Settings\Matthew Southgate\My Documents\_HOMEWORK\Saved File.ptm")
objMap.CopyMap
ActiveSheet.Paste
End Sub
The map currently looks like:
http://homepage.ntlworld.com/mrsouthg/LooksLikeNow.JPG
and I want it to look like:
http://homepage.ntlworld.com/mrsouthg/WantToLookLike.JPG
Can anyone of you helpful people assist?