> One note... The product I mentioned earlier in the thread wasn't the
> expensive FME, it was this free open source package:
>
> http://www.cartoweb.org/downloads/vertexsimplification/documentation....
Very interesting.
It is unclear whether it is applied to Lat/Lon coordinates or to pixel
coordinates. The use of Lat/Lon coordinates has two flaws. First,
due to the non-linear Mercator projection, a horizontal deviation
ought to be weighted differently than a vertical deviation. Also, Lat/
Lon coordinates are floating point numbers which do not compress
well. Pixels are integers which do compress well.
What I have done is very simple. I have converted every vertex from
Lat/Lon coordinates to pixel coordinates at zoom level 17. Point
reduction is based on three consecutive vertices which always form a
triangle. I compare the distances AB+BC with AC. If (AB+BC-AC) is
less than the tolerance, B is flagged to be discarded. B cannot be
discarded immediately because it is required in the next step (BC+CD-
BD).
Zoom level optimization uses the pixel representation of the points.
The first zoom level at which two points differ is the the high order
bit of the XOR (exclusive OR) of their respective X & Y pixel offsets.
var Xbits = (x[i] ^ x[i-1]) | (x[i] ^ x[i+1]);
var Ybits = (y[i] ^ y{i-1]) | (y[i] ^ y{i+1]);
for (var z=17;(XBits || Ybits);z--,Xbits>>=1,Ybits>>=1)
It ain't perfect but it is fast with decent results. It can be done
in a single pass.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---