Skip to content

Reading, Modifying and Writing a pmtiles file using node (preferably) #26

Discussion options

You must be logged in to vote

i tried a new approach, reading from pmtiles, writing to mbtiles, it works !

the final working code :) thx for inspiration.

`import fs from 'fs'
import path from 'path'
import { fileURLToPath } from 'url'
import { Worker, isMainThread, parentPort, workerData } from 'worker_threads'

import { PMTiles } from 'pmtiles'
import MBTiles from '@mapbox/mbtiles'
import { VectorTile } from '@mapbox/vector-tile'
import Pbf from 'pbf'
import vtpbf from 'vt-pbf'

import { lngLatToTileCoord } from '@mymap/map_utilities'

const pathToThisModule = fileURLToPath(import.meta.url)

class FileSource {
constructor(filename) {
this.fd = fs.openSync(filename, 'r')
}

getKey() {
return ''
}

async getBytes(offset, len…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by amdevelopment-world
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants