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

Showing data by zip code in c#

This is a discussion on Showing data by zip code in c# within the MapPoint Desktop Discussion forums, part of the Map Forums category; I want to show a map where each zip is a shade that represents how many jobs are pending in ...

  1. #1
    kevintory is offline Junior Member White Belt
    Join Date
    Feb 2007
    Posts
    3

    Showing data by zip code in c#

    I want to show a map where each zip is a shade that represents how many jobs are pending in that zip for a field automation system. I have no problem doing this from Excel, but I am having some trouble finding how to do this under program control. Could anyone point me in the right direction?

  2. #2
    Paul Larson is offline Senior Member Green Belt
    Join Date
    Sep 2005
    Location
    Battle Creek, Michigan
    Posts
    136

    Re: Showing data by zip code in c#

    The method DisplayDataMap has a nice example in the MapPoint help file:

    Code:
    void CreateShadedAreaMapUsingMapPointDemographics()
    {
      MapPoint.ApplicationClass objApp = new MapPoint.ApplicationClass();
      MapPoint.DataSet objDataSet;
      MapPoint.DataMap objDataMap;
      MapPoint.Field objField;
    
      //Set up application
      objApp.Visible = true;
      objApp.UserControl = true;
    
      //Get a new demographics set to DataMap
      objDataSet = objApp.ActiveMap.DataSets.GetDemographics(MapPoint.GeoCountry.geoCountryDefault);
    
      //Get a field from the demographics
      object key = "Households (2000)"; 
      object missing = System.Type.Missing;
      objField = objDataSet.Fields.get_Item(ref key);
      //Create the data map and give it a name
      objDataMap = objDataSet.DisplayDataMap(MapPoint.GeoDataMapType.geoDataMapTypeShadedArea, 
        objField, MapPoint.GeoShowDataBy.geoShowByRegion1, 
        MapPoint.GeoCombineDataBy.geoCombineByDefault,
        MapPoint.GeoDataRangeType.geoRangeTypeDiscreteEqualRanges, 
        MapPoint.GeoDataRangeOrder.geoRangeOrderDefault, 15,
        0, missing, missing, missing, missing, missing);
      objDataMap.LegendTitle = "State Households";
    }
    You'll most likely only need to replace the objField assignment with your own, and select the proper GeoShowDataBy entity level.

    HTH
    Paul

  3. #3
    Ekas is offline Junior Member White Belt
    Join Date
    Jan 2007
    Posts
    7

    Re: Showing data by zip code in c#

    Hello,

    This method is good for data contained internally in MapPoint (i.e. data taken from MapPoint itself which demographic data is).

    In case when we are trying to import territories from our custom source (text file) using ImportTerritories or LinkTerritories, further calling of DisplayDataMap raises "Access is denied" exception.

    However, I've found that ImportData prior to calling DisplayDataMap, instead of Import/LinkTerritories, works fine.

    I have the next question now: how to manage colors, setting some scheme of "temperature" colors correspondinly to counts in each area (sorry for my bad English but I hope you understand what I mean). For example, blue color means minimal value in appropriate field of dataset, red color means max value, and all values between min and max are gradations from blue to red corresponding to values in each record.

    Sure I continue researches now myself but any help would be appreciated if anybody already knows how to implement this. A code snippet would be very appreciated
    --
    Eugene

  4. #4
    Ekas is offline Junior Member White Belt
    Join Date
    Jan 2007
    Posts
    7

    Re: Showing data by zip code in c#

    One clarification for my question in previous post.

    I know how to use different color schemes for displaying shaded areas.

    But each scheme is limited to 6 colors, and it doesn't actually reflect a "temperature" which means colors corresponding to counts in each area. It's just a discrete coloring of areas, with same colors for areas having "near" counts (in case if we have more than 6 distinct values).

    Any way to implement exactly (or at least something close to) what I asked in prev. post - i.e. "temperature colors" for each area? Or at least, expanding number of available colors to some number bigger than 6?
    --
    Eugene

  5. #5
    Paul Larson is offline Senior Member Green Belt
    Join Date
    Sep 2005
    Location
    Battle Creek, Michigan
    Posts
    136

    Re: Showing data by zip code in c#

    Right-click on the dataset and choose "Format Legend".
    In the range-type dropdown, select "Distinct equal ranges".
    Set the number of ranges to 8.
    Set the order to High-to-low.
    Set the color scheme to the 3rd-from-the-right on the bottom, which is blue to white to red.

    You could also perform much more detailed coloring by using shapes outlining the zipcode boundaries, and then setting the color for each shape manually. With a little tweaking of 2DMGR100.DLL, you could even expand the colorset beyond the 41 colors known to mappoint.

    -Paul

  6. #6
    Ekas is offline Junior Member White Belt
    Join Date
    Jan 2007
    Posts
    7

    Re: Showing data by zip code in c#

    Hello Paul,

    Any way to do this programmatically?
    --
    Eugene

  7. #7
    Paul Larson is offline Senior Member Green Belt
    Join Date
    Sep 2005
    Location
    Battle Creek, Michigan
    Posts
    136

    Re: Showing data by zip code in c#

    Check the help reference for DisplayDataMap()
    Specifically, the parameters for

    DataRangeType = geoRangeTypeDiscreteEqualRanges
    ColorScheme = 13
    DataRangeCount = 8

  8. #8
    Ekas is offline Junior Member White Belt
    Join Date
    Jan 2007
    Posts
    7

    Re: Showing data by zip code in c#

    Ok, thanks - I'll research this
    --
    Eugene

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Zip code Data
    By mr4tno in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 01-26-2005, 04:16 PM
  2. Push Pins not showing up on linked data?
    By chucker in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 01-13-2005, 04:15 PM
  3. zip code data
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 09-17-2004, 10:40 AM
  4. Data Import Wizard showing after drag and drop.
    By matnace in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 07-22-2004, 06:08 PM
  5. Showing ZIP code divisions for territories programmatically
    By Fer in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 09-10-2003, 07:51 PM

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