[gdal-dev] ogr2ogr: shp > kml,
coordinate precision and related kml file size
Hermann Peifer
peifer at gmx.eu
Sun Mar 8 01:22:26 EST 2009
Hi All,
I am experimenting with establishing a web-based shapefile-to-kml converter, where ogr2ogr is doing the actual conversion job in the background. I am interested in generating small kml files, as obviously both server and clients will appreciate. After some testing I see that I could easily reduce the kml file size to about half, if I could influence the precision of the transformed coordinate values (the transformation is always to WGS84).
An example from a shp > kml conversion, including a SWEREF99 > WGS84 coordinate transformation:
<Polygon><outerBoundaryIs><LinearRing><coordinates>
13.457676473320388,55.803540172099304,-0.000071634377946 ....
</coordinates></LinearRing></outerBoundaryIs></Polygon>
Question:
In my context, Lat/Lon values with 6 decimals are just about enough precision. I feel that I am pumping a lot of meaningless numbers into the kml file, which makes it big. Is there an option to reduce the number of decimals for transformed coordinates?
Another question, which is more a wild guess:
My target SRS is EPSG:4326, in other words: a 2D CRS. However, ogr2ogr's kml file comes with height values like "-0.000071634377946". My guess is that the height coordinate is some transformation result related to the fact that WGS84 and SWEREF99 are using slightly different ellipsoids.
However, and based on my limited understanding: I do not need 3 numbers to describe a point in a 2D system, do I? How can I strip the height coordinate (and why is it there in the first place?).
Regards, Hermann
Here the SWEREF prj info from the mentioned shapefile
Layer SRS WKT:
PROJCS["SWEREF99_TM",
GEOGCS["GCS_SWEREF99",
DATUM["SWEREF99",
SPHEROID["GRS_1980",6378137.0,298.257222101]],
PRIMEM["Greenwich",0.0],
UNIT["Degree",0.0174532925199433]],
PROJECTION["Transverse_Mercator"],
PARAMETER["False_Easting",500000.0],
PARAMETER["False_Northing",0.0],
PARAMETER["Central_Meridian",15.0],
PARAMETER["Scale_Factor",0.9996],
PARAMETER["Latitude_Of_Origin",0.0],
UNIT["Meter",1.0]]
More information about the gdal-dev
mailing list