1. How can I efficiently store GPS vectors for graphical map?
- Posted by Spock Mar 17, 2011
- 2374 views
Hi,
I'm working on a map project to display a zoomable, pannable graphical road map. At the moment, to produce an image, I simply specify the viewport coordinates and then sift the entire database (just an unsorted sequence) of vectors to get only those lines which are inside the viewport. Each vector/line is composed of 2 or more GPS coordinates. The problem is that there is just so much data to be clipped and drawn that the screen can take several seconds to update at the highest zoom levels.
There are 2 basic parts to this issue:
1) How to store the vectors so that the entire database doesn't need to be sifted each time i want to redraw the current visible map
2) How to decimate visible vectors/lines at high zoom levels (otherwise the lines tend to erratically thicken, besides, there must be too much redundant drawing happening as well which I'd like to avoid)
To solve issue 1) the map could be divided up into a uniform grid where each cell is represented by a sequence containing the (database) indicies of each vector existing inside the cell's coordinate bounds. This would work but could there be another (better) way?
Each vector/line is tagged with a road significance factor. As the zoom increases, less important roads stop getting rendered but the more important roads persist for longer. At maximum zoom only major roads are visible.
TIA for any ideas, Spock
2. Re: How can I efficiently store GPS vectors for graphical map?
- Posted by javier07b9 Apr 01, 2011
- 2213 views
Hi, you need an optimized algorithm that will present on the screen vector drawing ... you manage to present it? Viewing the code to optimize it could look ...
3. Re: How can I efficiently store GPS vectors for graphical map?
- Posted by Spock Apr 02, 2011
- 2182 views
Hi, you need an optimized algorithm that will present on the screen vector drawing ... you manage to present it? Viewing the code to optimize it could look ...
Hi Javier,
Thanks for replying. I am now approaching the completion of the project. The optimization I need relates to how to efficiently store the vectors at a higher level. The line drawing part is close to as fast as it will be (I´m using Bbresenham´s integer line drawing routine algo writing directly to a Dibsection in RAM) but a compiled version should just fly along. Eventually (soon), I´ll post the code, For now I was hoping for ideas about how to store each vector (GPS) string. I sort the vectors in descending order of longitude to improve locality (ie, the vector culling inevitably required is able to focus on a subset of the entire database, improving performance) but even so there is a lot of culling required - these are the roads for an entire country, admittedly not a very big country by world standards, still...
kind regards, Spock
4. Re: How can I efficiently store GPS vectors for graphical map?
- Posted by Spock May 13, 2011
- 1840 views
Hi, you need an optimized algorithm that will present on the screen vector drawing ... you manage to present it? Viewing the code to optimize it could look ...
Hi Javier,
Thanks for replying. I am now approaching the completion of the project. The optimization I need relates to how to efficiently store the vectors at a higher level. The line drawing part is close to as fast as it will be (I´m using Bbresenham´s integer line drawing routine algo writing directly to a Dibsection in RAM) but a compiled version should just fly along. Eventually (soon), I´ll post the code, For now I was hoping for ideas about how to store each vector (GPS) string. I sort the vectors in descending order of longitude to improve locality (ie, the vector culling inevitably required is able to focus on a subset of the entire database, improving performance) but even so there is a lot of culling required - these are the roads for an entire country, admittedly not a very big country by world standards, still...
kind regards, Spock
I´ve changed my mind on this about releasing the source since the code is not fully compatible with 4.0. Besides, there´s not likely to be much demand for a custom road map of NZ in this forum. However, if anyone is genuinely interested they can contact me directly (vulcan AT_SYMBOL win POINT co PERIOD nz) to discuss the idea.
Spock