1

I want to use lidR to classify points within a point cloud using a few thematic shapefiles. This includes buildings, vegetation and cars. For this I use the classify_poi function, which works for buildings and vegetation, because there are already classes like LASBUILDING and LASHIGHVEGETATION . For the class cars, however, there is no prefabricated class (e.g. LASCAR ).

How can I create my own class, or do I have to switch to other class descriptions?

building = sf::st_read("buildings_25832.shp", quiet = TRUE)
veg = sf::st_read("veg_25832.shp", quiet = TRUE)
car = sf::st_read("car_25832.shp", quiet = TRUE)

las_class = classify_poi(las, LASBUILDING, roi = building, inverse = FALSE)
las_class = classify_poi(las_class, LASHIGHVEGETATION, roi = veg, inverse = FALSE)
las_class = classify_poi(las_class, ???, roi = car, inverse = FALSE)

1 Answer 1

2

The LASfile format is based on public specifications. The specs defines some class and their associated code (page 19 and 30) but car is not part of the standard. There is no official number for this classification.

The specifications describes how to create and document your own classes but lidR does not offer tools for that. The simplest option is to select the number of your choice and use this number as code. Let assume you chose 21 for car. Be careful:

  • 21 corresponds to nothing official and you did not write the proper information in the header to document that 21 corresponds to car so you and only you can know it that 21 = car.
  • For LAS format < 1.4 the classification is a 5 bits fields so you are limited to 32 values and 0-12 are reserved. The other values are not supposed to be user-defined but nothing prevent you of assigning the value 21 to a point. For LAS 1.4 the classification is a 8 bits fields with 64-255 that are user definable.
las_class = classify_poi(las_class, 21L, roi = car, inverse = FALSE)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.