From the blog
Currently displaying: All
Using UGRC's Geocoding and Map-based Web Services (1 min)
The Department of Technology Services hosts a monthly scheduled [https://docs.google.com/a/utah.gov/document/d/1XOEXOIGdl2LHSXVDr3q5szpqVcAw6VgFTSVoXq15ZDM/edit] Enterprise Developer Group (EDG) brown bag presentation series. The previous session recordings can be found on the DTS youtube [https://www.youtube.com/channel/UCUuw5SFmgapGToUfRd5xGVw] channel. Steve Gourley from UGRC participated in the EDG last month and presented on UGRC's GIS/map technology-based web service offerings -- Unlock your API key. Making UGRC data available through http [https://eoh.github.io/Presentations/2014/UGIC/#0] -- contains the slides for the presentation. Give the video a watch if you are interested in finding out more about UGRC web services or picking up some new information from the developer of the API. Hope to see you at the next EDG brown bag!
Quick JavaScript Tip: The Arguments Object (2 min)
Recently, as I was slowly working my way through Rebecca Murphy's [https://rmurphey.com/] excellent js-assessment test suite [https://github.com/rmurphey/js-assessment], I ran into a problem that was quite vexing. I was creating a function that was to take an arbitrary number of arguments and combine them with an existing array [https://github.com/rmurphey/js-assessment/blob/master/tests/app/functions.js#L109-119]. I thought that this would be as trivial as using the concat method on the existing array and passing in the arguments object. However, as you can see below, it didn't work. See the Pen Arguments Concat Method [https://codepen.io/stdavis/pen/BPVWdQ/] by Scott Davis (@stdavis [https://codepen.io/stdavis]) on CodePen [https://codepen.io]. For a while I thought that I must be using the concat method incorrectly. I tested it using the terminal again and again with no problems. Finally I recalled a recent issue [https://us6.campaign-archive1.com/?u=2cc20705b76fa66ab84a6634f&id=c8f1074cb2] from A Drip of JavaScript that talked about the arguments object. I remembered that Joshua said that the arguments object "isn't exactly an array, [but rather an] object that acts like an array." This means that you can't use it exactly like an array. An easy fix for the situation was to bind a call to the slice method on an empty array to the arguments object which converts it to a true array object like so: See the Pen Arguments Slice [https://codepen.io/stdavis/pen/xJzqPB/] by Scott Davis (@stdavis [https://codepen.io/stdavis]) on CodePen [https://codepen.io]. Hopefully this will save you some time in the future. Scott [https://twitter.com/SThomasDavis]
Using Base Maps with Non-standard Coordinate Systems in LeafletJS (2 min)
Since LeafletJS [https://leafletjs.com/] seems to be what all of the cool kids are using these days and it shows no signs of slowing down [https://www.mapbox.com/blog/vladimir-agafonkin-joins-mapbox/], I thought that it would be fun to figure out how to use Leaflet to view UGRC's awesome base map services [/products/sgid/base-maps/]. This presented a unique challenge since they are not in a projection that is supported out-of-the-box by Leaflet (UTM Zone 12 NAD83). However, I found that it is possible with the help of a few additional JavaScript libraries. So, here's the solution: See the Pen Esri Leaflet (OLD) [https://codepen.io/stdavis/pen/zLaZoJ/] by Scott Davis (@stdavis [https://codepen.io/stdavis]) on CodePen [https://codepen.io]. You'll notice that I've loaded these libraries in addition to the latest version of Leaflet: * Esri-Leaflet Plugin [https://esri.github.io/esri-leaflet/] * Proj4js [https://github.com/proj4js/proj4js] * Proj4Leaflet Plugin [https://github.com/kartena/Proj4Leaflet] The implementation was not that complex once I got all of the numbers right. First I create a new Proj4Leaflet coordinate reference system which I pass into the map constructor. Then I use the Esri-Leaflet Plugin to set up a new TiledMapLayer and add it to the map. Now you can be one of the cool kids too!