Soap film construction problems

38 views
Skip to first unread message

Abigail Schiffmiller

unread,
May 24, 2021, 4:47:19 PM5/24/21
to distance-sampling
Hi all,

I am trying to construct a soap film for a super complex study area (Southeast Alaska) for a cetacean line transect survey DSM.

I've encountered some problems with making the soap film and using the soap_checker script:
  1.   Using the soap_check script I get an error from the boundary loop check: “Error in soap_check(bnd = survey.area, tol = 1e-06) : Boundary loop(s) 1 don’t have identical start & end points”…I think I understand what this means, but I don’t know how to fix it because:
    •  I don’t know which loop it is identifying as being open (my SpatialPolygonsDataFrame says there is only 1 polygon, but I think the ‘loop’ being identified must be one of the holes?)
    • In arcGIS the polygons all seem complete? And I don’t know where the ‘start & end points’ are or how I would edit them to be the same (in either R or arcGIS).
  2. following this document: (https://docplayer.net/188653945-Construction-of-a-border-and-internal-knots-for-the-soap-film-smoother.html) I can get a map of knots, BUT there are several points where lines radiate from which seem to invert the land/ocean and so the knots appear on islands instead of water. Maybe these origin points are what soap_check is complaining about? But soap_check only identifies one 'problem' and there are several of these points?
I'm happy to share my shapefile and script but I'm not having success attaching them to this post :/

Any ideas!?!?
Thanks!!

David Lawrence Miller

unread,
May 26, 2021, 1:53:41 AM5/26/21
to Abigail Schiffmiller, distance-sampling
Hi Abigail, hi listfolk,

I think the error is saying that it's boundary loop 1, so that should
relate to the first element of your boundary list (i.e.,
survey.area[[1]]) and what you should see is that if you look at the
first and last rows they don't match, so:

all.equal(survey.area[[1]][1,], survey.area[[1]][nrow(survey.area[[1]]),])

should tell you the difference.

One quick fix to this is to just assign


survey.area[[1]] <- rbind(survey.area[[1]],
survey.area[[1]][1,])

but it might be worth checking a bit more thoroughly to see what's going on.

Feel free to e-mail me with your script data if that doesn't help and we
can report back to the list.

cheers,
--dave

On 24/05/2021 21:47, Abigail Schiffmiller wrote:
> Hi all,
>
> I am trying to construct a soap film for a super complex study area
> (Southeast Alaska) for a cetacean line transect survey DSM.
>
> I've encountered some problems with making the soap film and using the
> soap_checker script:
>
> 1.   Using the soap_check script I get an error from the boundary loop
> check: “Error in soap_check(bnd = survey.area, tol = 1e-06) :
> Boundary loop(s) 1 don’t have identical start & end points”…I think
> I understand what this means, but I don’t know how to fix it because:
> *  I don’t know which loop it is identifying as being open (my
> SpatialPolygonsDataFrame says there is only 1 polygon, but I
> think the ‘loop’ being identified must be one of the holes?)
> * In arcGIS the polygons all seem complete? And I don’t know where
> the ‘start & end points’ are or how I would edit them to be the
> same (in either R or arcGIS).
> 2. following this document:
> (https://docplayer.net/188653945-Construction-of-a-border-and-internal-knots-for-the-soap-film-smoother.html)
> I can get a map of knots, BUT there are several points where lines
> radiate from which seem to invert the land/ocean and so the knots
> appear on islands instead of water. Maybe these origin points are
> what soap_check is complaining about? But soap_check only identifies
> one 'problem' and there are several of these points?
>
> I'm happy to share my shapefile and script but I'm not having success
> attaching them to this post :/
>
> Any ideas!?!?
> Thanks!!
>
> --
> You received this message because you are subscribed to the Google
> Groups "distance-sampling" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to distance-sampl...@googlegroups.com
> <mailto:distance-sampl...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/distance-sampling/eb5509b7-8926-4b4b-a97e-9f75139274fan%40googlegroups.com
> <https://groups.google.com/d/msgid/distance-sampling/eb5509b7-8926-4b4b-a97e-9f75139274fan%40googlegroups.com?utm_medium=email&utm_source=footer>.

Abigail Schiffmiller

unread,
May 26, 2021, 3:48:10 PM5/26/21
to David Lawrence Miller, distance-sampling
Hi David,

Thank you! That did help with the first problem, though I'm still not sure what the root cause would be. Could it be related to the CRS projection? I noticed the "mean relative difference" produced for x was ~0.063 vs. for y ~0.191. 

Also for some reason the way of specifying rows in your advice was not working (it also wasn't for the "fsb" example in the soap_check script) But I was able to work around that using this: 
all.equal(survey.area[[1]]$x[1], survey.area[[1]]$x[440])
all.equal(survey.area[[1]]$y[1], survey.area[[1]]$y[440])

However, I still have the second problem with inverted land and sea in some places! It is also easier to see with the soap_check result. So clearly these are separate issues.

here is what the area should look like:
image.png

and here is what the soap_check produces:
image.png

-Abigail 

Abigail Schiffmiller

unread,
May 26, 2021, 8:44:53 PM5/26/21
to David Lawrence Miller, distance-sampling
AhHa!! 
Spent some time thinking on this and realized the problem: that the "holes" (islands) were not read as separate objects in my script... it was just one long data frame! So, turns out if you actually follow along this script ( https://docplayer.net/188653945-Construction-of-a-border-and-internal-knots-for-the-soap-film-smoother.html  ) without skipping steps (particularly those at the bottom of pg8), it solves BOTH the problems I was having!! Who would have guessed!! :)

Thanks for your help David!!
-Abigail 

David Lawrence Miller

unread,
May 27, 2021, 3:13:12 AM5/27/21
to Abigail Schiffmiller, distance-sampling
Thanks for the update Abigail. Glad you got that sorted.

Indeed, getting the "rings" right for each part of the area is really
tricky.

In case it's useful for others in the future, I've often plotted each
element of the fsb list one at a time to check what each ring is. Though
this is a pain when you have a complicated region with many islands,
such as yours.

cheers,
--dave
> image.png
>
> and here is what the soap_check produces:
>  (https://docplayer.net/188653945-Construction-of-a-border-and-internal-knots-for-the-soap-film-smoother.html <https://docplayer.net/188653945-Construction-of-a-border-and-internal-knots-for-the-soap-film-smoother.html>)
> >     I can get a map of knots, BUT there are several points
> where lines
> >     radiate from which seem to invert the land/ocean and so
> the knots
> >     appear on islands instead of water. Maybe these origin
> points are
> >     what soap_check is complaining about? But soap_check only
> identifies
> >     one 'problem' and there are several of these points?
> >
> > I'm happy to share my shapefile and script but I'm not having
> success
> > attaching them to this post :/
> >
> > Any ideas!?!?
> > Thanks!!
> >
> > --
> > You received this message because you are subscribed to the
> Google
> > Groups "distance-sampling" group.
> > To unsubscribe from this group and stop receiving emails from
> it, send
> > an email to distance-sampl...@googlegroups.com
> <mailto:distance-sampling%2Bunsu...@googlegroups.com>
> > <mailto:distance-sampl...@googlegroups.com
> <mailto:distance-sampling%2Bunsu...@googlegroups.com>>.
> <https://groups.google.com/d/msgid/distance-sampling/eb5509b7-8926-4b4b-a97e-9f75139274fan%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/distance-sampling/eb5509b7-8926-4b4b-a97e-9f75139274fan%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "distance-sampling" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to distance-sampl...@googlegroups.com
> <mailto:distance-sampl...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/distance-sampling/CALG_jh0e8G4KwnOWVkM9xKykSL4D%2BBJq7OM8hxR-dSVBSfcHJw%40mail.gmail.com
> <https://groups.google.com/d/msgid/distance-sampling/CALG_jh0e8G4KwnOWVkM9xKykSL4D%2BBJq7OM8hxR-dSVBSfcHJw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages