Quantcast
Channel: Google Summer of Code - Cezar Mocan's project
Viewing all articles
Browse latest Browse all 8

Yuppy, SHP format is rendered properly!

$
0
0

The last week was pretty full of Marble for me, and my main two targets were to implement the last (and best :) ) version of Douglas-Peucker filtering and to solve the Antarctica bug.

Douglas-Peucker works as expected, so the creation of the cache happens only once, right after opening the .KML file and lasts somewhere around 3 seconds for that Appalachian Trail line string. Zooming in, moving around the map and all these frequent operations take less than 4ms for detail levels <= 12. After 12, the times increase a little, but they are still better than for the non-filtered version.

Now, about the Antarctica bug: it was by far the hardest task I had to do for Marble until now, because, as the name says, it was a bug fix. And you never know what to expect from bug fixes. The problem was this: in the Spherical Projection, a linestring that contained Antarctica ( the most important properties of this linestring are that it is closed, that it contains the pole and that it intersects the dateline ) was rendered properly, but in the Cylindrical Projections it looked like this ( obviously wrong ):

The thing I was suggested to try was to find the southernmost dateline crossing of the linestring, and insert between those two points two another points, (-180, -90) and (180, 90), which should create the link and close the polygon properly. After adding the necessary features to the GeoDataLineString and inserting the points in AbstractProjection::crossDateLine, I had to try different ways for more than 4 days, because Antarctica didn’t seem to want to work. After noticing that those wrongly drawn points were actually not random, but points translated 360 degrees to the left / right from their correct position, I played a bit with the normalizations and managed to make the map look right:

As I am getting to the heart of my project, I received a bonus today, after trying to load the first SHP files:

They work and it looks like Antarctica is rendered properly!!! Yuppy! :)

[Later Edit]: Last night, SHP rendering didn’t work with linestring filtering, but now it does :) A toast for a faster Marble! :D



Viewing all articles
Browse latest Browse all 8

Trending Articles