FME/place

Evie Lapalme
Evie Lapalme
  • Updated

Access the App Here

Introduction

What is r/place?

r/place was a collaborative social experiment conducted on Reddit in 2017 and 2022. The idea was that a user visiting the subreddit ‘r/place’ would be able to edit the canvas by changing the color of a single pixel. The user would then be locked from performing this action again for a random period of time. The results from 2017 and 2022 can be seen here(2017) and here(2022)

We decided to see if we could recreate that project in a spatial way using FME as a project for the FMEUC 2022 Hackathon. The below article will outline how to participate in this project using only the FME platform. 
 

Please participate with Safe Software's Code of Conduct and community etiquette in mind.


Content Overview

 

Part 1: Viewing the Canvas

You can access the current state of the canvas by going to this link: https://community-fme-server-support.fmecloud.com/fmeserver/apps/FME-Place/fmeplace-view
This can also be found at the top of the results page after placing a pixel, and on the general FME Community server page. 

Part 2: Placing a Pixel

The steps below explain how to use the FME Server App: FME/place to place a single pixel on the canvas or map.

1. Access the fme/place App 
Please use the following link to access the FME Server App: FME/place
https://community-fme-server-support.fmecloud.com/fmeserver/apps/FME-Place/fmeplace-select

image.png
2. Select a Pixel Location 
Use the Geometry Parameter or ‘Select Pixel’ parameter to select a location for a new pixel to be placed. For more information on the Geometry Parameter, see the Using the Geometry Parameter in FME Server article. 
(Note: If you would like more control over where the pixel is placed, please access the ArcGIS Online Reference Map, linked at the top of the page. Each tile in the ArcGIS Online Reference Map will have a GeoJSON point coordinate that can be copied and pasted into the GeometryPicker parameter). 

image.png

3. Select a Pixel Color  
Use the ‘Fill Color’ parameter to select a pixel color.

image.png

4. Run the FME Server App
Click ‘OK’ to submit the parameters, and find your newly placed pixel on the page. 

image.png

Part 3: Using the Reference Map

Instead of following the steps in Part 1, you could select pixels by using the Reference Map. By using the reference map, you can spatially choose a pixel location and retrieve a point GeoJSON string from a tile. 

1. Open the Server App & Reference Map
Having both the Server App and Reference Map open at the same time in different tabs is essential. This allows you to view the Reference Map and input coordinates into the Server App at the same time.

2. Selecting a Pixel
This can be done by clicking on any of the boxes on the Reference Map. This will prompt a pop-up to display at the bottom right corner of the page. Copy the GeoJSON coordinates that are displayed.

image.png

3. Inputting the Coordinates
With the Server App open in the next tab and your coordinates copied to your clipboard, paste these coordinates into the Server App’s “Select Pixel” parameter. Select your color and click “OK” to submit the parameters, and find your newly placed pixel. 

image.png

Part 4: Creating Pixel Art

There are many ways to create pixel art for use in this project, we will outline some of the ways you can make pixel art in this section. If you do not have access to a Paint-like application, consider using a counter and tester to make pixel selections or a free online version such as JSPaint.

1. Download the Grid.png
Please download the grid.png image available in the Files section of this article.

2. Open the Grid Image in Paint
If you’re using a Windows operating system, you likely have access to Paint, a graphics program. Load the grid image into Paint by navigating to File > Open.

image.png

3. Fill with Color
Zoom into an area, and use the ‘Fill’ tool to color grid cells. The colors selected are important. Later in FME Workbench, we will split the drawing based on the colors used.

image.png

4. Save as a New Image
Save this file locally.

5. Duplicate and Rename the World File
Duplicate the grid.wld file. Move this duplicate to the same directory as your newly saved image. This world file should be available in the Files section of this article. This will ensure the correct coordinate system is used to read the image in FME Workbench.

Once duplicated, rename the world file to match the newly saved image file.

image.png

6. Read the Painted Grid into FME Workbench
Use a PNG Reader to read the newly painted file into FME Workbench

image.png

7. Convert Raster to Vector
Use a RastertoPolygonCoercer to create polygons. In this process, each ‘tile’ or ‘pixel’ will become a polygon. All settings can be left as default in the RasterToPolygonCoercer. 

image.png

8. Inspect the _label attribute
This attribute is created for each coerced polygon and displays a comma-separated list of the band values covered by that polygon. Luckily, alike-colored pixels will have the same value for _label.

All uncolored pixels will have the following value: ‘255,255,255,255’

Consider using a UniqueValueLogger to identify  _label values/art.

9. Use a TestFilter to Extract the Coloured Polygons
Once you’ve identified the _label values associated with your artwork, use a TestFilter to isolate and name your output ports. e.g. Test Condition: @Value(_label) = 34,177,76,255 and Output Port: shell

Note that shell and body are specific labels to the example turtle pixel drawing. 

image.png

10. Replace Polygon with Point
Use a CentrePointReplacer to convert the filtered polygons to point geometry. Add a new CentrePointReplacer for each output port on the TestFilter.

11. Extract GeoJSON Coordinates
Add a GeometryExtractor to create a GeoJSON point. Add a new GeometryExtractor after each CentrePointReplacer. Run the translation. Your workspace should look like this:

image.png

12. Start your Drawing
Inspect the _geometry attribute in the Visual Preview Window. Copy and paste a single _geometry record into the Select Pixel Server App parameter. 

Note: Don’t forget to change the color of the pixel before clicking OK!

image.png

Data Attribution

Data used in this tutorial originates from data made at Safe Software.
 

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.