In this post I present Florence,
a low-code geospatial library for everyone that ranks city places with (life-inspired) functions.
Florence heavily laverages .NET Interactive/Polyglot Notebooks runtime to hide and execute code behind the scene (including breaking some language constraints).
Florence is still an experimental library, alpha release is due 24th Dec.
Geospatial isn't hard, it is rather not accessible for a novice.
You may think that certain tools are expensive, reserved for municipal departments, and that advanced programming is required (in languages you don't necessarily like).
You can also treat this domain as (a little bit) boring.
Geospatial might be hard and boring
...unless you are not aware that you are doing geospatial.
Surprisingly a lot of geospatial analysis boils down to the question "what is the best place for/to ... (anything)?".
Also surprisingly to answer this very generic question, we can write a very simple function!
A function that takes place (or facility) and returns its value.
Such a function can be run against all well-known city districts, blocks, or custom areas.
How to get this data? "You said your library is for everyone but I don't have data-related digital skills...".
Correct, with Florence you don't care about data retrieval and types, you have it on hand. Just think about having fun(ction).
Florence requires at least one data file to be located in a geojson folder of your VS Code workspace. Once you load the Florence package, your files are loaded and you have strongly-type access.
Notebook's author can share all geojson files along with the notebook. However I created a special geojson.cloud, so you can explore and download necessary files directly from the F# cell:
Under the cover it is some sort of a simplified Azure Storage Type Provider but with a capability to share cloud data without sharing the cloud access keys.
It is very handy, discoverable, and useful especially for bigger datasets, like addresses. Every dataset has necessary license data on folder or file level:
The function of your life
To do your analysis, you need to write just one function, like the function of your life. Such an activity is not just for fun, it can have many real applications. Imagine all residents are able to write it among plain data querying and joining: we can get exhaustive, the most powerful municipal platform possible.
As everything that Florence expects is a geojson, your life also must be defined in geojson file. Don't be scared, there will be a nice, graphical way to define your life space directly in the notebook:
For the time being, as most of us do not live in Zurich, we can ... rand our lifespace.
Once the cell is executed, quite a lot of magic happens under the cover. You put names of all your important places in a list, their locations are randed, and the special type called MyCityLife is created. When you feed the type with some location, you will get distances to your important places via their names.
The clue here is that those places can be anything, any citizen can name it differently.
Having your city life space type on your disposal, you can write the proper analytical function:
This function will be different for many people, even for the same person it can change overtime (there are times when we don't necessarily need our parents-in-law to be close, but it will dramatically change when children arrive).
You can run your function against the same or any other geospatial file containing city places:
Distance Type Provider
MyCityType used in the calculation is in fact a type created by a special F# Type Provider. It gets all geojson feature's properties and calculates the spatial distance to another provided location.
There are more applications for this than the presented function of life. You can get the distance between certain places similarly to asking plain questions (example for F1 fans, all you need is a single geojson with F1 tracks):
You can also measure a trip:
In this post, I did focus on applying the function of life for geospatial purposes.
But this is only the tip of the iceberg of what you can do with Florence. The main capability is to include more data in the calculation. What if the best place should be determined based on route count of the 3 nearest stations ?
The tricky part is to join datasets in a readable, succinct manner. You can use the full F# power here. I'm pretty sure F# developers will have fun with it.