A Raspberry Pi IoT to collect and post field data

This is the third blog post in a series that uses the Raspberry Pi as an Internet of Things device to collect environmental data (with a DHT22 weather sensor) and post the data in real-time to an ArcGIS Online feature service.  The post below is a highly synopsized version of a chapter in the forthcoming third edition of the book, Tech-enabled Field Studies.

Begin by setting up a Raspberry Pi with the DHT22 sensor..  See The Pi Becomes a Data Collector

Use the Pi’s command prompt to make the following installations and configurations:

  1. pip3 install virtualenv
  2. virtualenv datalogger
  3. cd datalogger
  4. source bin/activate datalogger
  5. pip3 install Adafruit_DHT
  6. pip3 install pandas
  7. pip3 install arcgis – -no-deps

Note: Step 6 above (Pandas) may take several minutes. The above steps create a virtual environment in Python called datalogger and install three libraries into that environment including a streamlined ArcGIS API for Python.  When you call the weather script below, you will need to reference it from this environment, described below.

Continue the set-up by:

  • Configuring the ArcGIS Online service as described in the previous blog post, A Time-aware Geo Data Bucket.
  • Download the sample Python file that reads data from the DHT22 and posts to ArcGIS Online. The Python file is here or download/clone the entire project here.  be sure to update the python file with your information, as described in the file.
  • Put the Python file in your datalogger directory to help you remember that it must be run from that environment.  Once you have added your data to the python script and have the ArcGIS Online service running, you can run the script by using the command:
    • /home/pi/datalogger/bin/python3 addwx.py

The service does have a date/time attribute and the service can become time-aware.  Once the service is added to a map, you may also choose a symbology that you prefer.

Finally, on the Pi, you may choose to set-up a Cron job to schedule the script execution on a reoccurring basis.  Do a quick Google search to find tutorials on how best to do this.  Enjoy!

 

 

 

A Time-aware Geo Data Bucket

A CSV spreadsheet file can become the basic building block of a Feature Service, capable of holding existing or inbound data.  Follow the steps below to create a simple time-enabled GIS feature service bucket for tracking the weather data you provide to it from users or sensors.

1. Log into your ArcGIS Online publisher account.

2. Upload the sample CSV (wx_start.csv):

  • Click “Content”.
  • Click button, “Add Item”. Select “From My Computer”.
  • Select the sample CSV and fill out metadata.
  • Click “Publish this file as a hosted layer”.
  • Select “Coordinates”.
  • Make sure the date field name shows date field type.
  • Make sure lat and long field names show latitude and longitude field types
  • Set the service to output to your local time zone. (In a later blog post, you will see the python script is set to send UTC time data to the feature class – which is converted to your local on map display).

3. View the feature service Overview page.

  • Find the “Layers” section. Click “Time Settings”.
  • In the pop-up window, click the checkbox, “Enable Time”. Select the first option, “Specific events in time”. Set pull down to “date”.

4. From the feature service Overview page, click “Open in Map Viewer”.

  • In the Change Style panel, make sure button 1 (Attribute to show) is set to “tempF”. Press Done.
  • Save your new map.
  • Hover over the new feature class layer name. Click the “View Options” button (ellipses). Select “Refresh Interval”. Enable the refresh and set to 1 minute (or whatever number makes sense to you).
  • Hover over the new feature class layer name. Click the “Cluster features” button. Enable or disable clustering to your preference. We recommend turning it off, initially.
  • Optional: You may also want to modify the transparency of the symbology, available under the “View Options” (ellipses) button. Select “Transparency”. Optionally, set to 50% initially.
  • Save your map edits.
  • Note: If new data are not showing on the map, click the layer’s “Show Table” button.If all the data is showing in the table, close it.  Then click the layer’s “Show Options” (ellipses) button and select “Disable Time Animation”. You can normally turn time animation back on and the data will appear.

ArcGIS on a Pi: Happy Pi Day!

This post describes how to install the ArcGIS API for Python on a Raspberry Pi 3 B+.
Document version: March 14, 2019. Version 1.1 – Tom Baker RPi-Logo

To learn more about the Raspberry Pi, visit http://raspberrypi.org.

Start with a clean installation of the Raspberry Pi’s Raspbian OS for best results.

