Quantcast

Precision option added for the KML file type

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Precision option added for the KML file type

John Rasmussen
Please find the attached patch, which add a precision option for the KML file type.

When converting a file from gpx format to the kml format then the gps coordinates are written with 6 decimals in the kml file, like:
gpsbabel -i gpx -f <input-gpx> -o kml -F <output-kml>

For some gps tracks the loss in precision (6 decimals) is clearly visible in google earth.

By applying the attached patch, the nummer of decimals in the kml file can be specific, like (8 decimals).
gpsbabel -i gpx -f <input-gpx> -o kml,prec=8 -F <output-kml>

If the prec option is omitted then the default number of decimals in the kml is 6 decimals, as today.

A similar prec option is found in garmin_txt.cc and is used as inspiration.

Feel free to review, commit or reject.

------------------------------------------------------------------------------

_______________________________________________
Gpsbabel-code mailing list  http://www.gpsbabel.org
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gpsbabel-code

patch.txt (10K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Precision option added for the KML file type

Robert Lipe-4
Thanx, John.

I'll probably apply this before our next release, though I'm skeptical of its value to the masses.  (This is OK since the default doesn't change...you took exactly the approach I would have here.) We've long targeted consumer-grade equipment and formats. Six decimal places gets us 11 cm (4 inches) which is way below the threshold of any consumer grade stuff.  If you need eight, you're approaching a millimeter and there's very little impact a millimeter will have on how anything displays in Google Earth.

http://gis.stackexchange.com/questions/8650/how-to-measure-the-accuracy-of-latitude-and-longitude

This has always been a tradeoff for us - I try to not precision go unbounded just because there are so many ways to "fake" precision beyond reason and that actually makes us more sensitive to floating point issues and increasing our file sizes.  We've all seen files with coords like ' lat="36.0640833333333" lon="-86.7905166666667" - nearly half that space is just wasted.  We've not really been consistent with all our formats and we tend to mimic whatever the canonical program for any given format does over internal consistency.  For example, in the early days of GPX, Dan Foster's EasyGPS/ExpertGPS was kind of the test vehicle and we write nine points in GPX not because I think that .1mm makes sense, but because it was handy to say "we read and write EasyGPS GPX files unchanged."

So that's the back story on why we're kind of messy.  Adding knobs to let users tweak these things (perhaps you ARE measuring contintental drift per year...) seems legit.

I'll pull this in sometime over the holidays.

RJL

On Fri, Dec 18, 2015 at 3:11 PM, John Rasmussen <[hidden email]> wrote:
Please find the attached patch, which add a precision option for the KML file type.

When converting a file from gpx format to the kml format then the gps coordinates are written with 6 decimals in the kml file, like:
gpsbabel -i gpx -f <input-gpx> -o kml -F <output-kml>

For some gps tracks the loss in precision (6 decimals) is clearly visible in google earth.

By applying the attached patch, the nummer of decimals in the kml file can be specific, like (8 decimals).
gpsbabel -i gpx -f <input-gpx> -o kml,prec=8 -F <output-kml>

If the prec option is omitted then the default number of decimals in the kml is 6 decimals, as today.

A similar prec option is found in garmin_txt.cc and is used as inspiration.

Feel free to review, commit or reject.

------------------------------------------------------------------------------

_______________________________________________
Gpsbabel-code mailing list  http://www.gpsbabel.org
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gpsbabel-code



------------------------------------------------------------------------------

_______________________________________________
Gpsbabel-code mailing list  http://www.gpsbabel.org
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gpsbabel-code
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Precision option added for the KML file type

Robert Lipe-4

On Mon, Dec 21, 2015 at 3:46 PM, Robert Lipe <[hidden email]> wrote:
Thanx, John.

I'll probably apply this before our next release, though I'm skeptical of its value to the masses.  (This is OK since the default doesn't change...you took exactly the approach I would have here.) We've long targeted consumer-grade equipment and formats. Six decimal places gets us 11 cm (4 inches) which is way below the threshold of any consumer grade stuff.  If you need eight, you're approaching a millimeter and there's very little impact a millimeter will have on how anything displays in Google Earth.

http://gis.stackexchange.com/questions/8650/how-to-measure-the-accuracy-of-latitude-and-longitude

This has always been a tradeoff for us - I try to not precision go unbounded just because there are so many ways to "fake" precision beyond reason and that actually makes us more sensitive to floating point issues and increasing our file sizes.  We've all seen files with coords like ' lat="36.0640833333333" lon="-86.7905166666667" - nearly half that space is just wasted.  We've not really been consistent with all our formats and we tend to mimic whatever the canonical program for any given format does over internal consistency.  For example, in the early days of GPX, Dan Foster's EasyGPS/ExpertGPS was kind of the test vehicle and we write nine points in GPX not because I think that .1mm makes sense, but because it was handy to say "we read and write EasyGPS GPX files unchanged."

So that's the back story on why we're kind of messy.  Adding knobs to let users tweak these things (perhaps you ARE measuring contintental drift per year...) seems legit.

I'll pull this in sometime over the holidays.

RJL

On Fri, Dec 18, 2015 at 3:11 PM, John Rasmussen <[hidden email]> wrote:
Please find the attached patch, which add a precision option for the KML file type.

When converting a file from gpx format to the kml format then the gps coordinates are written with 6 decimals in the kml file, like:
gpsbabel -i gpx -f <input-gpx> -o kml -F <output-kml>

For some gps tracks the loss in precision (6 decimals) is clearly visible in google earth.

By applying the attached patch, the nummer of decimals in the kml file can be specific, like (8 decimals).
gpsbabel -i gpx -f <input-gpx> -o kml,prec=8 -F <output-kml>

If the prec option is omitted then the default number of decimals in the kml is 6 decimals, as today.

A similar prec option is found in garmin_txt.cc and is used as inspiration.

Feel free to review, commit or reject.

------------------------------------------------------------------------------

_______________________________________________
Gpsbabel-code mailing list  http://www.gpsbabel.org
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gpsbabel-code




------------------------------------------------------------------------------

_______________________________________________
Gpsbabel-code mailing list  http://www.gpsbabel.org
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gpsbabel-code
Loading...