Mask using shapefile

questions concerning anlysis/theory using program DENSITY and R package secr. Focus on spatially-explicit analysis.

Mask using shapefile

Postby Prashant_mahajan » Sat Jan 25, 2025 6:32 pm

I am attempting to use a shapefile as a mask, where the boundary around the detectors is defined with a hard boundary on either side, and a river/stream runs in between. However, I’m facing an issue where I can’t use the exact shapefile when applying a buffer of a certain width. Without the buffer, the mask only includes the detector locations as points and excludes other available habitats where detectors were not placed.

I am using the following code:

mask.2021 <- make.mask(traps(coy.cap2021), spacing = 100,
type = "trapbuffer", poly = area)

In this case, area refers to the shapefile, which contains the desired buffer and excludes the non-habitats.

Could you help me understand what I might be missing and how to use the exact shapefile for further analysis?

Thank you!
Prashant_mahajan
 
Posts: 30
Joined: Wed Mar 31, 2021 11:14 am

Re: Mask using shapefile

Postby murray.efford » Sat Jan 25, 2025 7:29 pm

Hello
I suspect you have omitted to specify the 'buffer' argument. By default that is 100 m, which is probably much too small for leopards, tigers or whatever you are working on. The poly argument is used to clip the buffered region; it doesn't define the mask on its own.
Murray
murray.efford
 
Posts: 712
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand

Re: Mask using shapefile

Postby Prashant_mahajan » Sat Jan 25, 2025 8:24 pm

Hi,

Thank you for your response. I tried specifying a buffer of 3000, but the resulting mask does not match the desired outcome. Instead of showing the shapefile with gaps and a hard boundary, it is producing a continuous mask that extends beyond the shapefile without any gaps.

How can I obtain a mask that exactly matches my shapefile? I have already included the desired buffer within the shapefile.

Thank you!
Prashant_mahajan
 
Posts: 30
Joined: Wed Mar 31, 2021 11:14 am

Re: Mask using shapefile

Postby murray.efford » Sat Jan 25, 2025 8:29 pm

There's something screwy here. Perhaps the projections or scales of your trap file and shapefile do not match. Can you plot one over the other and show us a picture?
murray.efford
 
Posts: 712
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand

Re: Mask using shapefile

Postby Prashant_mahajan » Sat Jan 25, 2025 9:28 pm

I had unmatched projections, but after correcting for projections also it's not showing the desired results.

Here are the images for the traps over the study area and traps over the buffer:

https://drive.google.com/file/d/1E_-XqL ... drive_link
https://drive.google.com/file/d/1YMqpRK ... drive_link

Thanks.
Prashant_mahajan
 
Posts: 30
Joined: Wed Mar 31, 2021 11:14 am

Re: Mask using shapefile

Postby murray.efford » Mon Jan 27, 2025 12:11 am

[For some unknown reason my reply yesterday was rejected by the microsoft or the phidot system - here it is again]

Is the shapefile a polygon shapefile? Lines aren't enough. Have you tried switching poly.habitat in case this is a negative habitat map? If you have exhausted all the possibilities then send the data to me offline and I'll sort it out.
Murray
murray.efford
 
Posts: 712
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand

Re: Mask using shapefile

Postby Prashant_mahajan » Tue Jan 28, 2025 1:21 am

It is a polygon. I have tested it with both habitat and non-habitat shapefiles. I have emailed you the shapefiles along with the trap and capture files.

Thank you!
Prashant_mahajan
 
Posts: 30
Joined: Wed Mar 31, 2021 11:14 am

Re: Mask using shapefile

Postby murray.efford » Fri Jan 31, 2025 5:30 am

Hi Prashant
In the code you sent me offline the 'poly' argument was spelled 'ploy'. I think it works if you fix that.
Murray
murray.efford
 
Posts: 712
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand

Re: Mask using shapefile

Postby Prashant_mahajan » Fri Jan 31, 2025 5:37 pm

Yeah, it worked after correcting for it.

Thank you!
Prashant_mahajan
 
Posts: 30
Joined: Wed Mar 31, 2021 11:14 am


Return to analysis help

Who is online

Users browsing this forum: No registered users and 1 guest