How Many Decimal Digits for Storing Longitude and Latitude?

6,109 views
Skip to first unread message

Martin Isenburg

unread,
May 8, 2019, 12:42:39 PM5/8/19
to LAStools - efficient command line tools for LIDAR processing
Hello,

Seeing a German GeoJSON file containing longitude and latitude coordinates with 15 decimal digits inspired this blog post about resolution and accuracy.


Summary: 7 digits are sufficient to store coordinates with centimeter accuracy and 8 digits are enough to store coordinates with millimeter accuracy. Additional digits right of the decimal point will lead to micrometer or nanometer accuracy, which is not relevant in most geospatial applications.

Regards,

longitude_latitude_required_digits.png

Martin Isenburg

unread,
May 8, 2019, 3:06:51 PM5/8/19
to LAStools - efficient command line tools for LIDAR processing
Hello,

I ran those experiments with the latest version of LAStools. It requires some trickery to preserve those 15 decimal digits when working with the LAS format. Below is the sequence of command lines that I have used. At the very end of this email is the output that I have compiled into this blog article. Attached is the file longlat.txt with the one longitude latitude coordinate used. It seems the 15 decimal digits originate as this is the default used in the most popular implementation for writing GeoJSON files, where our blog post has started a discussion that you can follow if this topic interest you further:

https://lists.osgeo.org/pipermail/postgis-devel/2019-May/  

txt2las -version
las2las -version
las2txt -version

txt2las -i longlat.txt -longlat -set_scale 0.00001 0.00001 0.01 -set_offset 10.04957 53.46277 0 -parse xyz -odix _05
txt2las -i longlat.txt -longlat -set_scale 0.000001 0.000001 0.01 -set_offset 10.049568 53.462767 0 -parse xyz -odix _06
txt2las -i longlat.txt -longlat -set_scale 0.0000001 0.0000001 0.01 -set_offset 10.049568 53.462767 0 -parse xyz -odix _07
txt2las -i longlat.txt -longlat -set_scale 0.00000001 0.00000001 0.01 -set_offset 10.049568 53.462767 0 -parse xyz -odix _08
txt2las -i longlat.txt -longlat -set_scale 0.000000001 0.000000001 0.01 -set_offset 10.049568 53.462767 0 -parse xyz -odix _09
txt2las -i longlat.txt -longlat -set_scale 0.0000000001 0.0000000001 0.01 -set_offset 10.0495679887 53.4627667595 0 -parse xyz -odix _10
txt2las -i longlat.txt -longlat -set_scale 0.00000000001 0.00000000001 0.01 -set_offset 10.0495679887 53.4627667595 0 -parse xyz -odix _11
txt2las -i longlat.txt -longlat -set_scale 0.000000000001 0.000000000001 0.01 -set_offset 10.0495679887 53.4627667595 0 -parse xyz -odix _12
txt2las -i longlat.txt -longlat -set_scale 0.0000000000001 0.0000000000001 0.01 -set_offset 10.0495679887 53.4627667595 0 -parse xyz -odix _13
txt2las -i longlat.txt -longlat -set_scale 0.00000000000001 0.00000000000001 0.01 -set_offset 10.0495679887 53.4627667595 0 -parse xyz -odix _14
txt2las -i longlat.txt -longlat -set_scale 0.000000000000001 0.000000000000001 0.01 -set_offset 10.0495679887 53.4627667595 0 -parse xyz -odix _15

las2txt -i longlat_05.las -stdout
las2txt -i longlat_06.las -stdout
las2txt -i longlat_07.las -stdout
las2txt -i longlat_08.las -stdout
las2txt -i longlat_09.las -stdout
las2txt -i longlat_10.las -stdout
las2txt -i longlat_11.las -stdout
las2txt -i longlat_12.las -stdout
las2txt -i longlat_13.las -stdout
las2txt -i longlat_14.las -stdout
las2txt -i longlat_15.las -stdout

