Menu Sidebar
Menu

Published Web App

Last week Missouri got a lot of rain, which caused flooding in the Meramec river valley near St. Louis. I received a link to an ArcGIS Image Service that Surdex had created and provided that showed the flooding as of Tuesday 5/2. They flew this imagery as a service to the government and first responders, hoping to help those affected quicker and more efficiently. Here’s a sample:

I was really interested in this imagery, but it lacked some context – I couldn’t tell how the flooding depicted in the imagery compared to normal conditions. I knew ArcGIS Web AppBuilder had a swipe widget though, so I quickly:

  1. Added the Image Service (provided by Surdex) to a web map, and chose the ArcGIS Imagery basemap and an initial extent
  2. Created a Web App from that web map using Web AppBuilder.
  3. In Web AppBuilder, enabled the swipe tool to be enabled by default.
  4. Shared the web map and app publicly.

This app provided a really compelling, interesting view of the data:


(full app)

The app web viral on Twitter and Facebook – gaining 20,000 views over a three-day period, and even got published on the St. Louis Post Dispatch.

So I’m now an official, published map author now, right? 🙂

A few links:

St. Louis Lambert Airport Passenger Data

Our city’s airport posts data on how many passengers travel through the airport each month and year. It’s posted as a PDF but the data is hard to use in that format. I grabbed the data and put it into a better format:

Why not convert to a graph too?

I’ve posted this data on GitHub. It tells an interesting story of how the early 2000s was tough years for Lambert, but recent years the demand has ticked up. What other insights can we glean from better open data?

Open Data in University City

I live in University City, MO, which has no crime. Don’t believe me? This map says so:

crime-reports-u-city

Open Government

The benefits of open government data – crime data being just one aspect of that – is well documented. It allows you and I to take the data the process it, innovate on it, be informed based on it, and keep our government officials accountable.

It is easier now more than ever to have a basic open data program at any government level. Your government can use a product like ArcGIS Open Data or Socrata which are both fancy and have a lot of nice open government features. Or for cheaper, a government representative can create a free GitHub account and upload the data. Or even cheaper AND easier – simply post CSV files on an existing website. The key is that the data be machine readable and in an open format.

University City was not doing that – crime data, before a few months ago, was being released in non-machine-readable PDFs. Thus it’s not able to be placed on crime maps, or analyzed by experts, or any of that. And so we end up with the hole in the crime map over our town.

“Let’s fix this!” I said. Little did I know it’d be a years-long adventure.

The initial contact

I originally reached out to my city council representative, mentioning the benefits of open data and why our city should be doing more to provide open data.

10/27/2013
To: City Council Rep
From: Gavin

I was just wondering if you know of any current or future plans of U City to open our city data? I recently wrote a post on open data – http://www.gavinr.com/2013/10/16/share-data-github/ – and would love to help U City in getting our public data more available in open formats.

I got a quick response saying my message was received, but after a few back-and-forth emails, nothing ever happened.

Go to the Top!

A couple years later, I emailed the police chief directly:

3/26/2015
To: Colonel Adams (U City Police Chief)
CC: City Council Rep
From: Gavin

I am writing to inquire why the crime stats posted on http://www.ucitymo.org/index.aspx?nid=482 are posted in a hard-to-process PDF format, instead of a more open CSV (Excel) format. I think the city at large would benefit greatly from having that data more easily process-able. Is there any way your team could provide this?

Response from this: nothing. Crickets. I took this to mean neither my city council rep nor the police chief has any interest in helping me get this done.

Finally

In 2016, University City adopted “MyGov” as their website CMS. One portion of this solution allows citizens to make a request digitally to the city. One of those options is “Police Issues – Crime Statistics.” Interesting. So I fill out the form, using the same request as above and wait. No response.

XLSX files on University City homepage

The new files, unceremoniously relegated to the bottom of the crime stats page