Installations

  1. Install Berryconda

    Berryconda for Raspberry Pi is the conda environment for Pi. The installer includes Python 3.6.1 at the time of this writing and meets the minimum Python 3.5 requirement of the ArcGIS API for Python 1.6.0.

    1. Download the bash script (.sh file) for Berryconda3-2.0.0-Linux-armv71.sh from the bottom of the page: https://github.com/jjhelmus/berryconda
    2. With the file on your Pi, right-click and select Properties. Set permissions to “Only Owner” to execute. Press OK.
    3. Open a Terminal window in the current folder and run the bash script. Start the command with a period and paste the filename. Like (ignore indentation icon):
      • ./Berryconda3-2.0.0-Linux-armv71.sh
    4. Click through the Terminal prompts to install. Use default settings.
  2. Install Jupyter Notebook

    1. At a Terminal prompt, type:
      • conda install Jupyter
  3. Install the ArcGIS API for Python

    1. Check your python version. Use the Terminal window and type:
      • python –version
    2. Download the arcgis package from the anaconda repository for 32-bit Linux that matches your version of Python (e.g. 3.6). The file name should look something like: linux-32/arcgis-1.6.0-py36h39e3cac_1.tar.bz2
    3. Download from https://anaconda.org/Esri/arcgis/files
    4. Note: In our tests, the arcgis file cannot be directly downloaded using conda from any repository.The conda tool fails to find the required “linux-armv71” channel for arcgis.  However, downloading the file and installing from a local path negates the conda installer looking for the arm-specific version of arcgis.
    5. Right-click the package and select “Copy Full Path”.
    6. From a Terminal window, install the package like:
      • conda install /fullpath/arcgis-1.6.0-py36h39e3cac_1.tar.bz2
  4. Test the installation

    1. At a Terminal window, type:
      • jupyter-notebook
    2. When the notebook loads in a browser, create a new Python3 document.
    3. In the document’s first cell, enter the four-line test script below that will draw a map.
      • from arcgis.gis import GIS
      • gis=GIS()
      • map1 = gis.map(“Palm Springs, CA”)
      • map1

 

Raspberry Pi Models Tested

To date, we have used the following Pi models with the ArcGIS API for Python and Jupiter Notebooks. Brief comments follow.

Raspberry Pi 3 B+ – Quad-Core BROADCOM 64bit ARMv8 1.2 GHz 1 GB RAM

  • Demo installation above was conducted on this model.  Maps draw responsively with a slight lag on the first request.

Raspberry Pi Zero W v1.1-

  • It took about 5 minutes to run the four line script above.

Spatial Citizenship Education

I’m delighted to share a chapter with Curtis and Millsaps in this new book from Shin and Bednarz! sce_book

Spatial Citizenship Education: Citizenship through Geography (Shin and Bednarz, 2019) is the inaugural book exploring the contribution of geographic education (and geographic technologies and spatial thinking) to the development of the citizen.  It describes citizenship development through a rich understanding of spatial and geographic narratives. The book includes a history of geographic education as well as theoretical and conceptual elements of the work of geography education. Geography teachers, teacher educators, and GIS education researchers should consider this volume as a critical contribution to their well-rounded library.

 

Chapters include:

  • Conceptualizing spatial citizenship
  • Geography as a social study
  • Geography, capabilities, and the educated person
  • The spatial production and navigation of vulnerable citizens
  • Citizenship education in a spatially enabled world
  • Rediscovering the local
  • Cultivating student citizens
  • Geotechnologies and the spatial citizen
  • Informed citizenry starts in the preschool and elementary grades – and with geography
  • Spatial citizenship in the secondary geography curriculum
  • Spatial citizenship in the geography/social studies teacher education

 

Amazon link to the book.

 

 

GeoInquiries Map and Data Search

The experimental GeoInquiry search tool allows an instructional designer or advanced GeoInquiry user to search GeoInquiry maps and data for keywords (and optionally add that data to their own map).  The tool includes all Esri produced geoinquiries but also state GeoInquiries content.

For example, a search for “climate” will search the metadata (including title and description) of about 150 maps and nearly 1,000 data services while ignoring all non-GeoInquiry content in ArcGIS Online.

The database behind the tool is updated twice monthly to reflect the latest changes in map and data service metadata. Explore the tool at http://edgis.org/geoinquirysearch

screen+shot+2019-01-22+at+9.01.01+am