Felt - from collaborative map to program ...

Felt - from collaborative map to programming language (F#)

Jun 02, 2023

TLDR; Felt is a great tool for creating nice maps and collaborating on them. But it also enables simple yet powerful geojson export through plain URL change. This is all that F#, and its Type Providers need to add strongly-typed querying and analyses. I present it, obviously, in the context of the Florence libraries I'm working on.

Felt

Felt.com is a collaborative mapping tool approachable to anyone. Pretty new kid on the block of geospatial tools. I have been playing it since it was made available several months ago and liked it from the beginning.

But only recently, I found a cool application for my purposes.

Let's first look at what it does at first glance:

This is only my particular exercise, and I encourage you to check out their blog, where among features announcements, they spotlight top maps created by the community on a monthly basis.

Use case: defining people's life spaces

While working on F# tools or libraries for municipal analyses accessible to mere mortals, I need a nice way for people to define their living spaces in a city or neighborhood. To easily create a dataset of important locations and their names, convertible to geojson that can be used in F# code.

Currently, I'm pretty happy with Mapbox Autofill, where we can type addresses and optionally fix the proposed location by dragging the pin:

It looks nice, Mapbox pricing for this particular feature is not expensive, and it serves my expectations well.

But it has downsides. Determining important places by their addresses:

  • requires to specify them precisely, which is not easy for everyone

  • not every place has an address, or it is hard to figure out / obtain without further searching

  • addresses can be perceived as personal data in many scenarios

Just dragging and naming a point can be much faster, easier, more accessible, and more approachable. We don't have to use Felt for it. The most commonly used tool is geojson.io:

We don't have to modify geojson directly to provide names:

Felt advantages

Felt maps not only present the data well but tell the stories:

You create and share it easily, and you can upload everything. But even simple points serve a value.

Working with geojson data

If we want to specify simple data, felt can be the triumph of form over content.

But it has one more feature that is my favorite. Maps are shared with URL, however when you add ".geojson", you will receive a geojson content that reflects the map:

We can take that URL and pass it to Json Type Provider. In a notebook, we can first embed the map and then write the code, which improves the experience:

Now I will switch from JSON Type Provider to Florence.

Florence enables us to rank places with simple functions. It also uses some derivative of Json Type Provider to access data with more meaningful names. Instead of intercepting geometries on its own, it leverages NetTopologySuite, and enables H3 spatial indexing. There are Distance Type Provider and custom formatters to display analysis results nicely (Foursquare Studio), to name a few.

In this post, I will only use Distance Type Provider to calculate distances and travel durations between places, using their names sorely:

What it does:

  • Converts geojson URL to F# value available under name Felt. Felt value is a sequence of places with provided types/values coming from the source content:

  • Creates distance provider but only from objects defined as places in Felt geojson. I'm not interested in other polygons and routes there. Distance provider requires an attribute name, which current content doesn't have. So it is requested to use felt-text instead.

  • Mapbox token is not required for plain spatial distances, but for different traveling profiles ( walking, cycling, driving), it is needed to satisfy Mapbox Direction API used behind the scenes. And it should be used with caution. Running it for all addresses in the city can exceed the monthly free quota several times.

  • Distance Provider becomes accessible under the specified name FeltPlaces, from which we can discover the places and their distances and/or travel durations sorely through their names:

You can use anything F#/.NET allows you to do it here.

Before we finish, I will show other analyse we can do with Florence.

We can write a simple function that evaluates the value of each region in the borough using the places defined in the Felt map:

To rank all areas in Southwark (or any other borough), I will load the data through Florence.GeojsonCloud provider for London and display the results in awesome Foursquare Studio.

The comparison mode in FSQ Studio is great. Notice that we use DistanceDescriptive function in the code. Hence in tooltips, we can see these distances to all places in each hovered area:

Enjoy this post?

Buy Paweł Stadnicki a coffee

More from Paweł Stadnicki