After three months of waiting, I forwarded the email to my city council rep, who forwarded to the city manager, who forwarded to the police department, who finally acknowledged my request and posted the crime data in XLSX format (only this year). I had to further ask for previous years to be posted.

WHEW. Finally after almost three years of discussing this, University City has made a small step toward open data. I learned through this process that when making requests to government officials, you sometimes have to be extremely specific, because general ideas or initiatives will probably get dropped. You also need to persevere – doing the right thing is not always the easiest thing (although it’s quite easy now – uploading an XLSX file? c’mon), so you’ll probably have to ask multiple times, and multiple ways, to get them to do what’s right.

What’s Next?

The good news: my city is posting the data in a decent format. Bad news: it’s not the best layout of the data. In a later post I’ll show how I wrote some scripts to process that and get it into databases and maps.

Extending Widgets in ArcGIS Web AppBuilder

I’ve had many requests and ideas for Web AppBuilder widgets over the past few years, and many times they are ideas that are building on an existing widget. For example, a query widget that is custom to a particular workflow, an edit widget that enforces certain geometry movement restrictions, or maybe adding a few more options to the built-in print widget.

Most developers will copy the original out-of-the-box (OOTB) widget, rename it, and then start development from there. Which is great because it gets you moving quickly. But is this really the best way to do things?

There are many problems that you’ll eventually encounter when doing this copy/paste dance, and they all stem from the fact that there is no separation of your custom code from the original, OOTB widget code. Some potential future problems include:

  • Upgrading your widget to a new version of the OOTB widget is almost impossible
  • It’s hard to identify if bugs you encounter are stemming from your custom code or the original widget code.
  • Future developers trying to understand how your widget works have a much larger codebase to learn and understand (your custom code plus the original widget code).

Luckily there is a good way of “extending” modules in dojo/declare. Most widgets use this feature to extend from jimu/BaseWidget, but you can use it to extend from an existing widget too!

So how would you do this? (I’ll use this repo as an example)

First create a new, blank widget. You can do that by either creating a manifest.json and Widget.js file manually, or use the convenient yeoman generator that will create the files automatically.

Next, modify your widget to extend from an existing widget instead of extending from BaseWidget. You have to include the “parent widget” in the page as well as referencing it in your delcare statement. See an example here.

Next, include the translation and style files from the original widget. Don’t forget to set this.nls.

Finally, override functions in the parent widget as needed to get your desired functionality. In this example, I overrode the _createEditor function, but this will be different depending on what you want to do with your widget.

So happy from my clean widget code!

Extending your widget is a little more work, but you end up with much cleaner code. I hope you give it a try!

Have you done this or something similar? Let me know in the comments, or contribute to the example GitHub repository. Want more Web AppBuilder development tips and tricks? Catch my talk at Esri Dev Summit 2017!

St. Louis Bike Trails with Open Data from Great Rivers Greenway

2016 was a year of biking for my wife and me. We biked many trails in St. Louis, and even did part of the Katy Trail. So when I saw St. Louis City alderman Scott Ogilvie tweeting about Great Rivers Greenway, the trails organization in the St. Louis area, I started wondering what the future of St. Louis trails will be.

Luckily the Great Rivers Greenway organization has a pretty good resource for getting their data in shapefile format: http://greatriversgreenway.org/gis-data. The data is quite interesting.

All Trails

One of the most practical uses of the data is to create a combined biking trails map of the St. Louis Area:

After looking at the trails map, I immediately wanted to see where the future paths were going to be. I placed the exisiting (green), in-progress (yellow), and planned (red) paths on a map:

2015 vs 2016

As 2016 came to a close, GRG released updated data from what they completed in 2016 and the plans for 2017 (and posted a blog post on the details of some of the new projects). That data is on this map, and I also created an app that allows easy comparison between the two years:


(Full Screen)

What are your favorite trails in St. Louis? Let me know in the comments.


Summary of all map links from above:

Older Posts

Gavin Rehkemper

JavaScript, WordPress, and GeoDev