Conversion from lat/long to UTM - back and forth...

493 views
Skip to first unread message

Dr. Antoine Cottin

unread,
May 13, 2014, 5:46:06 AM5/13/14
to last...@googlegroups.com, Martin Isenburg
Hello group,

I’ve some data that are in lat/long coordinates. I want to convert them in UTM coordinates, and for the purpose of the test to convert them back to latlong.
I’ve wrote a script to do this. After each conversion, it outputs file information. I also create a jpg of the elevation to have visual feed back.

Results:
Conversion from latlong -> utm 10T seems to works in term of file information, but the raster is tilted and stretch. I’ve no problem with the tilt but the stretch is more of a problem… obviously.

Then converting back to latlong -> file info shows off values… but this was expected as the utm seems off already.

Anyone has an idea of what’s going one. It’s obviously a projection issue… most likely a parameter is missing or something

Thanks.
Cheers.
Antoine

The SCRIPT

#!/bin/sh

# Original data image
/usr/local/bin/wine /Users/antoine/Compiles_Sources/lastools/bin/las2dem.exe -i /Users/antoine/Documents/Carbomap/Project/NOAA_Data/2614/q48122c1422.laz -o /Users/antoine/Documents/Carbomap/q48122c1422.jpg -step 0.0001 -elevation -latlong

# Extracting original LAZ file, display information, and make a hill shade image

/usr/local/bin/wine /Users/antoine/Compiles_Sources/lastools/bin/laszip.exe -i /Users/antoine/Documents/Carbomap/Project/NOAA_Data/2614/q48122c1422.laz -o /Users/antoine/Documents/Carbomap/unzipLAS.las
/usr/local/bin/wine /Users/antoine/Compiles_Sources/lastools/bin/lasinfo.exe /Users/antoine/Documents/Carbomap/unzipLAS.las
/usr/local/bin/wine /Users/antoine/Compiles_Sources/lastools/bin/las2dem.exe -i /Users/antoine/Documents/Carbomap/unzipLAS.las -o /Users/antoine/Documents/Carbomap/unzipLAS.jpg -step 0.0001 -elevation -latlong

# Converting LAS file to UTM 10T, display information, and make a hill shade image

/usr/local/bin/wine /Users/antoine/Compiles_Sources/lastools/bin/las2las.exe -i /Users/antoine/Documents/Carbomap/unzipLAS.las -o /Users/antoine/Documents/Carbomap/unzipLAS_utm10t.las -latlong -target_utm 10T
/usr/local/bin/wine /Users/antoine/Compiles_Sources/lastools/bin/lasinfo.exe /Users/antoine/Documents/Carbomap/unzipLAS_utm10t.las
/usr/local/bin/wine /Users/antoine/Compiles_Sources/lastools/bin/las2dem.exe -i /Users/antoine/Documents/Carbomap/unzipLAS_utm10t.las -o /Users/antoine/Documents/Carbomap/unzipLAS_utm.jpg -step 10.0 -elevation -utm 10T

# Extracting original LAZ file, display information, and make a hill shade image

/usr/local/bin/wine /Users/antoine/Compiles_Sources/lastools/bin/las2las.exe -i /Users/antoine/Documents/Carbomap/unzipLAS_utm10t.las -o /Users/antoine/Documents/Carbomap/unzipLAS_back2latlong.las -utm 10T -target_latlong
/usr/local/bin/wine /Users/antoine/Compiles_Sources/lastools/bin/lasinfo.exe /Users/antoine/Documents/Carbomap/unzipLAS_back2latlong.las
/usr/local/bin/wine /Users/antoine/Compiles_Sources/lastools/bin/las2dem.exe -i /Users/antoine/Documents/Carbomap/unzipLAS_back2latlong.las -o /Users/antoine/Documents/Carbomap/unzipLAS_back2latlong.jpg -step 0.0001 -elevation -latlong


The OUTPUTS:

