Linkage Mapper connectivity analysis toolbox
Please visit the Linkage Mapper Website at https://linkagemapper.org/
ArcGIS tools to automate mapping and prioritization of wildlife habitat corridors
Home Page: https://circuitscape.org/linkagemapper/
License: GNU General Public License v3.0
Linkage Mapper connectivity analysis toolbox
Please visit the Linkage Mapper Website at https://linkagemapper.org/
On Windows 10 Creators Update, when you select an empty field in a toolbox an ActiveX control warning appears. See this GeoNet discussion for more details.
A fix will require updating all tool stylesheets. Locally, I have updated LmDlgContent.xsl and the changes seem to have resolved the issue. The fix is based off MdDlgContent.xsl from ArcGIS 10.6. I do not know if there are implications for other setups.
Documentation should include for each tool:
Which ones are they, and should we break protocol for this?
Animals living in highly fragmented areas move less, compared to animals of the same species in wilder areas: Animals worldwide stick close to home when humans move in (Nature News, 25 January 2018). Hence our single threshold for maximum linkage length is too simplistic. Or do we have the option of making maximum linkage length based on cost rather than euclidian distance? If we do, put this into the documentation as best practice and cite this research.
I'm trying to run LP with expert corridor importance values for a very large project file. It fails because it appears Spatial Analyst calculations during the calculation of the blended priority are saving to my OS drive by default and filling it up before the run can finish. I've looked around in the lp_settings and lp_main scripts and can't seem to find a way to change this. I've also searched ESRI forums, to no avail.
Currently, it goes to: C:/Users/my_drive/AppData/Local/ESRI/Desktop10.2/SpatialAnalyst
Would setting KEEPINTERMEDIATE to True affect this by saving intermediate files elsewhere?
Any suggestions would be much appreciated.
Input parameters passed via the command line are not validated. Tools exit without clear explanation. Validation code from script tools (.tbx) are not available from the command line, although it may be possible for validation code to be shared with an ArcGIS Python toolbox (.pyt).
Thank you for being a beta tester!
Right now we are primarily looking for bugs and errors, and will focus on optimization in a later release. That said, possible enhancements and ideas are always welcome.
There is a spectrum of testing that could be done. Find a place on the spectrum that works for you!
On the one end of the specturm, you can simply:
On the other end of the spectrum you could do as many of the following steps as you can:
Release date? We were hoping for end of June, but that is too soon. E-mail me for the exact target date? Also, anyone can do any of the above after the release too...Would still be very helpful. Finally, I'd like to publicly thank all of you on the community list, please let me know if you would rather I don't mention your help.
Thanks!
Detailed with screengrabs here: https://docs.google.com/document/d/1RmNEuRWNUgfpbSgWAIAcLqrwygTcev4o9w4Fd3e74Cc/edit?usp=sharing
Some thoughts and attempts to run LM under Python 3 in ArcGIS Pro:
https://groups.google.com/forum/#!topic/linkage-mapper/0s8xfpdLGHU
Reviewing how new core related data are added to the core table, I discovered that the new fields are added to the inputed core table and not to a duplicate. While this seems to be the intent, based on the documentation, I assumed that the fields would have been added to a duplicate.
I am doing the LM_Lab and each time I try to run the Pinchpoint Mapper in Step 3, it fails. I have restarted ArcMap numerous times and made sure that I am following the tutorial exactly, but it doesn't resolve this issue.
I'm using Windows 10.0 64 bit, ArcMap 10.6, and Linkage Mapper 2.0.0.
I've included an image of the failed message below:
https://groups.google.com/forum/#!topic/linkage-mapper/C8S54xofSa8
This looks familiar. And, she tried it with the sample data...
I lost track, but do we have a fix for this? Should we upload that to the site as v 1.1.2
and this is fixed in the V2.0 release right?
I think the now visible truncate options should be moved up into Step 5 within the toolbox. The Additional Option section is to my mind only for optional options. CLM (and other files) would have to be amended to reflect the change in parameter order if the update was made.
linkage-mapper/toolbox/scripts/lm_config.py
Lines 248 to 259 in d85c41b
Hello Darren,
I think I found a bug/error in the new code implementation.
Climate Analog Ratio is not calculating correctly for the linkages in which the hotter/drier core aree is the higher core_id compared to the other core area. I think that is the issue. I suspect that the code for determining Core_Start and Core_End needs to be revised.
Here is what I see, using the modoc demo data:
and the output values in the cores file:
By my calculations, core 2 is hotter/drier than core 1 at the current time, so core 1 should be the Destination Core (Core_End). Therefore the C Analog ratio is the climate of core 1 in the future, divided by the climate of core 2 in the present = 608/660 = .9212 not 1.25 . I think that 1.25 occurs because core 1 is marked as the start core.
I checked the linkage of cores 1 and 4, and in this case 1 is hotter, so core start and core end are correct, and the CAnalog ratio is 445/5553 = .804 which is what we get.
I note that Core_Start and Core_end exactly replicate From_Core and To_Core so that might be a hint in the troubleshooting. Please let me know if I should clarify more or anything. Thanks!
The Linkage Pathways tool needs to be reviewed and updated to match the latest developments.
Dome fine tuning suggestions for the user guide are attached as comments of the .pdf.
Linkage Pathways-wNOTES- Linkage Mapper User Guide.pdf
as per title.
It may be best to move the multi-tool combination into a new toolbox called LM Utilities Beta, or something like that. You can add the other combo tools that are under development.
In the meantime, remove red X's in Multi-tool combination by opening and closing in arc map, at the least,
also fix a weight which was 0.02 but should have been 0.33 to be equal as the others.
I encountered a few issues with the demo data while testing.
Issue 1:
This error was thrown when I tried to open LP Demo Arc10.mxd using ArcMap 10.3.1. The .mxd needs to be made backwards compatible so everyone using Arc10.x can open.
Issue 2:
The demo data for climate linkage mapper and the demo data for LM/LPM are different (different cores, resistance, etc.); the LPM demo is designed to work only with the Linkage Mapper outputs. If we want to make climate linkage mapper and LPM fully compatible, there should be matching demo data OR an added section in the LPM tutorial instructing on how to use it with the results of climate linkage mapper (directing to the appropriate inputs, etc.)
This bug can occur when there are no errors, but it is very rare/extreme. It occurs when the centrality value of a core is 0. The below was caused in part by an island, seperted from the mainland by "infinite" resistance (user error), but also by some small slivers on the mainland, but on the periphery. I believe. Whoever tackles this bug shold first look at the 0 valued CF_Cental cores on the vm10 data to be sure hey are on the periphery.
At the very beginning of a linkage Priority run (v190403_vm10), I get the following error:
Retreiving outputs from Linkage Pathways model run
Calculating permeability for each LCP line
Calculating relative closeness for each LCP line
Calculating Core Area Value (CAV) and its components for each core
unsupported operand type(s) for +: 'float' and 'NoneType'
Traceback (most recent call last):
File "E:\Gallo\GIS\Projects\NPLCD_2018_john_gallo\NPLCD\Tasks\Connectivity_LM\Tools\Models\Linkage_Mapper\toolbox\scripts\lp_main.py", line 845, in main
run_analysis()
File "E:\Gallo\GIS\Projects\NPLCD_2018_john_gallo\NPLCD\Tasks\Connectivity_LM\Tools\Models\Linkage_Mapper\toolbox\scripts\lp_main.py", line 780, in run_analysis
calc_cav(core_lyr)
File "E:\Gallo\GIS\Projects\NPLCD_2018_john_gallo\NPLCD\Tasks\Connectivity_LM\Tools\Models\Linkage_Mapper\toolbox\scripts\lp_main.py", line 659, in calc_cav
True)
File "E:\Gallo\GIS\Projects\NPLCD_2018_john_gallo\NPLCD\Tasks\Connectivity_LM\Tools\Models\Linkage_Mapper\toolbox\scripts\lp_main.py", line 260, in normalize_field
in_field + "!) / " + str(max_val), "PYTHON_9.3")
Completed script LinkagePriority2...
Failed to execute (Linkage Priority (2)).
Failed at Sat Apr 6 17:29:43 2019 (Elapsed Time: 35.34 seconds)
Failed to execute (a30 Linkage PriorityNPLCD).
Failed at Sat Apr 6 17:29:43 2019 (Elapsed Time: 36.62 seconds)
Meanwhile a run on another machine (v190405_vm6), it passed through this part of the code no problem. One of the differnces is that on this local machine (vm10, the core fields are more, and some of the CF_Centrality values are 0. On the other one, ther are no )s. (Whether or not that is an error is my next line of inquiry.) Regardless, the LM code shuodl be fixed to allow for CF_Central = 0, right?
Note, the LP settings are such that all the CAV fields except for centrality are = 0. THose parameter values are available upon request.
Full error message: Document0403vm10_firsterrormessage.zip
core_centrality_v190405_vm6.gdb.zip
core_centrality_v190403_vm10.gdb.zip
LP doesn't check if the outputs from Linkage Mapper share the same extent of the selected inputs. See attached log -
I've just tried the LP tool in several of the beta releases, and when the run is complete, the only output added to the corridor geodatabase in my project folder is the blended priority. None of the other outputs are being written to that gdb.
I started with beta release 5, and then also tried 2 and 4, and no luck.
I verified in lp_settings.py that the I had the following:
CALCCSPBP = 2 # No_Calc=0, CSP=1, CSP_BP=2
It looks as though selecting option 2 should trigger production of the blended priority as well as the other outputs to the corridor.gdb, but I can't seem to get those outputs.
Ideas? Please let me know if you'd like me to send a log file or other output.
Thanks!
Or vice versa. As is, it is annoying to make any new release (wasting time). It also leads to errors in beta testing, like relative path to files in the demo folder in the repository, which gets renamed as LP_Demo folder in the build, or something like that.
linkage-mapper/toolbox/scripts/lp_main.py
Lines 397 to 400 in ff68cc5
linkage-mapper/toolbox/scripts/lp_main.py
Lines 214 to 217 in ff68cc5
This also occurred (after I removed the OCAV option from the GUI) in doing the same calculation for climate envelope - two cores received null values for "clim_env" and the calculation could not be completed.
there is some great feedback here in the wiki that needs to be made into several issues for development: https://github.com/linkagescape/linkage-mapper/wiki/Ideas-and-Feedback-for-Development
Use of import * is consider bad practice. Among other things, you cannot inherently tell where sa functions are being used in the module. from arcpy.sa import *
should be replaced with just import arcpy
or from arcpy import sa
.
Issue - results from climate linkage mapper cannot be used with linkage priority mapper.
I used the demo datasets to try to reproduce the issue and encountered issues specific to the demo that should be fixed in addition to two issues with climate linkage mapper itself and then CLM in conjunction with LPM. I'll put the demo problems in another issue.
CLM/LPM Issues
Issue 1: Climate linkage mapper tuple error
CLM starts using cc_main.py and jumps over to lm_config.py:
linkage-mapper/toolbox/scripts/lm_config.py
Lines 238 to 259 in 4ca80b4
Lines 248-252 are trying to access arguments 19-22 when the user is using ArcGIS 10.x; however, the climate linkage mapper GUI does not have these variables as inputs, so there is nothing to feed in here, and the user gets a tuple index error:
I fixed this for test by changing the variables to the hardcoded values in lines 254-259. To avoid this issue the GUI should either be updated to accept these variables or they should be hardcoded like they are for earlier versions of ArcGIS.
Issue 2: Parameters error
My guess is that this is the main issue that is causing CLM and LPM to be incompatible.
linkage-mapper/toolbox/scripts/lp_main.py
Lines 143 to 152 in 4ca80b4
These lines (147 specifically) are searching the log file generated by linkage mapper for parameters that begin with a left bracket. When linkage mapper runs, it creates a list of the parameters in the log file and so they are enclosed in brackets. However, when climate linkage mapper generates its log file, it generates a tuple and therefore encloses the parameters with parentheses.
Compare cc_main.py here (specifically 111-114 - setting lm_arg as a tuple)
linkage-mapper/toolbox/scripts/cc_main.py
Lines 109 to 128 in 4ca80b4
to lm_util.py here (specifically 1243 - writing parameters as a list):
linkage-mapper/toolbox/scripts/lm_util.py
Lines 1230 to 1243 in 4ca80b4
So cc_main.py should either be changed to generate a list of parameters in the log_file rather than a tuple, or lp_main.py should be changed to search for both. The former would maintain more consistency.
I changed the parentheses to brackets in the log file for climate LM just to keep testing, and after that I ran into no further issues running LPM with the outputs from climate LM. I also ran into no issues running pinchpoint mapper or barrier mapper with the climate LM outputs.
I noticed that the demo core data (both core.shp and LP_Demo_Modoc.gdb/cores) includes new LP fields, presumably added during a test run. I would suggest that demo data should not include data derived during a model run.
@rgreenefl is this commented section still required?
linkage-mapper/toolbox/scripts/lm_config.py
Lines 261 to 278 in d85c41b
right now, raw perm is LCP length (the smaller number) divided by Cost weighted distance of the LCP. (the larger number).
just like 1/2, 1/3, 1/4, 1/5 does not have the same relative difference between values as 2/1, 3/1, 4/1, and 5/1 the above applies.
So, you get a much more normal distribution if you do the inverse of the above. That is a field that already exists: cwd_to_Path_Length_Ratio The quick fix is to delete "Raw Perm" and to just use cwd_to_path_length_Ratio as the raw input, and then to make new option in LP_Settings to do Inverse Score Range Normalization, then set this as the default for this , yielding Rel_Perm.
For now, this can be done in a post processing model, then patched in as an expert opinion variable. And give the Rel_perm a weight of 0.
The linkage priority tool can have an 11th factor: development threat. The input needed would be a map of the landscape showing the degree of threat for every pixel. Degree of threat could be calculated in one of many ways. Then the linkage would get a "degree of threat" value, which would go into the multi-criteria model. I can see two ways of getting this "degree of threat" value for each linkage. One is to use the Least Cost Path itself, the other is to use the linkage specific surface that covers the entire region, unless a bounding circle is used (What is the name of that layer again?).
To do this feature best, it would be ideal to test both of these, evaluate, and choose one to implement. If the time available for this is tight, just use option 1 for this first version of this feature.
In the future, we can change LM to make permanent copies of resistance and of cores in the "results" files, and then LP can use these as inputs. This can also apply to centrality mapper, barrier mapper, and pinchpoint mapper, right? You just specify the project directory that linkage pathways used...
Based on Closed Issue #9
The multi-tool combinations are best built and tested in the repository. I made a demoOutputs folder in the repository to do this, and also added a line to .gitignore to ignore that repository. But that cannot happen as the repository is currently names:
A record of run settings and messages can be found in your log directory:
D:\GIS\Repositories\linkage-mapper\demo\demoOutputs\v4ClimateFocus\run_history\log
"
so, how about if we make a new repository named linkagemapper instead of linkage-mapper
@dkav do you think this will be OK?
Hello, experts,when I run pinchpoint mapper,displayed an error: Cannot find an installation of Circuitscapein your Program Files directory.Before that, I could run Build Network and Map Linkages successfully. I would appreciate it if you could answer my question.
Error report: see https://groups.google.com/d/msg/linkage-mapper/bCdOW8V5mxQ/XhEGSurjAQAJ
I remember that from many years ago. Perhaps it is with particular Active X settings. Or a particular version of Windows set up.
I tried opening it in 10.3 and it would not open. This needs to be done with someone with the version number it was saved in or higher.
In ArcMap 10.6 on Windows 10, when I open the Multi-tool Combinations toolset I find most of the tools have a red x next to them. When I took a look at one (a20 Build Network and Map Linkages), I found it was due to the ‘Build Network and Map Linkages’ tool not being found. This same tool had a lot of values preset too.
A feature requested from the Mexico CONABIO team. Here is my paraphrase, from the e-mail dialog below: "The user can determine if they are mapping connectivity for the
near-term, and use your formula, or connectivity for the long term and
allowing for range shifts, and use the original formula."
here is "your forumla" fromthe below e-mail:
**> > We think the faster solution is to modify the line #534 in the
"lp_main.py" script:
diff_clim_env = abs(x_clim_env - y_clim_env)
to
diff_clim_env = 1- abs(x_clim_env - y_clim_env)**
it is now part of core area value, not linkage priority. Update the logic model, paste into user guide, and on website.
Convert documents from .docx format to a markup language such as reStructuredText (rst) or Markdown.
Provide an boolean variable in the settings file to allow user to save inputs and/or intermediate data. Documentation would need to be updated to inform user of this option.
From what I understand, only Linkage Priority currently saves intermediate data while other tools do not. Climate Linkage Mapper inconsistently tried to save clipped input data (see Pull Request #39).
Configuration variables are named using lowercase characters in cc_config.py and uppercase characters in lm_config.py.
User guide has been replaced with Linkage Mapper Linkage Pathways User Guide.docx.
Linkage Mapper still uses legacy search cursors. ESRI introduced arcpy.da cursors in ArcGIS 10.1 "to provide significantly faster performance over the previously existing set of cursor functions (arcpy.SearchCursor, arcpy.UpdateCursor, and arcpy.InsertCursor). The original cursors are provided only for continuing backward compatibility."
See this help page for more details.
The Python toolbox will make it easier to track changes and integrate fully with Git.
See ESRI's What is a Python toolbox? and also the Stack Exchange question Guidelines for organizing Python Toolboxes (.pyt) in ArcGIS for more info.
During the class, I ran Linkage Pathways with steps 1-5 checked, and that worked fine. Then I tried running it again with the same directory, and only step 5 checked and the truncated parameter changed from 200000 to 50000 and it did not work.
See page 17.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.