las2las -i longlat_05.las -target_utm auto -target_precision 0.000000001 -odix _utm -olas
las2las -i longlat_06.las -target_utm auto -target_precision 0.000000001 -odix _utm -olas
las2las -i longlat_07.las -target_utm auto -target_precision 0.000000001 -odix _utm -olas
las2las -i longlat_08.las -target_utm auto -target_precision 0.000000001 -odix _utm -olas
las2las -i longlat_09.las -target_utm auto -target_precision 0.000000001 -odix _utm -olas
las2las -i longlat_10.las -target_utm auto -target_precision 0.000000001 -odix _utm -olas
las2las -i longlat_11.las -target_utm auto -target_precision 0.000000001 -odix _utm -olas
las2las -i longlat_12.las -target_utm auto -target_precision 0.000000001 -odix _utm -olas
las2las -i longlat_13.las -target_utm auto -target_precision 0.000000001 -odix _utm -olas
las2las -i longlat_14.las -target_utm auto -target_precision 0.000000001 -odix _utm -olas
las2las -i longlat_15.las -target_utm auto -target_precision 0.000000001 -odix _utm -olas

las2txt -i longlat_05_utm.las -stdout
las2txt -i longlat_06_utm.las -stdout
las2txt -i longlat_07_utm.las -stdout
las2txt -i longlat_08_utm.las -stdout
las2txt -i longlat_09_utm.las -stdout
las2txt -i longlat_10_utm.las -stdout
las2txt -i longlat_11_utm.las -stdout
las2txt -i longlat_12_utm.las -stdout
las2txt -i longlat_13_utm.las -stdout
las2txt -i longlat_14_utm.las -stdout
las2txt -i longlat_15_utm.las -stdout

================================

C:\software\LAStools\bin>txt2las -version
LAStools (by mar...@rapidlasso.com) version 190507

C:\software\LAStools\bin>las2las -version
LAStools (by mar...@rapidlasso.com) version 190507

C:\software\LAStools\bin>las2txt -version
LAStools (by mar...@rapidlasso.com) version 190507



C:\software\LAStools\bin>txt2las -i longlat.txt -longlat -set_scale 0.00001 0.00001 0.01 -set_offset 10.04957 53.46277 0 -parse xyz -odix _05
done with 'longlat_05.las'. total time 0.009 sec.

C:\software\LAStools\bin>txt2las -i longlat.txt -longlat -set_scale 0.000001 0.000001 0.01 -set_offset 10.049568 53.462767 0 -parse xyz -odix _06
done with 'longlat_06.las'. total time 0.006 sec.

C:\software\LAStools\bin>txt2las -i longlat.txt -longlat -set_scale 0.0000001 0.0000001 0.01 -set_offset 10.049568 53.462767 0 -parse xyz -odix _07
done with 'longlat_07.las'. total time 0.005 sec.

C:\software\LAStools\bin>txt2las -i longlat.txt -longlat -set_scale 0.00000001 0.00000001 0.01 -set_offset 10.049568 53.462767 0 -parse xyz -odix _08
done with 'longlat_08.las'. total time 0.005 sec.

C:\software\LAStools\bin>txt2las -i longlat.txt -longlat -set_scale 0.000000001 0.000000001 0.01 -set_offset 10.049568 53.462767 0 -parse xyz -odix _09
done with 'longlat_09.las'. total time 0.006 sec.

C:\software\LAStools\bin>txt2las -i longlat.txt -longlat -set_scale 0.0000000001 0.0000000001 0.01 -set_offset 10.0495679887 53.4627667595 0 -parse xyz -odix _10
done with 'longlat_10.las'. total time 0.006 sec.

C:\software\LAStools\bin>txt2las -i longlat.txt -longlat -set_scale 0.00000000001 0.00000000001 0.01 -set_offset 10.0495679887 53.4627667595 0 -parse xyz -odix _11
done with 'longlat_11.las'. total time 0.005 sec.

C:\software\LAStools\bin>txt2las -i longlat.txt -longlat -set_scale 0.000000000001 0.000000000001 0.01 -set_offset 10.0495679887 53.4627667595 0 -parse xyz -odix _12
done with 'longlat_12.las'. total time 0.005 sec.

C:\software\LAStools\bin>txt2las -i longlat.txt -longlat -set_scale 0.0000000000001 0.0000000000001 0.01 -set_offset 10.0495679887 53.4627667595 0 -parse xyz -odix _13
done with 'longlat_13.las'. total time 0.006 sec.

C:\software\LAStools\bin>txt2las -i longlat.txt -longlat -set_scale 0.00000000000001 0.00000000000001 0.01 -set_offset 10.0495679887 53.4627667595 0 -parse xyz -odix _14
done with 'longlat_14.las'. total time 0.005 sec.

C:\software\LAStools\bin>txt2las -i longlat.txt -longlat -set_scale 0.000000000000001 0.000000000000001 0.01 -set_offset 10.0495679887 53.4627667595 0 -parse xyz -odix _15
done with 'longlat_15.las'. total time 0.005 sec.



