Almost there..........Plotting wrong thing!!!

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?

davidb
10-12-2007, 03:55 AM
Hi there

As far as I can see you don't set objField to be PSECTOR_TYPE. Also given the format of postcode sectors you'd be better reading them as comma delimited. Finally if you're using MPE2006 read the postcode sector names in lower case because there is a casing bug and you'll get some strange results otherwise.

Set objDataSet = colDataSets.ImportData("C:\Documents and Settings\xxx\xx\xx.txt", , geoCountryEurope, geoDelimiterComma, geoImportFirstRowIsHeadings)
Set objField = objDataSet.Fields("PSECTOR_TYPE")
Set objDataMap = objDataSet.DisplayDataMap(geoDataMapTypeShadedArea , objField)

Hope this helps

 
Web mp2kmag.com
mapforums.com