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

Using ImportData and DisplayDataMap - Part 3 of 3 - DisplayDataMap Parameters

This is a discussion on Using ImportData and DisplayDataMap - Part 3 of 3 - DisplayDataMap Parameters within the MP2K Magazine Articles forums, part of the Map Forums category; DisplayDataMap has a lot of parameters, and here they are in order: DataMapType The first parameter specifies the map type ...

  1. #1
    Richard Marsden is offline Junior Member White Belt
    Join Date
    Jun 2011
    Posts
    5

    Using ImportData and DisplayDataMap - Part 3 of 3 - DisplayDataMap Parameters

    DisplayDataMap has a lot of parameters, and here they are in order:

    DataMapType

    The first parameter specifies the map type using the GeoDataMapType enumeration. Here is an example using a value of geoDataMapTypeCategoricalColumn:



    This parameter is optional and defaults to geoDataMapTypeDefault, which tells MapPoint to select the map type (typically a pushpin map).

    Values of geoDataMapTypeCategoricalColumn, geoDataMapTypeSeriesColumn, geoDataMapTypeSizedPie, and geoDataMapTypeUnsizedPie are all multi-field plots which require multiple data fields (see the DataField parameter). All of the other map types require only one data field.

    The values of geoDataMapTypeNone and geoDataMapTypeTerritory are not valid for use with DisplayDataMap.

    DataField

    DataField is the second parameter, and specifies the data field(s) to plot. This is either a single MapPoint Field object (for the single field map types) or an array of MapPoint Field objects (for multi-field map types).

    Data fields are typically numeric. Some map types can also accept string (text) fields to indicate categories. String fields are not valid for the pie chart and column chart map types, i.e. all of the multi-field map types.

    The default is for MapPoint to use the first valid data field in the dataset.

    ShowDataBy

    This is a geoShowByDefault enumeration value that specifies the geography level (entity) used to map the data. For example, in the above example, the data has been imported at the “Region 1” (US State) level, so it is plotted at the geoShowByRegion1 level.

    Data can be plotted at the same or larger level than it is stored at. For example, data imported and stored by US Zipcode, can be plotted at the US State level. Use the CombineDataBy parameter to specify how this data will be combined (aggregated).

    The default is geoShowByDefault which tells MapPoint to choose a default geography level for the dataset.

    CombineDataBy

    This parameter is only used if the ShowDataBy (see above) parameter forces data aggregation. It tells MapPoint how to aggregate (i.e. combine) geographic data. For example, how to combine values for individual US Zipcodes into one value for a US State. Data can be added (geoCombineByAdd), averaged (geoCombineByAverage), or by counting the number of values present (geoCombineByCount).

    geoCombineByNone forces no aggregation; and the default (geoCombineByDefault) tells MapPoint to choose its own method of aggregation.

    DataRangeType

    This is a GeoDataRangeType enumeration used to specify how numeric values are plotted – are they grouped together into discrete ranges, or plotted using a continuous range of shades? Should a linear or a logarithmic scale be used? Should they be grouped so that each discrete interval contains the same number of data points?

    The full set of values is discussed in the documentation, but some of the more complex examples that require further parameters, are demonstrated below.

    The default is a value of geoRangeTypeDefault which tells MapPoint to choose what it thinks is the most appropriate range type. A range type can be set for all map types except for the unsized pie chart (which is always geoRangeTypeNone). Not all range types are appropriate for all map types (e.g. multiple symbol maps cannot use one of the continuous range options).

    DataRangeOrder

    This parameter is a GeoDataRangeOrder enumeration value that specifies the order for the data ranges. Data ranges can be ascending (geoRangeOrderLowToHigh), descending (geoRangeOrderHighToLow), or default (geoRangeOrderDefault).
    It is ignored for the column charts and unsized pie charts.

    ColorScheme

    This is an optional long integer value that references a specific color scheme (palette) to use. The default is geoColorSchemeDefault (-1). Valid color schemes range from 0 to 15 and are illustrated in the MapPoint documentation page for the ColorScheme property.

    All MapPoint data maps are limited to these preset color schemes.

    DataRangeCount

    This is an optional long integer value that species the number of ranges for the discrete data range types. It must be a value from 1 to 8. It is ignored for continuous data ranges, un-sized pie charts, and column chart maps.

    ArrayOfCustomValues

    This is an optional array of values for each data range. Because these values include the minimum and maximum values to be plotted, the number of array values should be one plus the number of ranges.
    The continuous data range types require an array of size 3, but only the first and last values (start and end) are actually used.

    Here is an example with four custom ranges with the shaded circle map type:

    Code:
    object fieldSales = ds.Fields.get_Item(ref ourSalesIDX);
    
    // 4 ranges, ie. 5 values required
    object[] arrayOfCustomRanges = new object[5];
    arrayOfCustomRanges[0] = 200.0;
    arrayOfCustomRanges[1] = 1000.0;
    arrayOfCustomRanges[2] = 2000.0;
    arrayOfCustomRanges[3] = 3000.0;
    arrayOfCustomRanges[4] = 5000.0;
    
    datamap = ds.DisplayDataMap(MapPoint.GeoDataMapType.geoDataMapTypeShadedCircle,
                        fieldSales,
                        MapPoint.GeoShowDataBy.geoShowByRegion1,
                        MapPoint.GeoCombineDataBy.geoCombineByNone,
                        MapPoint.GeoDataRangeType.geoRangeTypeDiscreteEqualRanges,
                        MapPoint.GeoDataRangeOrder.geoRangeOrderDefault,
                        2,
                        4,
                        arrayOfCustomRanges,
                        missing,
                        missing,
                        missing,missing);



    ArrayOfCustomNames

    This is an array of custom names (labels) to be used for the map legend. These replace the labels or ranges (e.g. “3,000 to 5,000”, “2,000 to 2,999” in the above screenshot). Each label is specified with a string, and there should be one label per range (i.e. 4 in the above example).

    DivideByField

    This is optional parameter specifies the field to divide the values by. MapPoint has the ability to divide the data field(s) specified in the DataField parameter by another data field (i.e. a denominator). The data fields can only be divided by one denominator. Set this parameter to the MapPoint Field object that represents the denominator data field. The default is to use the existing DivideByField. Pass an empty variant to clear this field.

    Here is an example, using the above data to plot a map of red sized circles showing “Our Sales” divided by “Competitor A Sales”:

    Code:
    // Use these indexes to create an data field objects to plot
    object fieldSales = ds.Fields.get_Item(ref ourSalesIDX);
    object fieldASales = ds.Fields.get_Item(ref compASalesIDX);
    object fieldBSales = ds.Fields.get_Item(ref compBSalesIDX);
    
    datamap = ds.DisplayDataMap(MapPoint.GeoDataMapType.geoDataMapTypeSizedCircle,
                        fieldSales,
                        MapPoint.GeoShowDataBy.geoShowByRegion1,
                        MapPoint.GeoCombineDataBy.geoCombineByNone,
                        MapPoint.GeoDataRangeType.geoRangeTypeDefault,
                        MapPoint.GeoDataRangeOrder.geoRangeOrderDefault,
                        2,
                        3,
                        missing,missing,
                        fieldASales,
                        missing,missing);



    ArrayOfDataFieldLabels

    This parameter is used to pass an array of custom labels for each color / data field on the legend. The array size must be equal to the number of data fields. It is typically used with the categorical column and pie chart map types. The array must be of size 1 for the series column map type.

    Here is an example that uses the above sales data with custom data field labels:

    Code:
    // 3 data fields
    object[] arrayOfFieldLabels = new object[3];
    arrayOfFieldLabels[0] = "Our Sales";
    arrayOfFieldLabels[1] = "Acme Sales";
    arrayOfFieldLabels[2] = "Wile E. Coyote Sales";
    
    // change the dataset into Sized Pie Chart map
    datamap = ds.DisplayDataMap(MapPoint.GeoDataMapType.geoDataMapTypeCategoricalColumn,
                        datafields,
                        MapPoint.GeoShowDataBy.geoShowByRegion1,
                        MapPoint.GeoCombineDataBy.geoCombineByNone,
                        MapPoint.GeoDataRangeType.geoRangeTypeDefault,
                        MapPoint.GeoDataRangeOrder.geoRangeOrderDefault,
                        6,
                        3,
                        missing, missing, missing,
                        arrayOfFieldLabels,
                        missing);
    
                    datamap.LegendTitle = "Sales by State";




    ArrayOfPushpinSymbols

    This is an array that lists the pushpin symbols to be used for multiple symbol maps – it is ignored for the other map types. The array size must be equal to the DataRangeCount parameter. Symbols are referenced using integer indexes – the same indexes that are used to specify the symbols used by Pushpin objects. The valid range of values will vary according to the version of MapPoint and the number of custom symbols that have been loaded.

    Here is an example that plots the above sales data using custom symbols to represent ranges of sales data. The symbols are consecutive (pins 218-215 – the first eight numeric symbols in MapPoint 2010), so they are allocated using a FOR loop. They are assigned to equal-sized ranges of sales values:

    Code:
    // 8 ranges
    object[] arrayOfSymbols = new object[8];
    for (int ipin=0; ipin<8; ipin++)
         arrayOfSymbols[ipin] = (int)(218+ipin);
    
    datamap = ds.DisplayDataMap(MapPoint.GeoDataMapType.geoDataMapTypeMultipleSymbol,
                        fieldSales,
                        MapPoint.GeoShowDataBy.geoShowByRegion1,
                        MapPoint.GeoCombineDataBy.geoCombineByNone,
                        MapPoint.GeoDataRangeType.geoRangeTypeDiscreteEqualRanges,
                        MapPoint.GeoDataRangeOrder.geoRangeOrderDefault,
                        6,
                        8,
                        missing, missing, missing,
                        missing,
                        arrayOfSymbols);
    
    datamap.LegendTitle = "Sales by State";


    Conclusions

    As you can see, these methods and all of their parameters do indeed work. The secret (especially with DisplayDataMap) is to build up the method call one step at a time. Take a working example, check it works, and then change each parameter as required, testing after each stage. Although this makes for a slow development process, a step-by-step approach lets you quickly identify which parameter is set incorrectly when you get the non-descript “The parameter is incorrect” error.
    Last edited by Eric Frost; 12-14-2011 at 09:58 AM.
    Winwaed Software Technology LLC
    http://www.winwaed.com
    See http://www.mapping-tools.com for MapPoint Tools

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Using ImportData and DisplayDataMap - Part 1 of 3 - The ImportData Method
    By Richard Marsden in forum MP2K Magazine Articles
    Replies: 2
    Last Post: 12-13-2011, 10:57 AM
  2. Using ImportData and DisplayDataMap - Part 2 of 3 - Introducing DisplayDataMap
    By Richard Marsden in forum MP2K Magazine Articles
    Replies: 0
    Last Post: 12-12-2011, 10:01 AM
  3. DisplayDataMap
    By chpw in forum MapPoint Desktop Discussion
    Replies: 9
    Last Post: 02-14-2011, 07:26 PM
  4. DisplayDataMap
    By mmartin in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 05-05-2008, 08:26 AM
  5. DisplayDataMap and C#
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 07-04-2003, 01:15 PM

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