Please note that LAStools is not "free" (see http://lastools.org/LICENSE.txt)
contact 'martin....@rapidlasso.com' to clarify licensing terms if needed.
using projection 'latitude/longitude'
WARNING: nbits set from 32 to 8 bits for JPG output.
WARNING: unlicensed. over 1.5 million points. inserting black diagonal.
WARNING: nbits is 8 for 32 bit elevation output.
reporting all LAS header entries:
  file signature:             'LASF'
  file source ID:             0
  global_encoding:            0
  project ID GUID data 1-4:   00000000-0000-0000-7554-616C0070696C
  version major.minor:        1.2
  system identifier:          'LAStools (c) by Martin Isenburg'
  generating software:        'las2las (version 131205)'
  file creation day/year:     270/2013
  header size:                227
  offset to point data:       387
  number var. length records: 2
  point data format:          1
  point data record length:   28
  number of point records:    13948474
  number of points by return: 10963431 2392646 592397 0 0
  scale factor x y z:         0.0000001 0.0000001 0.001
  offset x y z:               0 0 0
  min x y z:                  -122.0500000 48.2500000 27.686
  max x y z:                  -122.0374999 48.2624999 222.638

variable length header record 1 of 2:
  reserved             43707
  user ID              'NOAA_CSC'
  record ID            129
  length after header  2
  description          'Sort Order'
variable length header record 2 of 2:
  reserved             43707
  user ID              'LASF_Projection'
  record ID            34735
  length after header  48
  description          'Projection Parameters'
    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 4269 - GeographicTypeGeoKey: GCS_NAD83
      key 2054 tiff_tag_location 0 count 1 value_offset 9102 - GeogAngularUnitsGeoKey: Angular_Degree
      key 4096 tiff_tag_location 0 count 1 value_offset 5103 - VerticalCSTypeGeoKey: VertCS_North_American_Vertical_Datum_1988
      key 4099 tiff_tag_location 0 count 1 value_offset 9001 - VerticalUnitsGeoKey: Linear_Meter

the header is followed by 2 user-defined bytes
reporting minimum and maximum for all LAS point record entries ...
  X          -1220500000 -1220374999
  Y           482500000  482624999
  Z               27686     222638
  intensity           1        254
  return_number       1          3
  number_of_returns   1          4
  edge_of_flight_line 0          0
  scan_direction_flag 0          1
  classification      1          2
  scan_angle_rank   -17         21
  user_data         116        159
  point_source_ID    46        463
  gps_time 351793.412092 495220.868264
overview over number of returns of given pulse: 8364569 3689118 1697400 197387 0 0 0
histogram of classification of points:
        11417557  unclassified (1)
         2530917  ground (2)
Please note that LAStools is not "free" (see http://lastools.org/LICENSE.txt)
contact 'martin....@rapidlasso.com' to clarify licensing terms if needed.
using projection 'latitude/longitude'
WARNING: nbits set from 32 to 8 bits for JPG output.
WARNING: unlicensed. over 1.5 million points. inserting black diagonal.
WARNING: nbits is 8 for 32 bit elevation output.
using projection 'latitude/longitude'
using target projection UTM 'UTM 10 northern hemisphere'
reporting all LAS header entries:
  file signature:             'LASF'
  file source ID:             0
  global_encoding:            0
  project ID GUID data 1-4:   00000000-0000-0000-7554-616C0070696C
  version major.minor:        1.2
  system identifier:          'LAStools (c) by rapidlasso GmbH'
  generating software:        'las2las (version 140403)'
  file creation day/year:     270/2013
  header size:                227
  offset to point data:       379
  number var. length records: 2
  point data format:          1
  point data record length:   28
  number of point records:    13948474
  number of points by return: 10963431 2392646 592397 0 0
  scale factor x y z:         0.01 0.01 0.001
  offset x y z:               15400000 -2500000 0
  min x y z:                  15471378.37 -2519073.63 27.686
  max x y z:                  15486836.81 -2500614.16 222.638

variable length header record 1 of 2:
  reserved             43707
  user ID              'NOAA_CSC'
  record ID            129
  length after header  2
  description          'Sort Order'
variable length header record 2 of 2:
  reserved             43707
  user ID              'LASF_Projection'
  record ID            34735
  length after header  40
  description          'by LAStools of rapidlasso GmbH'
    GeoKeyDirectoryTag version 1.1.0 number of keys 4
      key 1024 tiff_tag_location 0 count 1 value_offset 1 - GTModelTypeGeoKey: ModelTypeProjected
      key 3072 tiff_tag_location 0 count 1 value_offset 32610 - ProjectedCSTypeGeoKey: UTM 10 northern hemisphere
      key 3076 tiff_tag_location 0 count 1 value_offset 9001 - ProjLinearUnitsGeoKey: Linear_Meter
      key 4099 tiff_tag_location 0 count 1 value_offset 9001 - VerticalUnitsGeoKey: Linear_Meter

the header is followed by 2 user-defined bytes
reporting minimum and maximum for all LAS point record entries ...
  X             7137837    8683681
  Y            -1907363     -61416
  Z               27686     222638
  intensity           1        254
  return_number       1          3
  number_of_returns   1          4
  edge_of_flight_line 0          0
  scan_direction_flag 0          1
  classification      1          2
  scan_angle_rank   -17         21
  user_data         116        159
  point_source_ID    46        463
  gps_time 351793.412092 495220.868264
overview over number of returns of given pulse: 8364569 3689118 1697400 197387 0 0 0
histogram of classification of points:
        11417557  unclassified (1)
         2530917  ground (2)
Please note that LAStools is not "free" (see http://lastools.org/LICENSE.txt)
contact 'martin....@rapidlasso.com' to clarify licensing terms if needed.
using projection UTM 'UTM 10 northern hemisphere'
WARNING: nbits set from 32 to 8 bits for JPG output.
WARNING: unlicensed. over 1.5 million points. inserting black diagonal.
WARNING: nbits is 8 for 32 bit elevation output.
using projection UTM 'UTM 10 northern hemisphere'
using target projection 'latitude/longitude'
reporting all LAS header entries:
  file signature:             'LASF'
  file source ID:             0
  global_encoding:            0
  project ID GUID data 1-4:   00000000-0000-0000-7554-616C0070696C
  version major.minor:        1.2
  system identifier:          'LAStools (c) by rapidlasso GmbH'
  generating software:        'las2las (version 140403)'
  file creation day/year:     270/2013
  header size:                227
  offset to point data:       371
  number var. length records: 2
  point data format:          1
  point data record length:   28
  number of point records:    13948474
  number of points by return: 10963431 2392646 592397 0 0
  scale factor x y z:         0.0000001 0.0000001 0.001
  offset x y z:               313 235 0
  min x y z:                  311.7343452 233.9021617 27.686
  max x y z:                  315.6403401 237.3547134 222.638

variable length header record 1 of 2:
  reserved             43707
  user ID              'NOAA_CSC'
  record ID            129
  length after header  2
  description          'Sort Order'
variable length header record 2 of 2:
  reserved             43707
  user ID              'LASF_Projection'
  record ID            34735
  length after header  32
  description          'by LAStools of rapidlasso GmbH'
    GeoKeyDirectoryTag version 1.1.0 number of keys 3
      key 1024 tiff_tag_location 0 count 1 value_offset 2 - GTModelTypeGeoKey: ModelTypeGeographic
      key 2048 tiff_tag_location 0 count 1 value_offset 4326 - GeographicTypeGeoKey: GCS_WGS_84
      key 4099 tiff_tag_location 0 count 1 value_offset 9001 - VerticalUnitsGeoKey: Linear_Meter

the header is followed by 2 user-defined bytes
reporting minimum and maximum for all LAS point record entries ...
  X           -12656548   26403401
  Y           -10978383   23547134
  Z               27686     222638
  intensity           1        254
  return_number       1          3
  number_of_returns   1          4
  edge_of_flight_line 0          0
  scan_direction_flag 0          1
  classification      1          2
  scan_angle_rank   -17         21
  user_data         116        159
  point_source_ID    46        463
  gps_time 351793.412092 495220.868264
overview over number of returns of given pulse: 8364569 3689118 1697400 197387 0 0 0
histogram of classification of points:
        11417557  unclassified (1)
         2530917  ground (2)
Please note that LAStools is not "free" (see http://lastools.org/LICENSE.txt)
contact 'martin....@rapidlasso.com' to clarify licensing terms if needed.
using projection 'latitude/longitude'
WARNING: nbits set from 32 to 8 bits for JPG output.
WARNING: unlicensed. over 1.5 million points. inserting black diagonal.
WARNING: nbits is 8 for 32 bit elevation output.
WARNING: there were 22 duplicate rasters

-------------------
Dr Antoine Cottin
Senior Software Developer/Analyst
Carbomap Ltd
7th Floor, Appleton Tower
11 Crichton Street
Edinburgh
EH8 9LE
http://www.carbomap.com

Kirk Waters - NOAA Federal

unread,
May 13, 2014, 8:56:52 AM5/13/14
to last...@googlegroups.com, Martin Isenburg
Antoine,
I took that same file (ftp://ftp.csc.noaa.gov/pub/DigitalCoast/lidar1_z/geoid12a/data/2614/q48122c1422.laz) and tried it out. I see the same thing you do using those commands. However, we also have another program we use to do the projections and vertical datum transformations. If I use that program instead of las2las instead, things look right. There is only a slight twist when you go to UTM and there is more of an x direction squishing than a stretching. The return trip has lasinfo outputs with:
reporting minimum and maximum for all LAS point record entries ...
  X          -1220500001 -1220374999
  Y           482499999  482624998
  Z               27685     222638
which look like the expected rounding errors from the original. I'm thinking there is a problem somewhere with the arguments going into las2las, though what you've got looks like one of the help examples. The range of values I get for the utm version of the tile are:
reporting minimum and maximum for all LAS point record entries ...
  X            57050518   57145020
  Y           534452351  534592436
  Z               27685     222638
with scale factor x y z:         0.01 0.01 0.001
Attached are the three images as I think they should look.Inline image 1Inline image 2Inline image 3




Kirk Waters, PhD                     | NOAA Coastal Services Center
Applied Sciences Program       | 2234 South Hobson Ave
843-740-1227                          | Charleston, SC 29405    


Dr. Antoine Cottin

unread,
May 13, 2014, 10:30:14 AM5/13/14
to last...@googlegroups.com, Martin Isenburg
Kirk,

Thanks for the answer. Is the NOAA program (I presume) you used available ?

Martin any comment on this?

Cheers.
Antoine

-------------------
Dr Antoine Cottin
Senior Software Developer/Analyst
Carbomap Ltd
7th Floor, Appleton Tower
11 Crichton Street
Edinburgh
EH8 9LE
http://www.carbomap.com

On 13 May 2014, at 13:56, Kirk Waters - NOAA Federal <kirk....@noaa.gov> wrote:

Antoine,
I took that same file (ftp://ftp.csc.noaa.gov/pub/DigitalCoast/lidar1_z/geoid12a/data/2614/q48122c1422.laz) and tried it out. I see the same thing you do using those commands. However, we also have another program we use to do the projections and vertical datum transformations. If I use that program instead of las2las instead, things look right. There is only a slight twist when you go to UTM and there is more of an x direction squishing than a stretching. The return trip has lasinfo outputs with:
reporting minimum and maximum for all LAS point record entries ...
  X          -1220500001 -1220374999
  Y           482499999  482624998
  Z               27685     222638
which look like the expected rounding errors from the original. I'm thinking there is a problem somewhere with the arguments going into las2las, though what you've got looks like one of the help examples. The range of values I get for the utm version of the tile are:
reporting minimum and maximum for all LAS point record entries ...
  X            57050518   57145020
  Y           534452351  534592436
  Z               27685     222638
with scale factor x y z:         0.01 0.01 0.001
Attached are the three images as I think they should look.<orig.jpg><utm.jpg><back.jpg>



<unzipLAS_utm.jpeg><unzipLAS.jpg><q48122c1422.jpg>
Reply all
Reply to author
Forward
0 new messages