[pdal] Overlaying uint64 ids into las file

Howard Butler howard at hobu.co
Mon Nov 30 11:43:26 PST 2020



> On Nov 30, 2020, at 1:26 PM, Stephen Knox <stephenknox73 at gmail.com> wrote:
> 
> I have another question.
> 
> I am reading a LAS 1.2 file (laz compressed), trying to overlay it with a geopackage with 64bit integer ids, and then save it out to a LAZ again.
> 
> Full pipeline is:
> 
> [
>     "/data/input.LAZ",
>     {
>       "type":"filters.range",
>       "limits":"Classification[6:6]"
>     },
>     {
>       "type":"filters.ferry",
>       "dimensions":"=> BldId"
>      },
>     {
>       "type":"filters.overlay",
>       "dimension":"BldId",
>       "datasource":"/data/all_tiles_extract.gpkg",
>       "column":"bld_id", (gdal reads as Integer64)
>       "layer":"layer_name" 
>     },
>     {
>       "type":"filters.range",
>       "limits":"BldId[1:18446744073709551615]"
>     },
>      {
>         "type":"writers.las",
>         "filename":"/data/blds_filter_then_overlaylaz",
>         "extra_dims":"all",
>         "minor_version":4
>     }
> ]
> 
> My resulting BldId dimension has a max value of 2147483647,, which is the signed 32 bit integer max. The schema is:
> 
>       {
>         "name": "BldId",
>         "size": 8,
>         "type": "double" (or unsigned)
>       }
> 
> Things I have tried:
> - Converting the 1.2 LAZ to 1.4 before making the conversion
> - Changing the code so that default double is an unsigned int (as above)
> - Using the name of an "known" uint64 field, e.g. ShotNumber
> - reading the file with --readers.las.extra_dims=BldId=uint64
> - writing as a 1.2 LAS and using the --readers.las.use_eb_vlr=true
> - copying an existing field e.g.       
> "type":"filters.ferry",
> "dimensions":"Z=> BldId"
> 
> None of these seem to work
> 
> Can anyone help me to map 64 bit integer ids into a LAS file?

Stephen,

Looking at the code, it seems we are clamping to an int32_t when we call OGR_F_GetFieldAsInteger in the OverlayFilter code. I also 

https://github.com/PDAL/PDAL/blob/master/filters/OverlayFilter.cpp#L122 <https://github.com/PDAL/PDAL/blob/master/filters/OverlayFilter.cpp#L122>

This likely would need to be updated to use the OGR_F_GetFieldAsInteger64 method when/if it is available. Please file a ticket on this, and feel free to provide a pull request that implements such a thing.

The RangeFilter is also using a double for its comparison 

https://github.com/PDAL/PDAL/blob/master/filters/private/DimRange.cpp#L152 <https://github.com/PDAL/PDAL/blob/master/filters/private/DimRange.cpp#L152>

so I'm not sure your filters.range limits statement would always work.

Are the BldId actually in the range > 32 bits? If not, you could probably use some OGR sql to downcast them into a new column. Otherwise, some patches to PDAL are going to be needed.

Howard

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pdal/attachments/20201130/be06aa5e/attachment.html>


More information about the pdal mailing list