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

DataMapTypeMultipleSymbol

This is a discussion on DataMapTypeMultipleSymbol within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hey guys, I am fairly new to MapPoint and even newer to Visual Basic. I am trying to produce a ...

  1. #1
    Goose7653 is offline Junior Member White Belt
    Join Date
    Nov 2006
    Posts
    3

    DataMapType MultipleSymbol

    Hey guys,
    I am fairly new to MapPoint and even newer to Visual Basic. I am trying to produce a map with multiple symbols. I have hacked my way up to a point and now I am crashing and burning. I am having trouble with the DisplayDataMap. Her eis what I have so far.

    Dim objDataSets As MapPoint.DataSets
    Dim objDataSet As MapPoint.DataSet
    Dim zDataSource AsString
    'This array determines the value ranges for my data
    Dim Legend(5) AsInteger
    Legend(0) = 5000
    Legend(1) = 1000
    Legend(2) = 500
    Legend(3) = 100
    Legend(4) = 50
    Legend(5) = 1
    'This array has the labels for each of my 5 ranges
    Dim Label(4) AsString
    Label(0) = "5000 - 1000"
    Label(1) = "1000 - 500"
    Label(2) = "500 - 100"
    Label(3) = "100 - 50"
    Label(4) = "50 - 1"
    'this array has integers that give my legend symbols for each range
    Dim LegColor(4) AsInteger
    LegColor(0) = 17
    LegColor(1) = 18
    LegColor(2) = 19
    LegColor(3) = 20
    LegColor(4) = 21
    'this array has integers that give my pins color
    Dim LabelColor(4) AsInteger
    LabelColor(0) = 17
    LabelColor(1) = 18
    LabelColor(2) = 19
    LabelColor(3) = 20
    LabelColor(4) = 21
    Dim xFieldArray(0 To 3, 0 To 1) AsObject
    'Use the Address field as the other data:
    xFieldArray(0, 0) = "Address Keys"
    xFieldArray(0, 1) = 23
    'Use the Charts field as other data:
    xFieldArray(1, 0) = "Charts"
    xFieldArray(1, 1) = 23
    'Use the latitude field as the Latitude:
    xFieldArray(2, 0) = "Latitude"
    xFieldArray(2, 1) = 20
    'Use the longitude field as the Longtude:
    xFieldArray(3, 0) = "Longitude"
    xFieldArray(3, 1) = 21
    'find my workbook and sheet
    zDataSource = "C:\Documents and Settings\dgoossens\Desktop\RA_LEP\MapWiz(Query).xl s!Condensed"
    objDataSets = MPApp.ActiveMap.DataSets
    'import data from spreadsheet
    objDataSet = objDataSets.ImportData(zDataSource, xFieldArray, _
    MapPoint.GeoCountry.geoCountryUnitedStates, _
    MapPoint.GeoDelimiter.geoDelimiterDefault, _
    MapPoint.GeoImportFlags.geoImportFirstRowIsHeading s)
    'column you are selcting for multiple symbols
    Dim objField As MapPoint.Field
    objField = objDataSet.Fields("Charts")
    'map with multple symbols
    objDataSet.DisplayDataMap(MapPoint.GeoDataMapType. geoDataMapTypeMultipleSymbol, _
    objField, MapPoint.GeoShowDataBy.geoShowByDefault, _
    MapPoint.GeoCombineDataBy.geoCombineByCount, _
    MapPoint.GeoDataRangeType.geoRangeTypeDiscreteLogR anges, _
    MapPoint.GeoDataRangeOrder.geoRangeOrderLowToHigh, -1, 5, _
    Legend, Label, "", LegColor, LabelColor)

    The error I get is COMException Unhandled
    Type Mismatch.

    I have been starting at this for a while. Any hints whould be great.

  2. #2
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,094
    Blog Entries
    4

    Re: DataMapTypeMultipleSymbol

    Can you attached the spreadsheet or a sample of what the data looks like?

    Eric

  3. #3
    Goose7653 is offline Junior Member White Belt
    Join Date
    Nov 2006
    Posts
    3

    Re: DataMapTypeMultipleSymbol

    Ok here it is in text format. Hope this helps.
    Attached Files Attached Files

  4. #4
    Goose7653 is offline Junior Member White Belt
    Join Date
    Nov 2006
    Posts
    3

    Re: DataMapTypeMultipleSymbol

    GOT IT!!!!

    If anyone else is having this problem. The trick was changing my arrays to objects and adding the line.

    Dim missing AsObject = System.Reflection.Missing.Value

    and using missing as my dividebyfield.


    Dim objDataSets As MapPoint.DataSets
    Dim objDataSet As MapPoint.DataSet
    Dim objDataMap As MapPoint.DataMap
    Dim zDataSource AsString
    MPApp.Visible = True
    MPApp.UserControl = True
    'This array determines the value ranges for my data
    Dim Legend(5) AsObject
    Legend(0) = 5000
    Legend(1) = 1000
    Legend(2) = 500
    Legend(3) = 100
    Legend(4) = 50
    Legend(5) = 1
    'This array has the labels for each of my 5 ranges
    Dim Label(4) AsObject
    Label(0) = "5000 - 1000"
    Label(1) = "1000 - 500"
    Label(2) = "500 - 100"
    Label(3) = "100 - 50"
    Label(4) = "50 - 1"
    'this array has integers that give my legend symbols for each range
    Dim LegColor(4) AsObject
    LegColor(0) = 17
    LegColor(1) = 18
    LegColor(2) = 19
    LegColor(3) = 20
    LegColor(4) = 21
    'this array has integers that give my pins color
    Dim LabelColor(4) AsObject
    LabelColor(0) = 17
    LabelColor(1) = 18
    LabelColor(2) = 19
    LabelColor(3) = 20
    LabelColor(4) = 21
    Dim xFieldArray(0 To 3, 0 To 1) AsObject
    'Use the Address field as the other data:
    xFieldArray(0, 0) = "Address Keys"
    xFieldArray(0, 1) = 23
    'Use the Charts field as other data:
    xFieldArray(1, 0) = "Charts"
    xFieldArray(1, 1) = 23
    'Use the latitude field as the Latitude:
    xFieldArray(2, 0) = "Latitude"
    xFieldArray(2, 1) = 20
    'Use the longitude field as the Longtude:
    xFieldArray(3, 0) = "Longitude"
    xFieldArray(3, 1) = 21
    'find my workbook and sheet
    zDataSource = "C:\Documents and Settings\dgoossens\Desktop\RA_LEP\MapWiz(Query).xl s!Condensed"
    objDataSets = MPApp.ActiveMap.DataSets
    'import data from spreadsheet
    objDataSet = objDataSets.ImportData(zDataSource, xFieldArray, _
    MapPoint.GeoCountry.geoCountryUnitedStates, _
    MapPoint.GeoDelimiter.geoDelimiterDefault, _
    MapPoint.GeoImportFlags.geoImportFirstRowIsHeading s)
    'column you are selcting for multiple symbols
    Dim objField As MapPoint.Field
    objField = objDataSet.Fields(2)

    'map with multple symbols
    Dim missing AsObject = System.Reflection.Missing.Value
    objDataMap = objDataSet.DisplayDataMap(MapPoint.GeoDataMapType. geoDataMapTypeMultipleSymbol, _
    objField, MapPoint.GeoShowDataBy.geoShowByDefault, _
    MapPoint.GeoCombineDataBy.geoCombineByDefault, _
    MapPoint.GeoDataRangeType.geoRangeTypeDefault, _
    MapPoint.GeoDataRangeOrder.geoRangeOrderLowToHigh, -1, 5, _
    Legend, Label, missing, LegColor, LabelColor)

Thread Information

Users Browsing this Thread

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

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