DisplayDataMap

mmartin
05-04-2008, 05:57 PM
Hello all,

I am using the code below to import data from a text file and map it. I get the data on the map if I set map type to Pushpin, but if I try and map any other type of map - say, a pie chart with the 3 zips and associated data I have in the text file for each - I get a mapping error (something like NA - 13, type mismatch)...any ideas?

Thanks
MM
Dim missing AsObject = System.Reflection.Missing.Value
''Fill the generic map dataset with US map info
Dim MapDS As MapPoint.DataSet
MapDS = AxMappointControl1.ActiveMap.DataSets.ImportData("C:\Maps\ZipsMetricTemp.txt", missing, MapPoint.GeoCountry.geoCountryUnitedStates, MapPoint.GeoDelimiter.geoDelimiterTab, MapPoint.GeoImportFlags.geoImportFirstRowIsHeading s)
''
Dim Metric1 AsObject = 2 ' set which fields of the imput text file to use
Dim Metric2 AsObject = 3
Dim Metric3 AsObject = 4
Dim objFields(3) AsObject
objFields(0) = MapDS.Fields(Metric1) 'put the fileds into order in the DS fields array
objFields(1) = MapDS.Fields(Metric2)
objFields(2) = MapDS.Fields(Metric3)
''Set the main demo fields based on the array sent in "demo" and the total # in NoOfDemos of the arguments of this sub
Dim objmap As MapPoint.DataMap
Try'***************Main map display call
'
objmap = MapDS.DisplayDataMap( _
MapPoint.GeoDataMapType.geoDataMapTypeUnsizedPie, _
objFields, _
MapPoint.GeoShowDataBy.geoShowByRegion1, _
MapPoint.GeoCombineDataBy.geoCombineByDefault, _
MapPoint.GeoDataRangeType.geoRangeTypeDefault, _
MapPoint.GeoDataRangeOrder.geoRangeOrderDefault, _
15, _
0, _
missing, _
missing, _
missing, _
missing, _
missing)
Catch ex As Exception
MsgBox("A map error has occured; please re-select map configuration items and try again" & ex.Source & ex.Message)
EndTry

MapAdmin
05-05-2008, 08:26 AM
The book Programming MapPoint in .NET has a good long section on using the DisplayDataMap method.. it's very fidgety. If you have just one parameter that is incorrect or was not exactly as expected, it will through that error. But there's no way (I'm aware of) to tell what parameter was messed up. I pull out the Programming MapPoint in .NET book every time I work with DisplayDataMap. The examples are all in C# (slight differences from VB6/VBA syntax).
Eric

 
Web mp2kmag.com
mapforums.com