Site icon R-bloggers

Visualization Example: Interactive Oilfield Map

[This article was first published on R – Steffen Ruefer, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Recently I came across some R tutorials about creating interactive maps and I decided to build my own. I like the Google Maps interface design, so I wanted to make it look similar, i.e. the map across the entire browser window and the user controls visible in panels that change design while using them. As data overlay I wanted to use production data of existing oil wells.

Web App Requirements

Showing the location of oil wells on a map is great, but I wanted to add some additional data and user inputs:

Data Source and Data Munging

While looking for old well production data, I found some at the Kentucky Geological Survey Website. After using their search function, I chose to download the 2014 oil production data file. It comes in Excel and has approx. 22,000 rows. It also shows production for each month per well; much more information that I require for this app.

I reduced the file size by using only the top 500 rows and by deleting most of the columns; I added a new feature, the total yearly production per well, by summing up all monthly production data before deleting these columns, too. Below is a sample of the data set.

The complete file can be viewed here.

Source Code

For brevity reasons I will not go through the source code but focus on the features of the web application. You can download the source code from my Github Page.

Using the App

When running the app in the browser, the default controls are set, e.g. the default color scheme is set (brown = low production, green = high production) and no clusters are shown, only individual wells. The control panel also shows the number of wells (500, as per data set) and the total yearly production.

When zooming in, more individual wells are getting visible. Because less wells are now visible, the well number has decreased to 256 and the total production is less, too.

When switching on the cluster option, individual wells are aggregated into cluster markers that are color coded and also show the number of wells that are inside the cluster. When hovering the mouse over a cluster, the map shows the cluster area in blue.

When clicking on a cluster, the map will automatically zoom into the cluster area and split into smaller clusters. To view individual wells again, switch off the cluster option. Changing the color scheme will interactively change the color coding of the wells, as well as the legend.

You can download the source code and run your app from your R environment, or run it from Shinyapps.io (links are below). The data can be easily explored by using such visualizations, and you might discover anomalies and other interesting things.

Things to improve

The list to improve this app is long! I suggest you dive in and try the following:

Resources and Links

Source code for download on Github: Kentucky Oil Production
Shiny App on Shinyapps.io: Kentucky Oilfield Visualization Example
Oil Production Data Download: Kentucky Geological Survey

To leave a comment for the author, please follow the link and comment on their blog: R – Steffen Ruefer.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.