mapbox / mapbox/mapbox-sdk-js

Trouble trying to create a Tileset Source.

Open
#406 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
768
Forks
191
PR merge metrics
No merged PRs in 30d

Description

Hi !

I'm trying to use the [createTilesetSource ](https://github.com/mapbox/mapbox-sdk-js/blob/main/docs/services.md#createtilesetsource) function in the services section, and it returns me an error:

`No file data in request. Expected 1 file named "file".`

I'm using it like that :

```javascript
import MapboxTilesets from "@mapbox/mapbox-sdk/services/tilesets";
const tilesetsClient = MapboxTilesets({ accessToken });
```
and
```javascript
async CreateTilesetSource() {
console.log("Create A Tileset Source");

const tilesetId = "newTileSet";

const data = await this.GetJsonFile();
const geoJsonData = GeoJson.parse(data, { Point: ["lat", "lng"] });
const blobFile = new Blob([geoJsonData], { type: "application/json" });

return new Promise((resolve) => {
tilesetsClient
.createTilesetSource({
id: tilesetId,
file: blobFile,
})
.send()
.then((res) => {
const tilesetSource = res.body;
console.log(tilesetSource);
})
.catch((res) => {
console.log("--- CATCH ERROR ! ---");
console.log(res.message);
resolve(null);
})
.done();
});
}
```

Thank you in advance ! : )

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with docs/services.md at the createTilesetSource entry and reproduce the supplied browser example using a Blob. Inspect how createTilesetSource handles the file argument and compare that with the request's expected file field. Done means the reported example either succeeds or the required input and limitation are clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.