[GRASS-dev] v.in.lidar return filter

Hi,

I want to import first return points with v.in.lidar, but I get only points where the pulse had more then one return. So it gives me trees but not ground or buildings. I looked in the code and there is an ‘if’ which skips points with only 1 return:
http://trac.osgeo.org/grass/browser/grass/trunk/vector/v.in.lidar/main.c#L672

So the behavior looks intentional but what’s the reason?

Thanks,

Anna

I don’t think it was intentional to drop first and only returns, but if it is the first and only return the filter for First and Last Return would both match.
Putting another if statement in front along the lines of if(n_returns == 1) set case LAS_FIRST should fix it.

Doug

···

On Mon, Sep 22, 2014 at 6:54 PM, Anna Petrášová <kratochanna@gmail.com> wrote:

Hi,

I want to import first return points with v.in.lidar, but I get only points where the pulse had more then one return. So it gives me trees but not ground or buildings. I looked in the code and there is an ‘if’ which skips points with only 1 return:
http://trac.osgeo.org/grass/browser/grass/trunk/vector/v.in.lidar/main.c#L672

So the behavior looks intentional but what’s the reason?

Thanks,

Anna


grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Doug Newcomb
USFWS
Raleigh, NC
919-856-4520 ext. 14 doug_newcomb@fws.gov

The opinions I express are my own and are not representative of the official policy of the U.S.Fish and Wildlife Service or Dept. of the Interior. Life is too short for undocumented, proprietary data formats.

It looks like the same patch needs to be applied to r.in.lidar main.c before line 791. So modifying to the following for both v.in.lidar and r.in.lidar main.c should fix both?