C:\software\LAStools\bin>las2txt -i longlat_05.las -stdout
10.04957 53.46277 0.00

C:\software\LAStools\bin>las2txt -i longlat_06.las -stdout
10.049568 53.462767 0.00

C:\software\LAStools\bin>las2txt -i longlat_07.las -stdout
10.0495680 53.4627668 0.00

C:\software\LAStools\bin>las2txt -i longlat_08.las -stdout
10.04956799 53.46276676 0.00

C:\software\LAStools\bin>las2txt -i longlat_09.las -stdout
10.049567989 53.462766760 0.00

C:\software\LAStools\bin>las2txt -i longlat_10.las -stdout
10.0495679888 53.4627667596 0.00

C:\software\LAStools\bin>las2txt -i longlat_11.las -stdout
10.04956798876 53.46276675958 0.00

C:\software\LAStools\bin>las2txt -i longlat_12.las -stdout
10.049567988756 53.462766759577 0.00

C:\software\LAStools\bin>las2txt -i longlat_13.las -stdout
10.0495679887555 53.4627667595771 0.00

C:\software\LAStools\bin>las2txt -i longlat_14.las -stdout
10.04956798875553 53.46276675957706 0.00

C:\software\LAStools\bin>las2txt -i longlat_15.las -stdout
10.049567988755534 53.462766759577057 0.00



C:\software\LAStools\bin>las2las -i longlat_05.las -target_utm auto -target_precision 0.000000001 -odix _utm -olas

C:\software\LAStools\bin>las2las -i longlat_06.las -target_utm auto -target_precision 0.000000001 -odix _utm -olas

C:\software\LAStools\bin>las2las -i longlat_07.las -target_utm auto -target_precision 0.000000001 -odix _utm -olas

C:\software\LAStools\bin>las2las -i longlat_08.las -target_utm auto -target_precision 0.000000001 -odix _utm -olas

C:\software\LAStools\bin>las2las -i longlat_09.las -target_utm auto -target_precision 0.000000001 -odix _utm -olas

C:\software\LAStools\bin>las2las -i longlat_10.las -target_utm auto -target_precision 0.000000001 -odix _utm -olas

C:\software\LAStools\bin>las2las -i longlat_11.las -target_utm auto -target_precision 0.000000001 -odix _utm -olas

C:\software\LAStools\bin>las2las -i longlat_12.las -target_utm auto -target_precision 0.000000001 -odix _utm -olas

C:\software\LAStools\bin>las2las -i longlat_13.las -target_utm auto -target_precision 0.000000001 -odix _utm -olas

C:\software\LAStools\bin>las2las -i longlat_14.las -target_utm auto -target_precision 0.000000001 -odix _utm -olas

C:\software\LAStools\bin>las2las -i longlat_15.las -target_utm auto -target_precision 0.000000001 -odix _utm -olas



C:\software\LAStools\bin>las2txt -i longlat_05_utm.las -stdout
569680.457214242 5924264.702096907 0.00

C:\software\LAStools\bin>las2txt -i longlat_06_utm.las -stdout
569680.329352063 5924264.366407392 0.00

C:\software\LAStools\bin>las2txt -i longlat_07_utm.las -stdout
569680.329679567 5924264.344158387 0.00

C:\software\LAStools\bin>las2txt -i longlat_08_utm.las -stdout
569680.329081195 5924264.339698814 0.00

C:\software\LAStools\bin>las2txt -i longlat_09_utm.las -stdout
569680.329014807 5924264.339697836 0.00

C:\software\LAStools\bin>las2txt -i longlat_10_utm.las -stdout
569680.329002184 5924264.339653142 0.00

C:\software\LAStools\bin>las2txt -i longlat_11_utm.las -stdout
569680.328999562 5924264.339650878 0.00

C:\software\LAStools\bin>las2txt -i longlat_12_utm.las -stdout
569680.328999301 5924264.339650541 0.00

C:\software\LAStools\bin>las2txt -i longlat_13_utm.las -stdout
569680.328999269 5924264.339650553 0.00

C:\software\LAStools\bin>las2txt -i longlat_14_utm.las -stdout
569680.328999271 5924264.339650547 0.00

C:\software\LAStools\bin>las2txt -i longlat_15_utm.las -stdout
569680.328999271 5924264.339650547 0.00

longlat.txt

Alejandro Hinojosa

unread,
May 9, 2019, 1:41:03 PM5/9/19
to last...@googlegroups.com
Hi Martin,

