Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

278
Views
Por qué decodificar el MVT usando el perfil de especificación es diferente de usar su paquete python

Estoy decodificando algunos prototipos de búfer de Mapbox. Ver especificaciones . En Python, puedo hacer esto bastante fácilmente con:

 import mapbox_vector_tile mapbox_vector_tile.decode(buffer)

Y obtengo el siguiente JSON:

 { "default":{ "extent":4096, "version":2, "features":[ { "geometry":{ "type":"Point", "coordinates":[ 1208, 2556 ] }, "properties":{ "original_address":"11919 Jamaica Ave, Jamaica, NY 11418, EE. UU." }, "id":0, "type":1 }, ] } }

PERO, si hago lo mismo en Javascript, con el siguiente código:

 async function decodeMessage(buffer) { const PROTO_FILE = await protobuf.load("vector_tile.proto"); const testMessage = PROTO_FILE.lookupType("vector_tile.Tile"); const err = testMessage.verify(buffer); if (err) { throw err; } const message = testMessage.decode(buffer); return testMessage.toObject(message); }

Siendo el vector_tile.proto el archivo de la especificación 2.1 (o la 2.0 , no importa). Obtengo el siguiente resultado:

 { "layers": [ { "name": "default", "features": [ { "tags": [ 0, 0 ], "type": 1, "geometry": [ 9, 2416, 3080 ] }, ], "keys": [ "original_address" ], "values": [ { "stringValue": "Haags Kwartier 55, 2491 BM Den Haag, Netherlands" } ], "extent": 4096, "version": 2 } ] }

No entiendo por qué esta diferencia en el formato. Supongo que el paquete python hace algún procesamiento adicional. ¿Es ese el caso? ¿Hay alguna manera de obtener el mismo resultado en javascript?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!