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.

App example look

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:

  • Show individual well information upon selecting it
  • Show well clusters
  • Indicate production amount by varying well marker size and color
  • Show total number of wells and total production within the visible map
  • Change color scheme
  • Show or hide the legend

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.

well data sample

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.

web app default view

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.

zoomed into map

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.

showing well clusters

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.

Change color scheme

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:

  • Add a production histogram into the control panel
  • Count and display how many wells are not producing at all
  • Color code not producing wells better
  • Add more data points

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.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)