Loading geojson data source

1. A concise explanation of the problem you're experiencing.
I'm new to Cesium and I have some basic questions about loading geojson data. I'm assuming the file can be located on the client and loaded by javascript. But what is the path used for loading relative to? I've put my geojson file in the root directory of my app but my app still can't find the file. The actual error message I get is: 'SyntaxError: Unexpected token < in JSON at position 0.' But it's valid json and gives me that message no matter what I set the path to, even if I delete the file

2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.


3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I want to load a file with the country shapes that I can color and label as desired.

4. The Cesium version you're using, your operating system and browser.

Cesium 1.55, Mac OS Mojave, Chrome

Welcome to the Cesium community!

I think this might be an issue in how you have your app set up. Can you try loading any of the sample data that comes with Cesium in the same way, locally, and see if it works?


Are you running with a local web server? Browsers restrict JavaScript’s access to the filesystem for security reasons.

Thanks for your response. I ultimately got it to work by just wrapping it in a function and changing the file to be a .js file. Exported the function, then imported the file where I needed it and called the function. Worked fine. I never could figure out to do it by passing a string like so:


I wondered if it was a file access issue too, but after a while, I concluded that it just couldn't find it and the error message was very unhelpful. I'm developing this in Meteor and I just can't figure out what the "context" is for that load function above.

If you can figure out how to serve static files in Meteor then you should be able to load it. From a quick google search, this looks promising:


Or it might be as simple as described here:




Thank you for your post! If you can translate this question into English, I would be happy to help you out :grinning: