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

Shape Vertices slow on accessing large poly

This is a discussion on Shape Vertices slow on accessing large poly within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hey there people - Using VB6 and MapPoint 2006 here. I made sure to search the forums first before asking ...

  1. #1
    tfmiltz is offline Member Green Belt
    Join Date
    Feb 2005
    Posts
    52

    Unhappy Shape Vertices slow on accessing large poly

    Hey there people - Using VB6 and MapPoint 2006 here.

    I made sure to search the forums first before asking on this one...

    I have a large polygon - large in the sense it has some 3000 + vertice pairs of lat/lon.

    When I cycle through to get the lat/lon ? I observe it takes 2 to 3 seconds PER reference to my shape object.


    Whether I go

    MyLocation = MyShape.Vertices(n).Location

    OR simply

    MyLat = MyShape.Vertices(n).Location.Latitude

    (of course these are not the real variable names ! )

    Clearly it's that it's got over 3,000 pts in it, seems this is an ugly under the hood scenario for MP.

    My question is - anyone know WHY or WHAT I can do to remedy this ?

    I really just want to extract the lat/lon from this giant poly to persist it - as so many do in a DB.

    In my mind, ALL I want in this case is the lat/lon, and I'm surprised lat and lon are not intrinsic (I always avoid this word, throws me sometimes) - I mean, if the shape object is on a map, you'd THINK each 'point' of the poly would HAVE to already have lat/lon computed and stored in the shape object.

    SEEMS it's deriving it, and it takes 2 to 3 seconds per access to the vertices. If I have a smaller poly ? it's considerably shorter, if very small ? 10 pts ? very very quick. Somewhere in the MS code under the hood I bet it's for whatever reason evaluating the entire collection of vertice data for each reference to the shape object. Sure feels like there is some bubble sort code behind the scenes in MP on this one!

    I am also guessing it might not be that lat / lon have to be 'derived' each reference to the vertice index, BUT that the shape object has the kitchen sink and more along with it, where I JUST need to lat / lon in this case from the vertices- and I'm probably paying for all the other 'stuff' brought along intrinsic (there's that word again ! - this is where bad habits form if I start to mis-use the term, see ? now I have to ask what is extrinsic to an object - ugh!) to the shape object.

    So

    anyone have any ideas as to why ? or perhaps how I could get past this ?

    it takes over 1 hour on a pretty fast machine (I never said 'box' back in the 70's as a child, of course that was a mainframe and a hazeltine 1000 [wow - 4k onboard RAM]) to cycle through all 3,000 + pts.

    My code is via VB6.

    It's pretty much a For I=0 to ubound(oShape.Vertices)
    I call the CalcPos function so often used here, but I do observe Latitude and Longitude exposed as properties off of Shape.Vertices(i).Location.Latittude - EITHER WAY -

    just referencing oShape.Vertices(i).Location.Latitude <- costs 3 seconds, so I assign

    set oLocaton = oShape.Vertices(i).Location

    And get Lat and Lon almost immediatly from the shape object.

    Puzzling it's so costly JUST to cycle through the vertices.

    I better end this post as I seem to not know when to stop zooming in on the horizon to help others get the picture.

    Thanks in advance for any insights

    Tim Miltz
    Junior developer of some fly by night outsourcing solution that will get you project results promised in 3 days over 18 weeks !

  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: Shape Vertices slow on accessing large poly

    Hi,

    I assume that so large shape is drawn programatically. But wy do you need the lat/long pairs? Because when it is drawn programmitacly then the program already knows it.

    Maybe I do not understeand completely what you try to do?

  3. #3
    Winwaed's Avatar
    Winwaed is offline Mapping-Tools.com Black Belt
    Join Date
    Feb 2004
    Location
    Irving,Texas
    Posts
    1,859
    Blog Entries
    60

    Re: Shape Vertices slow on accessing large poly

    ----
    In my mind, ALL I want in this case is the lat/lon, and I'm surprised lat and lon are not intrinsic (I always avoid this word, throws me sometimes) - I mean, if the shape object is on a map, you'd THINK each 'point' of the poly would HAVE to already have lat/lon computed and stored in the shape object.
    ----

    They are stored in the shape object! A shape has lots of coordinates - infact a coordinate for each vertex - hence an array of vertices.

    I think you have a conceptual problem. An array of longitudes, and an array of latitudes is a very poor design. For example, vertices might be defined in other ways (street addresses). No defining an array of vertices and each vertex as a location is the proper way of doing it.


    Richard
    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. Just wondering how MapPoint knows when a poly is closed.
    By tfmiltz in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 11-22-2007, 10:53 PM
  2. Re-open Is user drawn freeform Poly Closed thread
    By tfmiltz in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 11-09-2007, 12:58 PM
  3. Custom Poly Line segment Delete trapping
    By tfmiltz in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 10-23-2007, 09:02 PM
  4. MP 2004 really slow with large custom territories
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 02-04-2004, 06:21 AM
  5. How to determine the length of Shape.vertices in Delphi?
    By schuchhardp in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 12-13-2002, 04:45 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 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127