The use of external packages
- Nicholas
- Nov 9, 2020
- 1 min read
Not all the code used in the making of our webmap was engineered by the Frontline GIS Solutions team. Code available to use in the form of packages and external sheets were used. These are available freely online if you know what you are looking for and if these tools are harnessed correctly - the possibilities are infinite!
Some of the of the packages we used in this project were "L.Control.Layers.Tree" and "SweetAlert". This is in addition to the "Leaflet", "AJAX" and "jQuery" packages already used.
These packages need to be referenced and the way you reference them is the same throughout the document, however the reference's position in the HTML document depends on the purpose of the source.
Most of our external packages were referenced in the <body> tag as follows:
<script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew=="crossorigin=""></script>
<script src="L.Control.Layers.Tree.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
It is evident that some of these references link to resources hosted online, while others are hosted locally. In the above snippet, the Tree Layer control package is the only one hosted locally, as all the other packages are hyperlinks.
In order to host the resource locally, it needs to be downloaded. This can be done by doing an ordinary download from your internet or you can use the the npm package manager in the local terminal of your Visual Studio - how simple!
Comments