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
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

add pin more quicly

This is a discussion on add pin more quicly within the Products: Pushpin Tool, Single State Mapper forums, part of the Map Forums category; Dear forum im using the mappoint 2010 ocx whit c# (but language is not important ) and many time i ...

  1. #1
    zanabonir is offline Junior Member Yellow Belt
    Join Date
    Aug 2007
    Posts
    14

    add pin more quicly

    Dear forum

    im using the mappoint 2010 ocx whit c# (but language is not important )
    and many time i must excract coordinate from db and push on map.
    Time for push 500 pin is almost 10 sec...long time to wait.

    For add a pin i do:

    MapPoint.Location location = axMappointControl1.ActiveMap.GetLocation(......)

    and

    Pushpin pin = axMappointControl1.ActiveMap.AddPushpin(location,. ....)

    Somethink better ?

    Thanks very much

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

    Re: add pin more quicly

    I don't think this can really be sped up much the way you are doing it, AddPushpin just takes a while.

    One idea though, would be that instead of adding individual pushpins, instead set up a CSV file with the coordinates and then import the CSV in one swoop using ImportData. That should actually be a lot faster?

    There were some recent articles by Richard Marsden on ImportData, take a look in the articles section
    MapPoint Articles - MP2K Magazine

    Also, see the help file.

    Let us know how it goes!

    Eric
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

  3. #3
    zanabonir is offline Junior Member Yellow Belt
    Join Date
    Aug 2007
    Posts
    14

    Re: add pin more quicly

    Thanks Mr Frost

    I try the example in the link you give me only up to the ImportData point,
    and is working.
    Then I build a file whit coordinate Latitudine and Longit inside, and try to
    use .ImportData on this file.
    I get a error "no method for thi colum" (i get in italian)

    I belive the field State e Country are mandatory (i try to alterate the Sales.txt
    and when delete this fiel i get same error)
    Of course this must be because the .ImportData metod have a Geocountry that must be specified.

    But,also if i import Latitude and Longitude (for example i can do this if i substitute in the Sales file the lat and long inthe column A-Sales and B-Sales)
    also no way to put a pushpin.
    I used the DisplayDataMap(MapPoint.GeoDataMapType.geoDataMapT ypePushpin,..

    Please help
    Roberto
    So please, if you have some

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

    Re: add pin more quicly

    Are you able to import it through the regular interface? e.g. clicking on Data | Import Data Wizard (or the Italian equivalent).

    If so, and you have no problems with this, then I would expect it's an issue with your code syntax.

    If you still have problems, it might help if you post more details:

    1. your text file
    2. your code

    Eric
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

  5. #5
    zanabonir is offline Junior Member Yellow Belt
    Join Date
    Aug 2007
    Posts
    14

    Re: add pin more quicly

    Thank Much Mr Frost

    I try to import from interface and it work...i see all the way.

    This help me also to undestand better some, and now im able to import my file.txt. also via code c#.

    Here is some line (is long some thousend):

    Country Latitudine Longitudine
    Italy 45,494583 9,184033
    Italy 45,494567 9,184
    Italy 45,494533 9,183983
    Italy 45,4945 9,18395

    Whit interface work also if italy is not present (but interface suggest me to put in first column the country)

    So now i try to visualize via code this imported data.
    Following the example you show me before, i write:

    object Lat = 2; //Position of variables
    object Lon = 3;

    object[] datafields;
    datafields = new object[2]; //Number of variabiles
    datafields[0] = DS.Fields.get_Item(ref Lat);
    datafields[1] = DS.Fields.get_Item(ref Lon);

    where 2 and 3 is position of data in file.

    So i write the code below,but some parameter i not undestand ,and so error-incorrect parameter -go out

    object[] arrayOfSymbols = new object[1];
    arrayOfSymbols[0] = (int)(218 ); //Simbol 218


    datamap = DS.DisplayDataMap(MapPoint.GeoDataMapType.geoDataM apTypeMultipleSymbol,
    datafields,
    MapPoint.GeoShowDataBy.geoShowByLatLong,
    MapPoint.GeoCombineDataBy.geoCombineByNone,
    MapPoint.GeoDataRangeType.geoRangeTypeDiscreteEqua lRanges,
    MapPoint.GeoDataRangeOrder.geoRangeOrderDefault,
    6, //COLOR
    2, //Number of variabiles
    Type.Missing,
    Type.Missing,
    Type.Missing,
    Type.Missing,
    arrayOfSymbols
    );

    many thank for time

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

    Re: add pin more quicly

    My pleasure!

    Glad you got it to work and that's awesome that you followed up with the working code to show how you did it.

    Happy coding!
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

  7. #7
    zanabonir is offline Junior Member Yellow Belt
    Join Date
    Aug 2007
    Posts
    14

    Re: add pin more quicly

    Thank Mr Frost

    please a little help again.

    I get a error when try to display data via code,and, also work arount, i cant find solution.

    Code i write is:

    Code:
     datamap = DS.DisplayDataMap(MapPoint.GeoDataMapType.geoDataMapTypeMultipleSymbol,
                                  datafields,
                                  MapPoint.GeoShowDataBy.geoShowByLatLong,
                                  MapPoint.GeoCombineDataBy.geoCombineByNone,
                                  MapPoint.GeoDataRangeType.geoRangeTypeDefault,
                                  MapPoint.GeoDataRangeOrder.geoRangeOrderDefault,
                                  6,
                                  2,
                                  Type.Missing,   //array custom value
                                  Type.Missing,  //Array di custo name
                                  Type.Missing,  //div
                                  Type.Missing,  //array di datafiellabel
                                  arrayOfSymbols
                                  );
    What parameter is wrong ?
    Many hello

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

    The parameter is incorrect

    What is the error?

    Let me guess: "The parameter is incorrect."

    MapPoint coding is generally pretty easy for any VBA programmer, some learning curve but nothing too onerous, however you have hit upon probably the most frustrating thing.

    Wouldn't it be nice if they told you which parameter? And even better, why?

    In any case, read Richard Marsden's articles (linked earlier) again, he discusses this directly. Although I mentioned they cover ImportData, the real meat of the articles is actually DisplayDataMap!

    Also, it's hard to tell what specifically is wrong with your code without

    1. the data
    2. how the arrays are defined and set up

    Let us know how it goes and if we can be of more assistance.

    Eric
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

  9. #9
    Allen is offline Junior Member White Belt
    Join Date
    Jan 2014
    Posts
    4

    Re: The parameter is incorrect

    Nice information to add pin quickly. Its really a great sharing. All posts are informative. Thank you Eric for sharing this article. I have read it.

  10. #10
    citrix_99301's Avatar
    citrix_99301 is offline Junior Member Yellow Belt
    Join Date
    Mar 2006
    Posts
    17

    Re: The parameter is incorrect

    Eric:

    I'm having a similar issue with ImportData and I'm trying to figure out what I'm missing. I can import my source CSV file (snippet below) directly into MapPoint but not through the C# COM interface. It fails on oDataSets.ImportData with an exception message "No matching method defined for these fields".

    Route,AccountKey,Latitude,Longitude
    BoLCC,331392,43.5235,-116.562
    BoLCC,13479,43.6501,-116.694
    BoLCC,303596,43.4847,-116.63
    BoLCC,340725,43.538,-116.577
    BoLCC,14279,43.4738,-116.494
    BoLCC,338142,43.6245,-116.651
    BoLCC,339044,43.5478,-116.568
    BoLCC,323043,43.572,-116.603
    BoLCC,305588,43.5346,-116.592


    The code snippet I'm using to import is below:


    // create column mappings array template
    object[,] oArray = new object[4, 2];
    oArray[0, 0] = "Name";
    oArray[0, 1] = MapPoint.GeoFieldType.geoFieldName;
    oArray[1, 0] = "AccountKey";
    oArray[1, 1] = MapPoint.GeoFieldType.geoFieldName2;
    oArray[2, 0] = "Latitude";
    oArray[2, 1] = MapPoint.GeoFieldType.geoFieldLatitude;
    oArray[3, 0] = "Longitude";
    oArray[3, 1] = MapPoint.GeoFieldType.geoFieldLatitude;



    MapPoint.Map oMap = this.axMapPoint.ActiveMap;
    MapPoint.DataSets oDataSets = oMap.DataSets;
    Object oName = (object)ImportRoutes[i].Route;
    MapPoint.DataSet oDS = oDataSets.ImportData(ImportRoutes[i].Path, oArray,
    MapPoint.GeoCountry.geoCountryUnitedStates,
    MapPoint.GeoDelimiter.geoDelimiterComma,
    GeoImportFlags.geoImportFirstRowIsHeadings);
    oDS.Symbol = MySymbolList[ ImportRoutes[i].PushPinIndex ].iID;


    Any hints would be much appreciated. If I figure it out, I'll post my solution here.

    Thanks,

    Andre Ranieri
    Last edited by citrix_99301; 01-23-2014 at 11:58 PM.

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

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