Places, Planet & Earth Engine: Hacktober 2018

Samapriya Roy
6 min readOct 17, 2018

--

I was hoping that in between working on my dissertation problem solving and writing tools to get my mind off might be a much-needed distraction. I know I should be focusing but for me this is relaxing and when I heard about “Hacktoberfest” online I thought of it as a fruitful escape. The concept of Places, Planet and Earth come from the combination of place search (capability of searching by an address or city name), data search using Planet’s Data API and combining it with Google Earth Engine’s(EE) Data Catalog. The tool allows you to search by a city name for example and find out images within a given time period without the need to download any additional geometry files, and search Planet’s Data API to get image footprints, in combination to an EE dataset list that I maintain , it also allows you to export the datasets that intersect the place you searched and the number of assets it intersects.

Hacktober 2018 Place to Planet & EE CLI

You can find the tool here, you don’t need to setup you can browse into the folder and run directly but the tools does allow you to setup

git clone https://github.com/samapriya/hacktober2018.git
cd hacktober2018 && sudo pip install -r requirements.txt
cd place2planet
python place2planet.py

If you would like to setup

git clone https://github.com/samapriya/hacktober2018.git
cd hacktober2018 && python setup.py install

Before you do this make sure of a few things

  • Your system has native python available in terminal or command prompt depending on what kind of system you are using. You can check this by typingpython --version
  • Git is installed on your system. For windows you can find installation here
  • Earth Engine Command Line(earthengine cli) interface is installed, instructions are in the developer page
  • Check git is accessible via your system path type git help and check if the system can reach installed git command line tools.

For now, this is still very much a work in progress so be advised about a couple of things

  • It works better with cities, don’t ask for a geometry too large like a country name.
  • For now, it queries only the first 250 assets on Planet’s search result since I built it as a fast query for maybe images in the last couple of days rather than exporting images for thousands of images. Pagination is not included but it is definitely in the works.

What here is what it can do, you can look for addresses and search by relevance, it uses the open street map geocoding service instead of Google Maps Geocoding which now requires you to setup billing on your account.

Getting to the Guts

Places and Planet was an obvious choice. For now Planet provides a python client to help you download imagery and you can pass it a geometry along with date and cloud filters to narrow down images. The idea was to integrate a geocoding service which generates a geometry, and use that geometry to then search for datasets. The implementation included simplifying the geometry into a bounding box and an importance score of 70% or more if the search returns multiple results.

You can pass addresses in multiple ways

For example: 1070 Partners Way, Raleigh, NC , and for the whole city with simple Raleigh, NC. If you know your city name to be unique you can simple pass that too.

place2planet CLI

While the first two tools get you setup with Planet’s API key and Google Earth Engine authentication both search and footprint allow you to interact with data query.

Search & Footprints

This is an easy concept, if you would like to export the geometry or a bounding box around an address as a GeoJSON file you can use this tool to export the GeoJSON file with coordinates.

place2planet search finction

The footprint function goes further and not only does this tool fetch the boundary of the area you are looking at but is capable of exporting image footprints for all images intersecting your area of interesect as a GeoJSON file. Using an online services like geojson.io to open and display the file.

place2planet footprint tool

This tool further allows you to search by start and end date and item type to build the query better. In the future I hope to implement an iterator so it can perform this search for monthly, yearly or weekly assets. A simple setup would be the following

python place2planet footprint --place "Raleigh,NC" --item "PSScene4Band" --start "2018-10-01" --end "2018-10-17" --local "C:\johndoe\raleigh_fp.geojson"
Exported Footprint for PSScene4Band for Raleigh, NC October 1 to October 17 2018

Earth Engine Tools: Refresh and Intersect

This tools is designed to two things, the refresh tool allows the user to get a copy of a machine parsable version of the Google Earth Engine Dataset Catalog which I maintain and update every week along with a list of your own personal assets. Once you have earthengine client authenticated, simply run

python place2planet.py refresh

The intersect tools is part of an earlier project that I created to allow you to export Earth Engine assets and has been modified so it can read the place geometry directly. The tool exports a list which includes all EE assets including your private GEE assets and creates a csv file with the asset ID, number of items that intersect.

place2planet intersect tool

Similar to the footprint tool, it allows you to pass a start and end date to aid filtering and further allows you to use a bounding box if you feel you need it. A simple setup would be the following

python place2planet intersect --place "Raleigh,NC" --item "PSScene4Band" --start "2018-10-01" --end "2018-10-17" --local "C:\johndoe\intersectlist.csv"
Snippet from all EE assets that intersect Raleigh, NC geometry and their Number

The spatial search by name and intersect with geometry feature in Earth Engine is an interesting implementation because you currently cannot search for all datasets that intersects with an area atleast not directly. While this tool has some potential application for me this was experimenting with how we think of places in texts and not in GeoJSON and kml files and allow the user to interact with two of my most used API and API clients.

If you find this tool or guide useful please click the clap 👏 button below to show your support! and if you have used it to recreate something or to create better workflow, let me know. I have been told creating these tools, doesn’t fit into my PhD portfolio or my todo lists, I hope some will find these tools useful and I will still find the need to create, collaborate and engage with others.

--

--

Samapriya Roy

Remote sensing applications, large scale data processing and management, API applications along with network analysis and geostatistical methods