×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Dec 2012
    Posts
    1

    Alternatives for nokia.maps.map.Object.destroy() for removing Polygon from Display?

    Hi.

    I'm developing an web page / application that needs to show *thousands* of polygons on a map display. When user zooms in/out or pans the map, I need to show new polygons.

    Right now I am calling destroy() for old polygons after creating and adding the new ones, but problem is that destroy() seems to be rather expensive way to remove the polygons. Right now I go through the polygons in an array and call the destroy() method on all of them. For thousands of polygons this takes even tens of seconds (far, far too much) on Ubuntu Linux, Chrome 23.0 running on a core i5-2400 3.1ghz cpu with 3GB of memory, and it wasn't really satisfactory on a recent iMac either.

    EDIT: the real deal-breaker is the fact that this makes the browser window unresponsive.

    Is there an alternative solution for hiding the polygon from view?

  2. #2
    Regular Contributor
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    288

    Re: Alternatives for nokia.maps.map.Object.destroy() for removing Polygon from Displa

    Quote Originally Posted by tommituura View Post
    Hi.

    I'm developing an web page / application that needs to show *thousands* of polygons on a map display. When user zooms in/out or pans the map, I need to show new polygons.

    Right now I am calling destroy() for old polygons after creating and adding the new ones, but problem is that destroy() seems to be rather expensive way to remove the polygons. Right now I go through the polygons in an array and call the destroy() method on all of them. For thousands of polygons this takes even tens of seconds (far, far too much) on Ubuntu Linux, Chrome 23.0 running on a core i5-2400 3.1ghz cpu with 3GB of memory, and it wasn't really satisfactory on a recent iMac either.

    EDIT: the real deal-breaker is the fact that this makes the browser window unresponsive.

    Is there an alternative solution for hiding the polygon from view?
    Regardless of whether you destroy() your Polygons, the way you set up your question assumes that the solution involves adding and removing lots and lots of objects, which is always going to take time, and for an client side API will ultimately be reliant the browser and the speed and power of the processor on the computer. I've created a test page which adds ~7000 polygons onto the map, and its fine in Chrome, OK in Firefox and times out on IE (all on a rather pedestrian Windows PC). If you want to give a usable experience to a wider user base adding thousands of objects although technically possible isn't going to be a viable solution.

    My preferred solution in this case would be to use a server side clustering solution such as the JS example outlined here, with a HTML page implementing an AJAX call to pass viewport/zoom-level data to the server. The server could reduce the displayed data set to a more manageable number of polygons. This way at low zooms you could just give an overview or summary and high zooms just deal with a limited number of polygons. With your current un-responsive solution at low zooms the *thousands* of polygons will currently be optimized to dots when they are displayed, so you wouldn't be losing any detail.

    The other advantage of using AJAX here is that polygons could be added/removed incrementally on each call which would reduce the appearance of an unresponsive browser.

    The second alternative (if viable in your case) would be to investigate the use of an Overlay - this could be a series of images produced server side and hold all the detail you needed in a set zoom in a single Map Tile

Similar Threads

  1. Maps Polygon Opacity (and Size) in WP8
    By lfchockey in forum Windows Phone General
    Replies: 10
    Last Post: 2012-11-16, 13:53
  2. Replies: 3
    Last Post: 2012-04-20, 09:25
  3. Replies: 4
    Last Post: 2011-03-04, 11:52
  4. Is there a way to convert Maps Data from Nokia Maps 3 to be compatible with N Maps 2
    By dimchopicha in forum General Development Questions
    Replies: 6
    Last Post: 2011-01-09, 17:50
  5. how we can destroy the object
    By arumilli in forum Symbian
    Replies: 7
    Last Post: 2008-06-30, 09:57

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×