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

Shaded area datamaps - VBA

This is a discussion on Shaded area datamaps - VBA within the Development forums, part of the MapPoint Desktop Discussion category; Can anyone point me in the right direction? I'm basically getting nowhere using Code: set ObjDataSet = ObjDataSets.ImportData(zDatasource) set ObjDataMap ...

  1. #1
    Swoop is offline Junior Member Yellow Belt
    Join Date
    Jan 2013
    Posts
    17

    Shaded area datamaps - VBA

    Can anyone point me in the right direction?

    I'm basically getting nowhere using

    Code:
    set ObjDataSet = ObjDataSets.ImportData(zDatasource)
    set ObjDataMap = ObjDataSet.DisplayDataMap(geoDataMapTypeShadedArea, , , , , , MPcolor)
    And the error messages are really uninformative, like "The parameter is incorrect."

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

    Re: Shaded area datamaps - VBA

    Do you have the book Programming MapPoint in .NET?

    I think the examples in there are in C#, while I usually work in VB, but I still found the DisplayDataMap() examples very helpful.

    Also, Richard Marsden wrote some articles published here --

    Using ImportData and DisplayDataMap - Part 1 of 3 - The ImportData Method

    Using ImportData and DisplayDataMap - Part 2 of 3 - Introducing DisplayDataMap

    Using ImportData and DisplayDataMap - Part 3 of 3 - DisplayDataMap Parameters
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

  3. #3
    Swoop is offline Junior Member Yellow Belt
    Join Date
    Jan 2013
    Posts
    17

    Re: Shaded area datamaps - VBA

    I really should learn to experiment more before posting. Cracked it appart from one tiny thing.....

    Im using

    Code:
    Set ObjDataMap = ObjDataSet.DisplayDataMap(GeoDataMapTypeShadedArea, , , , , , MPcolor)
    with MPcolor set to 13 (blue and red), however, on output it's using red for the high end and blue for the low.....I want it the other way round. Any ideas?

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

    Re: Shaded area datamaps - VBA

    There are not so many options for those color ranges, and unfortunately it doesn't let you set your own ranges...

    I wonder if you could flip your data? Maybe multiply everything by *-1?
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

  5. #5
    Swoop is offline Junior Member Yellow Belt
    Join Date
    Jan 2013
    Posts
    17

    Re: Shaded area datamaps - VBA

    Eric you're a genius.

    Works perfectly.

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

    Re: Shaded area datamaps - VBA

    Maybe that's what Microsoft intended people to do, lol.

    Probably not as many people use these color ranges as they do Pushpins, but I think this is a bigger limitation than the limit of only 8 symbols in the Multiple Symbol map.

    At least you can work around that limitation and use a macro to import along with custom symbols, but there's simply no way to get other color range patterns in there.

    Eric
    Last edited by Eric Frost; 03-07-2013 at 04:19 PM.
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

  7. #7
    Swoop is offline Junior Member Yellow Belt
    Join Date
    Jan 2013
    Posts
    17

    Re: Shaded area datamaps - VBA

    Nuther question relating to this....

    I'm using the following code to map the data and then both paste a copy into an Excel worksheet directly and save a .ptm file:

    Code:
    zDataSource = SaveFile & "!Demog!V1:W" & Range("Demog!D65000").End(xlUp).Row
    objApp.OpenMap SaveLoc & "patches.ptm"
    Set ObjDataSets = objApp.ActiveMap.DataSets
    Set ObjDataset = ObjDataSets.ImportData(zDataSource)
    Set objDataMap = ObjDataset.DisplayDataMap(geoDataMapTypeShadedArea, , , , , , MPcolour)
    
    Set objMap = objApp.ActiveMap
    objMap.Altitude = Range("Menu!N19").Value
    objMap.CopyMap
    Sheets("Demog").Select
    Range("A1").Select
    ActiveSheet.Paste
    objMap.SaveAs SaveLoc & "Demog.ptm", geoFormatMap, True
    however......the copy that gets pasted into Excel is fine but the .ptm file that gets saved doesn't contain any data. What am I doing wrong?

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

    Re: Shaded area datamaps - VBA

    I'm not sure this is going to help, and if it does exactly why, but I wonder if setting the objMap object sooner would help. Try rearranging the code like this and let is know if this helps.

    Code:
    zDataSource = SaveFile & "!Demog!V1:W" & Range("Demog!D65000").End(xlUp).Row
    objApp.OpenMap SaveLoc & "patches.ptm"
    Set objMap = objApp.ActiveMap
    Set ObjDataset = objMap.Datasets.ImportData(zDataSource)
    Set objDataMap = ObjDataset.DisplayDataMap(geoDataMapTypeShadedArea, , , , , , MPcolour)
    
    objMap.Altitude = Range("Menu!N19").Value
    objMap.CopyMap
    Sheets("Demog").Select
    Range("A1").Select
    ActiveSheet.Paste
    objMap.SaveAs SaveLoc & "Demog.ptm", geoFormatMap, True
    Sorry I'm not sure this is going to help, but I can't think of anything else right now.

    Eric
    Last edited by Eric Frost; 03-08-2013 at 01:26 PM.
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. MapPoint 2010 shaded area help
    By cburns08 in forum MapPoint Desktop Discussion
    Replies: 36
    Last Post: 03-27-2011, 08:51 PM
  2. Shaded area data map - is it really so hard???
    By PatGerstle in forum Development
    Replies: 2
    Last Post: 12-16-2010, 12:33 PM
  3. Change shaded area colors
    By scole in forum MapForums Plus Chat
    Replies: 3
    Last Post: 02-19-2010, 10:13 AM
  4. Problem with shaded area map for Canada
    By Boon in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 11-09-2008, 03:26 PM
  5. Deleting a dataset and shaded area on a map...
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 04-10-2005, 06:25 AM

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