if (n_returns == 1) {

switch (return_filter) {
case LAS_FIRST:
if (return_no == 1)
skipme = 0;
break;

}

if (n_returns > 1) {

switch (return_filter) {
case LAS_FIRST:
if (return_no == 1)
skipme = 0;
break;
case LAS_LAST:
if (return_no == n_returns)
skipme = 0;
break;
case LAS_MID:
if (return_no > 1 && return_no < n_returns)
skipme = 0;
break;
}

Doug

···

On Tue, Sep 23, 2014 at 8:05 AM, Newcomb, Doug <doug_newcomb@fws.gov> wrote:

I don’t think it was intentional to drop first and only returns, but if it is the first and only return the filter for First and Last Return would both match.
Putting another if statement in front along the lines of if(n_returns == 1) set case LAS_FIRST should fix it.

Doug

Doug Newcomb
USFWS
Raleigh, NC
919-856-4520 ext. 14 doug_newcomb@fws.gov

The opinions I express are my own and are not representative of the official policy of the U.S.Fish and Wildlife Service or Dept. of the Interior. Life is too short for undocumented, proprietary data formats.

On Mon, Sep 22, 2014 at 6:54 PM, Anna Petrášová <kratochanna@gmail.com> wrote:

Hi,

I want to import first return points with v.in.lidar, but I get only points where the pulse had more then one return. So it gives me trees but not ground or buildings. I looked in the code and there is an ‘if’ which skips points with only 1 return:
http://trac.osgeo.org/grass/browser/grass/trunk/vector/v.in.lidar/main.c#L672

So the behavior looks intentional but what’s the reason?

Thanks,

Anna


grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Doug Newcomb
USFWS
Raleigh, NC
919-856-4520 ext. 14 doug_newcomb@fws.gov

The opinions I express are my own and are not representative of the official policy of the U.S.Fish and Wildlife Service or Dept. of the Interior. Life is too short for undocumented, proprietary data formats.

On Tue, Sep 23, 2014 at 8:19 AM, Newcomb, Doug <doug_newcomb@fws.gov> wrote:

It looks like the same patch needs to be applied to r.in.lidar main.c
before line 791. So modifying to the following for both v.in.lidar and
r.in.lidar main.c should fix both?

if (n_returns == 1) {

switch (return_filter) {
case LAS_FIRST:
    if (return_no == 1)
skipme = 0;
    break;
              }
if (n_returns > 1) {

switch (return_filter) {
case LAS_FIRST:
    if (return_no == 1)
skipme = 0;
    break;
case LAS_LAST:
    if (return_no == n_returns)
skipme = 0;
    break;
case LAS_MID:
    if (return_no > 1 && return_no < n_returns)
skipme = 0;
    break;
}

Thanks, I rewrote it but it should be hopefully the same logic:

      switch (return_filter) {

      case LAS_FIRST:

    if (return_no == 1)

        skipme = 0;

    break;

      case LAS_MID:

    if (return_no > 1 && return_no < n_returns)

        skipme = 0;

    break;

      case LAS_LAST:

    if (n_returns > 1 && return_no == n_returns)

        skipme = 0;

    break;

Committed in r62055 and backported.

Anna

}

Doug

On Tue, Sep 23, 2014 at 8:05 AM, Newcomb, Doug <doug_newcomb@fws.gov>
wrote:

I don't think it was intentional to drop first and only returns, but if
it is the first and only return the filter for First and Last Return would
both match.
Putting another if statement in front along the lines of if(n_returns ==
1) set case LAS_FIRST should fix it.

Doug

On Mon, Sep 22, 2014 at 6:54 PM, Anna Petrášová <kratochanna@gmail.com>
wrote:

Hi,

I want to import first return points with v.in.lidar, but I get only
points where the pulse had more then one return. So it gives me trees but
not ground or buildings. I looked in the code and there is an 'if' which
skips points with only 1 return:

http://trac.osgeo.org/grass/browser/grass/trunk/vector/v.in.lidar/main.c#L672

So the behavior looks intentional but what's the reason?

Thanks,

Anna

_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

--
Doug Newcomb
USFWS
Raleigh, NC
919-856-4520 ext. 14 doug_newcomb@fws.gov

---------------------------------------------------------------------------------------------------------
The opinions I express are my own and are not representative of the
official policy of the U.S.Fish and Wildlife Service or Dept. of the
Interior. Life is too short for undocumented, proprietary data formats.

--
Doug Newcomb
USFWS
Raleigh, NC
919-856-4520 ext. 14 doug_newcomb@fws.gov

---------------------------------------------------------------------------------------------------------
The opinions I express are my own and are not representative of the
official policy of the U.S.Fish and Wildlife Service or Dept. of the
Interior. Life is too short for undocumented, proprietary data formats.

Much better :slight_smile: !

···

On Tue, Sep 23, 2014 at 11:40 AM, Anna Petrášová <kratochanna@gmail.com> wrote:

Doug Newcomb
USFWS
Raleigh, NC
919-856-4520 ext. 14 doug_newcomb@fws.gov

The opinions I express are my own and are not representative of the official policy of the U.S.Fish and Wildlife Service or Dept. of the Interior. Life is too short for undocumented, proprietary data formats.

On Tue, Sep 23, 2014 at 8:19 AM, Newcomb, Doug <doug_newcomb@fws.gov> wrote:

It looks like the same patch needs to be applied to r.in.lidar main.c before line 791. So modifying to the following for both v.in.lidar and r.in.lidar main.c should fix both?

if (n_returns == 1) {

switch (return_filter) {
case LAS_FIRST:
if (return_no == 1)
skipme = 0;
break;

}

if (n_returns > 1) {

switch (return_filter) {
case LAS_FIRST:
if (return_no == 1)
skipme = 0;
break;
case LAS_LAST:
if (return_no == n_returns)
skipme = 0;
break;
case LAS_MID:
if (return_no > 1 && return_no < n_returns)
skipme = 0;
break;
}

Thanks, I rewrote it but it should be hopefully the same logic:

	    switch (return_filter) {
	    case LAS_FIRST:
		if (return_no == 1)
		    skipme = 0;
		break;
	    case LAS_MID:
		if (return_no > 1 && return_no < n_returns)
		    skipme = 0;
		break;
	    case LAS_LAST:
		if (n_returns > 1 && return_no == n_returns)
		    skipme = 0;
		break;

Committed in r62055 and backported.

Anna

}

Doug

On Tue, Sep 23, 2014 at 8:05 AM, Newcomb, Doug <doug_newcomb@fws.gov> wrote:

I don’t think it was intentional to drop first and only returns, but if it is the first and only return the filter for First and Last Return would both match.
Putting another if statement in front along the lines of if(n_returns == 1) set case LAS_FIRST should fix it.

Doug

Doug Newcomb
USFWS
Raleigh, NC
919-856-4520 ext. 14 doug_newcomb@fws.gov

The opinions I express are my own and are not representative of the official policy of the U.S.Fish and Wildlife Service or Dept. of the Interior. Life is too short for undocumented, proprietary data formats.

On Mon, Sep 22, 2014 at 6:54 PM, Anna Petrášová <kratochanna@gmail.com> wrote:

Hi,

I want to import first return points with v.in.lidar, but I get only points where the pulse had more then one return. So it gives me trees but not ground or buildings. I looked in the code and there is an ‘if’ which skips points with only 1 return:
http://trac.osgeo.org/grass/browser/grass/trunk/vector/v.in.lidar/main.c#L672

So the behavior looks intentional but what’s the reason?

Thanks,

Anna


grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Doug Newcomb
USFWS
Raleigh, NC
919-856-4520 ext. 14 doug_newcomb@fws.gov

The opinions I express are my own and are not representative of the official policy of the U.S.Fish and Wildlife Service or Dept. of the Interior. Life is too short for undocumented, proprietary data formats.

Bringing a side conversation on testing the filtering features v.in.lidar and r.in.lidar into the dev list.

As I recall, Hamish had something similar working in r.in.xyz with regard to filtering by z value, but analyzing another variable.

Doug

(attachments)

subtracting_max_r.in.lidar_from_1st_return_dsm.png

···

On Tue, Sep 23, 2014 at 12:57 PM, Newcomb, Doug <doug_newcomb@fws.gov> wrote:

Working with a test lidar data set from NC mountains ( better quality) . Imported 2.6million points using v.in.lidar for all points . Then went back and just imported first returns. Got a reasonable number , so I’m creating a DSM from the 1st returns and will compare it to same resolution r.in.lidar for max.

Filtering by return number and processing for intensity on first, mid, and last returns seems to do a good job on contrasting coniferous vs deciduous at the top of canopy, midstory, and groundcover look interesting too!

When I tried to filter for Z value of elevation 2000-7000 ft, I got nodata on the entire layer. When I changed the Z range to 50 - 200 , I got some data with some nodata.

I’m guessing that the Z value filter is working on the intensity values instead of the Z values.

Doug

Doug Newcomb
USFWS
Raleigh, NC
919-856-4520 ext. 14 doug_newcomb@fws.gov

The opinions I express are my own and are not representative of the official policy of the U.S.Fish and Wildlife Service or Dept. of the Interior. Life is too short for undocumented, proprietary data formats.

On Tue, Sep 23, 2014 at 11:33 AM, Markus Neteler <neteler@osgeo.org> wrote:

Anna just fixed it in trunk.
Please try…

On Tue, Sep 23, 2014 at 4:51 PM, Newcomb, Doug <doug_newcomb@fws.gov> wrote:

not yet, I was just speculating from looking at the source. I will try to
compile from edits to svn this afternoon. If it works, I’ll send a diff.

Doug

On Tue, Sep 23, 2014 at 10:18 AM, Markus Neteler <neteler@osgeo.org> wrote:

Did you modify your local file? If yes, could you pls send me a diff
against SVN or the full file? Then merging is easier…

thanks
Markus

On Tue, Sep 23, 2014 at 2:19 PM, Newcomb, Doug <doug_newcomb@fws.gov>
wrote:

It looks like the same patch needs to be applied to r.in.lidar main.c
before
line 791. So modifying to the following for both v.in.lidar and
r.in.lidar
main.c should fix both?

if (n_returns == 1) {

switch (return_filter) {
case LAS_FIRST:
if (return_no == 1)
skipme = 0;
break;
}
if (n_returns > 1) {

switch (return_filter) {
case LAS_FIRST:
if (return_no == 1)
skipme = 0;
break;
case LAS_LAST:
if (return_no == n_returns)
skipme = 0;
break;
case LAS_MID:
if (return_no > 1 && return_no < n_returns)
skipme = 0;
break;
}

Doug

On Tue, Sep 23, 2014 at 8:05 AM, Newcomb, Doug <doug_newcomb@fws.gov>
wrote:

I don’t think it was intentional to drop first and only returns, but if
it
is the first and only return the filter for First and Last Return would
both
match.
Putting another if statement in front along the lines of if(n_returns

  1. set case LAS_FIRST should fix it.

Doug

On Mon, Sep 22, 2014 at 6:54 PM, Anna Petrášová <kratochanna@gmail.com>
wrote:

Hi,

I want to import first return points with v.in.lidar, but I get only
points where the pulse had more then one return. So it gives me trees
but
not ground or buildings. I looked in the code and there is an ‘if’
which
skips points with only 1 return:

http://trac.osgeo.org/grass/browser/grass/trunk/vector/v.in.lidar/main.c#L672

So the behavior looks intentional but what’s the reason?

Thanks,

Anna


grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


Doug Newcomb
USFWS
Raleigh, NC
919-856-4520 ext. 14 doug_newcomb@fws.gov


The opinions I express are my own and are not representative of the
official policy of the U.S.Fish and Wildlife Service or Dept. of the
Interior. Life is too short for undocumented, proprietary data
formats.


Doug Newcomb
USFWS
Raleigh, NC
919-856-4520 ext. 14 doug_newcomb@fws.gov


The opinions I express are my own and are not representative of the
official
policy of the U.S.Fish and Wildlife Service or Dept. of the Interior.
Life
is too short for undocumented, proprietary data formats.


grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


Doug Newcomb
USFWS
Raleigh, NC
919-856-4520 ext. 14 doug_newcomb@fws.gov

The opinions I express are my own and are not representative of the official
policy of the U.S.Fish and Wildlife Service or Dept. of the Interior. Life
is too short for undocumented, proprietary data formats.

Doug Newcomb
USFWS
Raleigh, NC
919-856-4520 ext. 14 doug_newcomb@fws.gov

The opinions I express are my own and are not representative of the official policy of the U.S.Fish and Wildlife Service or Dept. of the Interior. Life is too short for undocumented, proprietary data formats.