Question

Mapbox Vector tiles (MVT) to GeoJSON, incorrect coordinates GeoJSON file


I have tried to convert two MVT files to GeoJSON, however the coordinates are not correct, should be in Sweden but end up in Africa. Have tried multiple files with the same result. Not sure what I am doing wrong, attached GeoJSON. Link to MVT file https://drive.google.com/drive/folders/1RQvwMqTYG4n_Ow1Pp-NvK8BspsQkzfXg?usp=sharing (could not upload)


7 replies

Userlevel 6
Badge +32

Do you know what the source coordinatesystem should be? Because it defaults to Pseudo Mercator EPSG: 3857 and the coordinates look like 1514, 3711. You have to set the correct coordinate system in the reader to get the features on the correct location.

The source coordinateesystem is 3006 (SWEREF99 TM), I have set the coordinate system in the reader to EPSG:3006. Is this wrong?

Userlevel 6
Badge +32

The source coordinateesystem is 3006 (SWEREF99 TM), I have set the coordinate system in the reader to EPSG:3006. Is this wrong?

The way of working should be correct, but I can reproduce your problem with the data / crs. I must admit I have no experience with MapBox vector tiles so I can't say what is happening, but it feels like both tiles are on a local system as the coordinates are so close to zero. But the files seem to overlap correctly.

Badge +2

@mikamattila​ There is often a metadata.json file that goes along with the .mvt files. This would include the correct offsets. Perhaps ask you data provider if they have those files.

@mikamattila​ There is often a metadata.json file that goes along with the .mvt files. This would include the correct offsets. Perhaps ask you data provider if they have those files.

Thank you!

@mikamattila​ There is often a metadata.json file that goes along with the .mvt files. This would include the correct offsets. Perhaps ask you data provider if they have those files.

@Mark Stoakes​  I found this information

<TileMatrix>

<ows:Identifier>10</ows:Identifier>

<ScaleDenominator>14285.71428571428623399697</ScaleDenominator>

<TopLeftCorner>8500000.000000 -1200000.000000</TopLeftCorner>

<TileWidth>256</TileWidth>

<TileHeight>256</TileHeight>

<MatrixWidth>4096</MatrixWidth>

<MatrixHeight>4096</MatrixHeight>

</TileMatrix>

Not sure how to use it to convert the MVT files to GeoJSON with the correct coordinates, do you know?

Badge +2

@Mark Stoakes​  I found this information

<TileMatrix>

<ows:Identifier>10</ows:Identifier>

<ScaleDenominator>14285.71428571428623399697</ScaleDenominator>

<TopLeftCorner>8500000.000000 -1200000.000000</TopLeftCorner>

<TileWidth>256</TileWidth>

<TileHeight>256</TileHeight>

<MatrixWidth>4096</MatrixWidth>

<MatrixHeight>4096</MatrixHeight>

</TileMatrix>

Not sure how to use it to convert the MVT files to GeoJSON with the correct coordinates, do you know?

@mikamattila​ It should just read the file if it's in the correct format. But otherwise you could use the Offsetter and Scaler to place the data correctly I think - but those values didn't seem to work for me.

Reply