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

importdata to shaded areas

This is a discussion on importdata to shaded areas within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi, I'm new to Mappoint 2004. I'm trying to use importdata from a query in an access mdb to create ...

  1. #1
    max677 is offline Junior Member White Belt
    Join Date
    Aug 2005
    Posts
    3

    importdata to shaded areas

    Hi,
    I'm new to Mappoint 2004. I'm trying to use importdata from a query in an access mdb to create shaded areas with visual basic6. I obtain always a map with pushpin. I'm aggregating regional datas that i'm able to create in a shaded area with manual wizard. Do you know why?

    Thanks
    Max

  2. #2
    calv1ns's Avatar
    calv1ns is offline Member Green Belt
    Join Date
    Mar 2005
    Posts
    91

    Two Step Method

    Hey Max

    In VB to get to where you want to be it is a two step process. One link the data to get it into a DataSet Object and two execute a DisplayDataMap Method on that DataSet Object

    This is the syntax:

    object.DisplayDataMap([DataMapType], [DataField], [ShowDataBy], [CombineDataBy], [DataRangeType], [DataRangeOrder], [ColorScheme], [DataRangeCount], [ArrayOfCustomValues], [ArrayOfCustomNames], [DivideByField], [ArrayOfDataFieldLabels], [ArrayOfPushpinSymbols])

    It takes major fussing with this method to get a DataMap that looks pretty. Look it up in VB Help to get the settings required.

    Post your code here and maybe we can see if there is problem with what you are doing.

    Ciao,
    Calv1ns

  3. #3
    max677 is offline Junior Member White Belt
    Join Date
    Aug 2005
    Posts
    3
    The code is something like this, but i always receive "parameter is incorrect" in method DisplayDataMap.

    Thanks for help!!


    myExampleArray(0, 0) = "tot"
    myExampleArray(0, 1) = geoFieldInformation

    myExampleArray(1, 0) = "PROVINCIA_AVV"
    myExampleArray(1, 1) = geoFieldRegion2

    Set objDs = objMap.DataSets.ImportData("C:\Mp.mdb!Query_SinApe ", myExampleArray, geoCountryItaly, geoDelimiterDefault, geoImportAccessQuery)

    Set obField = objDs.Fields("provincia_avv")

    Set objMap = _
    objDs.DisplayDataMap(geoDataMapTypeShadedArea, _
    obField, geoShowByCity, geoCombineByDefault, _
    geoRangeTypeDiscreteEqualRanges, geoRangeOrderDefault, 15)

  4. #4
    max677 is offline Junior Member White Belt
    Join Date
    Aug 2005
    Posts
    3
    I wrote geoShowbycity instead of geoShowByRegion2; anyway I have the same result.

  5. #5
    calv1ns's Avatar
    calv1ns is offline Member Green Belt
    Join Date
    Mar 2005
    Posts
    91

    DataMaps

    After a quick look max

    1) I always run the subscripts on the Fields Array from 1 to n and not 0 to n-1

    2) are you declaring your varriables? Maybe something is set by default to variant when it needs to be a specific type.

    Here is some code that does work:

    Public Sub example()

    Dim this_datamap As MapPoint.DataMap
    Dim this_field As MapPoint.Field
    Dim wk_DSs As MapPoint.DataSets
    Dim wk_ds As MapPoint.DataSet
    Dim wk_dbs As Database
    Dim wk_dsname As String
    Dim wk_fields(1 To 8, 1 To 2) As Variant

    wk_fields(1, 1) = "Name"
    wk_fields(2, 1) = "EventID"
    wk_fields(3, 1) = "wk_DateTime"
    wk_fields(4, 1) = "Latitude"
    wk_fields(5, 1) = "Longitude"
    wk_fields(6, 1) = "AVLID"
    wk_fields(7, 1) = "Speed"
    wk_fields(8, 1) = "Heading"

    wk_fields(1, 2) = geoFieldData
    wk_fields(2, 2) = geoFieldData
    wk_fields(3, 2) = geoFieldName
    wk_fields(4, 2) = geoFieldLatitude
    wk_fields(5, 2) = geoFieldLongitude
    wk_fields(6, 2) = geoFieldData
    wk_fields(7, 2) = geoFieldData
    wk_fields(8, 2) = geoFieldData
    wk_dsname = "my Truck"

    'Opens a map and sets the global myobj as a MapPoint.Map
    wk_istat2 = Open_Map("...\My Documents\test.ptm")

    Set wk_dbs = CurrentDb()

    wk_qry = wk_dbs.Name & "!avlhistory"
    Set wk_DSs = myobj.DataSets

    Set wk_ds = wk_DSs.LinkData(wk_qry, "eventid", wk_fields, geoCountryCanada, , geoImportAccessQuery)
    wk_DSs.item(1).Name = wk_dsname

    Set this_field = wk_ds.Fields.item( 8 )
    Set this_datamap = wk_ds.DisplayDataMap(geoDataMapTypeShadedArea, _
    this_field, geoShowByCensus1, geoCombineByCount, _
    geoRangeTypeDiscreteEqualRanges, geoRangeOrderDefault, 3, 4)

    End Sub

    Ciao,
    Calv1ns

  6. #6
    kiwibruce is offline Junior Member White Belt
    Join Date
    Oct 2006
    Posts
    3

    Importing Data

    Hi,
    I am trying to work with the awesome code sample you posted but there is one bit I do not understand. and that is Open_Map("...\My Documents\test.ptm")

    Is Open)Map a function you built if so can you post that or explain what sysntax you use to open a map, Thanks

    Bruce


    Quote Originally Posted by calv1ns View Post
    After a quick look max

    1) I always run the subscripts on the Fields Array from 1 to n and not 0 to n-1

    2) are you declaring your varriables? Maybe something is set by default to variant when it needs to be a specific type.

    Here is some code that does work:

    Public Sub example()

    Dim this_datamap As MapPoint.DataMap
    Dim this_field As MapPoint.Field
    Dim wk_DSs As MapPoint.DataSets
    Dim wk_ds As MapPoint.DataSet
    Dim wk_dbs As Database
    Dim wk_dsname As String
    Dim wk_fields(1 To 8, 1 To 2) As Variant

    wk_fields(1, 1) = "Name"
    wk_fields(2, 1) = "EventID"
    wk_fields(3, 1) = "wk_DateTime"
    wk_fields(4, 1) = "Latitude"
    wk_fields(5, 1) = "Longitude"
    wk_fields(6, 1) = "AVLID"
    wk_fields(7, 1) = "Speed"
    wk_fields(8, 1) = "Heading"

    wk_fields(1, 2) = geoFieldData
    wk_fields(2, 2) = geoFieldData
    wk_fields(3, 2) = geoFieldName
    wk_fields(4, 2) = geoFieldLatitude
    wk_fields(5, 2) = geoFieldLongitude
    wk_fields(6, 2) = geoFieldData
    wk_fields(7, 2) = geoFieldData
    wk_fields(8, 2) = geoFieldData
    wk_dsname = "my Truck"

    'Opens a map and sets the global myobj as a MapPoint.Map
    wk_istat2 = Open_Map("...\My Documents\test.ptm")

    Set wk_dbs = CurrentDb()

    wk_qry = wk_dbs.Name & "!avlhistory"
    Set wk_DSs = myobj.DataSets

    Set wk_ds = wk_DSs.LinkData(wk_qry, "eventid", wk_fields, geoCountryCanada, , geoImportAccessQuery)
    wk_DSs.item(1).Name = wk_dsname

    Set this_field = wk_ds.Fields.item( 8 )
    Set this_datamap = wk_ds.DisplayDataMap(geoDataMapTypeShadedArea, _
    this_field, geoShowByCensus1, geoCombineByCount, _
    geoRangeTypeDiscreteEqualRanges, geoRangeOrderDefault, 3, 4)

    End Sub

    Ciao,

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Deleting a dataset and shaded area on a map...
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 04-10-2005, 07:25 AM
  2. Adding and Removing Shaded Areas...
    By jonny0311 in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 04-06-2005, 10:44 AM
  3. Pushpin and Shaded Circle Size
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 11-19-2004, 09:23 AM
  4. Using the shaded circle map and linked data, can I....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 10-10-2001, 08:28 AM
  5. When using the shaded circles to plot a sum of net....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 09-05-2001, 07:08 AM

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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96