From the blog
Currently displaying: Scott Davis
The Geocoding Toolbox is being deprecated (2 min)
First, the historyBack in 2014, we released a custom python toolbox for ArcGIS Desktop called the Geocoding Toolbox. It allowed users to geocode Utah addresses using the UGRC API. It was a great tool
Python Shorts: Loading an Open SGID Layer into pandas (3 min)
There are a myriad of ways you can access data from the Open SGID. However, these all require some form of desktop client application. What if you want programmatic access to our spatial data? Because
Introducing Masquerade (2 min)
Masquerade is a new proxy service hosted by UGRC that makes our geocoding service and Open SGID datasets easily accessible in Esri products. It does this by impersonating an Esri locator service. You
Cache-Breaking for Faster Web Application Updates (4 min)
When Production Is Broken, It Needs to Be Fixed Now!Recently, the URL changed for one of the map services we use in several of our applications. This came as a bit of a surprise to us, so we quickly u
The Evolution of a Python Script (7 min)
Python is a very approachable programming language and scripting in python is quick and powerful - Create a file, type some code, and a repeatable script is produced. Python is installed on most compu
Printing Web Maps with Discover Services (3 min)
Export Web Map ToolThe Export Web Map tool is a geoprocessing tool that comes published as a service () out of the box with ArcGIS Server. From ESRI's docs:This is most commonly used as a print servic
Why I Speak at Conferences and You Should Too (2 min)
Recently, I tried to gather all of the presentations that I have participated in during my career up to this point (~10 years). I was able to find materials for almost 20 different presentations or wo
Mock your Dojo AMD modules with StubModule.js (2 min)
When testing AMD modules it is sometimes necessary to verify how it interacts with it's dependencies. For example, you might be writing a module that makes XHR requests using dojo/request and you want
Boost Your Productivity With Vim (3 min)
I was surprised to realize today that I have never written about one of my favorite tools that I use to write code. It's something that absolutely transformed my day-to-day coding. If it was suddenly taken away from me I would feel like I had gone back to the dark ages. That's right, I'm talk about Vim. Or more specifically Vim key bindings. Vim (Vi IMproved) [https://en.wikipedia.org/wiki/Vim_(text_editor)] is an old text editor that was first released in the 90's and is an improvement to an even older editor called Vi. The intriguing part of Vim for me was not the 20 year old piece of software but the system that it used to edit and navigate text. It's very efficient, requiring the coder to reach for his or her mouse almost never. Lest you think that I've abandoned my favorite text editor [https://atom.io/], the real power of Vim for me is not the actual software. In fact, I've only opened it up a few times out of curiosity. The power of Vim is the standard that it's set. There are Vim emulator plugins for every major text editor out there including Sublime [https://github.com/guillermooo/Vintageous], Atom [https://github.com/atom/vim-mode] and even online editors such as CodePen [https://blog.codepen.io/2014/02/21/vim-key-bindings/]. This means that if you invest the time into learning Vim commands they will be almost universally applicable across your development tools. Want to quickly go to the end or beginning of the current line? Change everything within the quotes? Delete everything from your cursor to the end of the line? Quickly go to a line number? Change the casing of the selected text? This and much, much, much [https://www.catswhocode.com/blog/130-essential-vim-commands] more can be done with just a few Vim commands. Here are a few of the commands that convinced me that I should learn Vim: * "A" Go to the end of the line and start inserting new text. * "I" Same as "A" but go to the start of the line * "ci"" Delete everything within the quotes and start inserting new text * "C" Delete everything from the cursor to the end of the line and start inserting * "545 gg" Go to line number 545 * "ct," Delete everything until the "," and start inserting new text These are just a few of the commands that I use every day. While it's significant learning curve, the time investment is worth it to me. After all... > Every year, the average Vim user saves over 4 seconds in accumulated time not > having to reach for their mouse… > > — I Am Devloper (@iamdevloper) April 3, 2014 > [https://twitter.com/iamdevloper/status/451792390865833984] There are endless tutorials available for you to learn Vim. After learning just a few of the basics I made it my practice to add one or two new commands to my personal reference [https://www.evernote.com/l/ABdguLm6UtRExY8VU_EZWbfJvRKE6rpjTCM] on a regular basis. After a few weeks you'll wonder how you ever lived without it. There are a few drawbacks that come to mind. Firstly, after a few months of using Vim, your fingers will start automatically typing commands into non-Vim interfaces. This can get annoying. Also, you've probably already realized that the learning curve is pretty steep. If you are not in a code editor on a daily basis then it's probably not worth the investment. But if you're in the mood to boost your productivity and give your poor mouse a break you may want to play some vim golf [https://www.vimgolf.com/] and see how it goes. :)
How To Use UGRC Base Maps in QGIS (1 min)
Most people know about UGRC's awesome base maps. They are very popular and provide high quality cartography using the latest and greatest data from the Utah SGID. But did you know that they provide a
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!