Is there a trick to view clouds on lon, lat, meter coordinates in  lasview, that is besides projecting them first? When I try to view them, nothing happens, no view at all.

The data has your scaling recommendations  0.0000001 0.0000001 0.01

This is the output from lasinfo of the dataset

reporting all LAS header entries:
  file signature:             'LASF'
  file source ID:             65535
  global_encoding:            1
  project ID GUID data 1-4:   BE247654-B7E9-49A2-5683-A63F15551DB4
  version major.minor:        1.2
  system identifier:          'NOAA OCM'
  generating software:        'datum_shift (9793 2018-07-10)'
  file creation day/year:     254/2015
  header size:                227
  offset to point data:       331
  number var. length records: 1
  point data format:          1
  point data record length:   28
  number of point records:    10522770
  number of points by return: 8691342 1452763 312527 66138 0
  scale factor x y z:         0.0000001 0.0000001 0.01
  offset x y z:               -117 32 0
  min x y z:                  -117.0989607 32.5198761 30.49
  max x y z:                  -117.0826112 32.5337277 1070.01
variable length header record 1 of 1:
  reserved             0
  user ID              'LASF_Projection'
  record ID            34735
  length after header  48
  description          'LAS Georeferencing'
    GeoKeyDirectoryTag version 1.1.0 number of keys 5
      key 1024 tiff_tag_location 0 count 1 value_offset 2 - GTModelTypeGeoKey: ModelTypeGeographic
      key 2048 tiff_tag_location 0 count 1 value_offset 4759 - GeographicTypeGeoKey: look-up for 4759 not implemented
      key 2054 tiff_tag_location 0 count 1 value_offset 9102 - GeogAngularUnitsGeoKey: Angular_Degree
      key 4096 tiff_tag_location 0 count 1 value_offset 5703 - VerticalCSTypeGeoKey: NAVD88 height (Reserved EPSG)
      key 4099 tiff_tag_location 0 count 1 value_offset 9001 - VerticalUnitsGeoKey: Linear_Meter
the header is followed by 2 user-defined bytes
LASzip compression (version 3.2r4 c2 50000): POINT10 2 GPSTIME11 2
reporting minimum and maximum for all LAS point record entries ...
  X             -989607    -826112
  Y             5198761    5337277
  Z                3049     107001
  intensity          16      65408
  return_number       1          4
  number_of_returns   1          4
  edge_of_flight_line 0          1
  scan_direction_flag 0          1
  classification      1         22
  scan_angle_rank   -15         15
  user_data           0          0
  point_source_ID   423        614
  gps_time 100936561.333336 103840942.936343
number of first returns:        8691342
number of intermediate returns: 378735
number of last returns:         8690841
number of single returns:       7238148
overview over number of returns of given pulse: 7238148 2280725 739266 264631 0 0 0
histogram of classification of points:
         2659704  unclassified (1)
         3430978  ground (2)
            4195  noise (7)
            1962  bridge deck (17)
         2106042  Reserved for ASPRS Definition (21)
         2319889  Reserved for ASPRS Definition (22)


This is data from a  NOAA for elevation resource. The data I am looking at is a tile  from  the dataset 


One of the tiles I am looking at is


Thanks 

--
Download LAStools at
http://lastools.org
http://rapidlasso.com
Be social with LAStools at
http://facebook.com/LAStools
http://twitter.com/LAStools
http://linkedin.com/groups/LAStools-4408378
Manage your settings at
http://groups.google.com/group/lastools/subscribe
---
You received this message because you are subscribed to the Google Groups "LAStools - efficient tools for LiDAR processing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lastools+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lastools/CABSWR-H8CkzT5MPz6ybVC58kb7DO7GbRp%2BWNtu0F0CXNvnmzzQ%40mail.gmail.com.


--
Alejandro Hinojosa
CICESE

Martin Isenburg

unread,
May 9, 2019, 2:23:54 PM5/9/19
to LAStools - efficient command line tools for LIDAR processing
Hello Alejandro,

indeed this is not well documented. For what is called "adaptive Z-scaling" there is a hot key:
<A>     toggle adaptive Z-scaling on/off <SHIFT>+<a>
https://lastools.github.io/download/lasview_README.txt

and I think this option is also available via the pop-up menu. Maybe lasview should switch to "adaptive Z-scaling" automatically for longlat or latlong content. That'll be something to add to a future version.

Regards.

Martin @rapidlasso

Reply all
Reply to author
Forward
0 new messages