Problem reading from my pod a geojson file

Hi everyone!! My team and i are having some problems reading a geojson file we have already uploaded to our pod. The url works well but we can’t access to the content at fechtDocument function, don’t know why. We’ll appreciate your help. Thanks!!

Hi @Bojarguez, that looks like you’re using Tripledoc, no?

Tripledoc reads RDF data, e.g. data you’ve also written to your Pod using Tripledoc or a different RDF library. I’d recommend to take a couple of minutes to work through this tutorial to understand more about what it does.

In this case, your geojson file is not RDF data, I presume? In that case, you’ll probably want to use the more generic fetch function from solid-auth-client, which behaves just like the browser’s fetch. Thus, it’d look more like:

      .then(response => response.json())
      .then(content => routeDocument = content);

(Note also that you don’t need await if you call .then().)

1 Like

I guess it’s necessary there so in the rest of the for-loop body routeDocument can be used. You could also switch to only using await there (but I guess that’s a matter of taste):

const res = await solidAuthClient.fetch(folder.files[i].url)
if (!res.ok) {
  // error handling
const routeDocument = await res.json()

Apart from that, I think Vincent’s answer is on point :))