GeoSwarm : project to serve Maps with IPFS

Hello. I’m try to adapt openlayers to download TiledMaps via IPFS.
I’m using js-ipfs, and my code is there https://github.com/RDiegoSuarez/GeoSwarm-client

This is a very early stage,

But i have a problem. My app doesn’t see tiles until i have downloaded them from another tab in https://ipfs.io/ipfs/HASH/file_path.

Any suggestion ?

May be there is others similar projects that i can contribute instead of developping a solution from scratch.

2 Likes

Hello, again. Does anybody have an an idea about my problem ?
This is a kind of google maps using IPFS to store and get the tiles.
But js-ipfs in the browser isn’t really working…

hello i run your project

in log i have that :

/ipfs/QmWPvCEnSkGR8iTs6uiZSNkbupbv7sz3MV5mKW3erHYVZa/world/z0/0_0.png
ipfs.js:80 GOT => 0_0.png

correct log or not ?

Regards

I tried it locally with Firefox and I got an OpenLayers instance showing a world map the first time i opened it.

hi in my side i use google chrome

Hi.
Thank you both for your test.

Yes a map is on screen. But if you “zoom” and “move” you will see pixelization.
That’s because openlayers is doing a “soft zoom” with previous zoom image as a basis
But the true tile is not coming until i access it directly from ipfs.io

You can debug this via the console.
After some zoom and move, you see the request message, but no “GOT” msg.

I don’t understand why.

I’d take OpenLayers out of the equation for finding the issue. I did the following from the web console:

node.files.get('/ipfs/QmWPvCEnSkGR8iTs6uiZSNkbupbv7sz3MV5mKW3erHYVZa/world/z0').then((data) => { console.log('data:', data) }).catch((err) => { console.log('error:', err)})
> Promise { <state>: "pending" }
> data: Array [ {…}, {…} ]

node.files.get('/ipfs/QmWPvCEnSkGR8iTs6uiZSNkbupbv7sz3MV5mKW3erHYVZa/world/z1').then((data) => { console.log('data:', data) }).catch((err) => { console.log('error:', err)})
> Promise { <state>: "pending" }

So on z1 the Promise was always “pending”, it never resolved or errored.

Then you open a tab, or a new browser, and go to
https://ipfs.io/ipfs/QmWPvCEnSkGR8iTs6uiZSNkbupbv7sz3MV5mKW3erHYVZa/world/z1

And … magic ! The answer is coming back in your console …

A ressource is “downloadedable” by js-ipfs only if a “true” node have already seen it.

I’ve tried it again, now zooming in and out works correctly for me. I don’t know if it’s due to visiting the link above or something got fixed. Can you try it again?

Hi.
I’ve developed a little script that do a wget for each tiles on ipfs.io.
That the only solution i’ve found for now.

May be it is because js-ipfs is not finished yet.
For example, the DHT is not implemented.

I will release a new data soon.
I will see if there is another way

But, thank you vmx …