Open Street Map on IPFS

Hello everyone, it is the first time i write here, kind of newbie to ipfs.
I am developing an application that needs to show locations on a map, i have it already working, but i am hosting the .png tiles which i get from openstreetmap through a local proxy.

Ok, some context:
If you want to show a map on your application, for instance, like this OpenStreetMap you have the option to use .png files organized by zoom levels and tiles.

The tiles for the entire world are many, which means that storage and network transmission are two things you have to think about when you are developing such an application.
Now, openstreetmap .org has all the tiles in their own servers, they are altruist people and they give them to you for free, yet they advice you to not to use their servers as your application tile server, you know, they pay for it …

A simple solution is to proxy and cache requested tiles.
When your server receives a tile request from your client application, it checks if it already has it cached, if so, it checks for an expiration date (we configure somewhere), if both checks are true, we serve the cached tile, else, we request it from openstreetmap, cache it, set an expiration date, and serve it to our application client.

An expiration date is needed because the tiles are not static, they change, slowly over time as the real streets change and people update the corresponding tiles in openstreetmap.

There are several http tile server services, some paid, some for free (as osm)
You can configure your application’s map handler to use those servers, for instance, you can use [https]://openlayers.org/ as your map handler and configure a tile source server let’s say [https]://exmple.io?x={x}&y={y},
or [https]://a.tile.openstreetmap.org/{x}/{y}/{z}.png
where ‘x’ and ‘y’ are variables.

Example time: https://a.tile.openstreetmap.org/6/32/22.png

I wonder if a similar application already exists on the ipfs ecosystem, but i wasn’t able to find anything working.

I know, it would be possible to take a snapshot of the entire world, add it to ipfs and weekly publish it to a ipns name, let’s say Qmfdjskjdhf, so we could be able to change
from [https]://exmple.com?x={x}&y={y}
to [https]://some-randomly-choosen-ipfs-gateway.io/ipns/Qmfdjskjdhf/{x}/{y}
or simply /ipns/Qmfdjskjdhf/{x}/{y}

I thought, maybe i can run a ipfs node, use my peerid to publish a directory, and at some point (maybe when other nodes are searching for my peerid), i think my node will receive some kind of request asking for Qmfdjskjdhf/{x}/{y}, then execute the proxy system to add new tiles to ipfs, if needed.
Sounds like it is not possible, i bet you have to have the content before publishing something to ipns

Is there something similar already done
is it even possible ?

Do i have to try the “weekly updated entire world” way ?

Thank you very much

1 Like

Very interesting project :slight_smile:

Some thought were gathered on the topic here:

2 Likes

For the static tiles it is possible to address data on IPFS using a X/Y/Z folder structure (TMS style) this can also achieved for Vector tiles which each tiles is defined already

1 Like

Ok, since i wasn’t able to find anything working, i decided to try to do something about it …
I created a cheap tile server based on ipfs … it is a hybrid between classic and distributed web … it will be modified to be as distributed as it can, but the good news is that it can be done with a ubuntu installed on a old iMac with 1TB HD, meaning that the system could be, not too hard to spread over different developers who need a free tile server, and, replication of this system would help it self … the main feature is that the map is dynamic (meaning that the map changes over time) tiles would update every 14 days, depending on the number of times a tile is requested …
Take a look at this simple example map,
http://pulsartronic.duckdns.org/

I have an apache along with a ipfs node … every request, it adds files (if needed) to ipfs and responds with a http redirection to a randomly chosen gateway … (the list is short and static, by the moment) and i think it would be nice to, also, communicate with the network through js-ipfs by creating an instance in the browser …

It is a simple start, still many things to do

Try it … don’t expect speed, specially if it is the first time your region is accessed

https://github.com/chinanzio/ipfsmap there i will be doing what i can :slight_smile:

bye

2 Likes

Sorry I’m very late !
But i’ve already post something about IPFS and map tiles

2 Likes

@chinese @Diego was wondering if you guys are still working on this? If not, what was the obstacle?