How to render the data from .mvt or .vector.pbf file from scratch? - rendering

I signed up for the Mapbox vector tiles service and I've noticed that they provide map data in .mvt and .vector.pbf formats.
I tried to open these files with normal text editor and read them with the intention to see the structure and find a way to draw some parts of a map with javascript/html drawing functions. However , the files data seems unreadable for me.
How can I parse these files , and how can I draw simple map with their content ? (I read the .MVT specs here https://docs.mapbox.com/vector-tiles/specification , but I couldn't find any solution)
Note that I want to do it from scratch , without using mapbox-js or Leaflet libraries.

Related

How to store and extract images

We are having an exercise on making mobile apps. Currently, we want to render each product and have their images attached. Initially, we refer to how to save images to a folder and save their path in the DB. but the problem comes when I call the API in React which gets this binding into a variable and can't use require in the Component Image. So we are thinking about converting the image to base54 and storing it. Trouble is, this string is quite large. Can someone give me advice on solving this problem, or a link to a tutorial.

Convert - GLTF/STL/OBJ file formats to U3D file for PDF page

I am trying to add three.js based 3D objects to a PDF page. It seems there are no direct exporters available to do that. So I am trying to do the below thing,
Convert the gltf/stl/obj files to U3D files
Add the .u3d file to PDF page.
I am trying to do the below process and I am not sure whether this approach is possible. It will be a great help if there is any support available to do any one of the below conversions. Also if you know any other possible approaches, kindly update me!!
Input formats output format
GLTF
OBJ U3D
STL
(any
three.js supported
3D formats)
Thanks.
There are few options available to export the three.js graphics to a PDF ( static content not a dynamic U3D assets)
Static contents
Get the rendered data from the three.js webGL renderer / canvas renderer using toDataURL("image/jpeg"), change the MIME type to JPG/PNG and add the resulting stream as an image to PDF ( this worked for me)
example - https://plnkr.co/edit/Ty8BZaDcflCJH5tH?preview
Like the above approach we can use three.js svgrenderer to export the renderer contents into a SVG data stream, which can be added into the PDF ( textures, mesh may not be 100% reproduced)
The legacy API - "threejs-pdf-renderer" can be used to directly export the three.js animations to a PDF. We don't need any other dependencies to create the PDF. But this is a legacy API which uses legacy three.js version, lot of effort needs to be done to make the API to be compatible with the latest three.js version.
example - https://satheeshks10.github.io/ThreejsPDFGenerator/
Dynamic 3D contents
We can export the three.js animations into a U3D file (no direct support is available as for now), this U3D file can be directly embedded into PDF.
example - https://tetra4d.com/pdf-samples/

How to load a local shape or geojson file in to leaflet in Asymmetrik/ngx-leaflet?

I am using Asymmetrik/ngx-leaflet to build a map based application which can load and view external shape files. Is there any way to show local shape files?
It looks like there's a Leaflet plugin for shapefiles. I don't know if it's up to date, but you might start there.
There's also a tutorial on how to integrate third party plugins with #asymmetrik/ngx-leaflet.
Read through the examples to get a sense of how to get the plugin loaded into your Angular app. Then, you probably just need to create your shapefile layer and add it to the layers array that is bound to ngx-leaflet just like any other layer.

Is it possible to convert fabricjs svg output to pdf without rasterizing?

We are building a web app where the user can make a design by using fabric.js and at the end he should receive a pdf file with his work.
At first, we tried to use JSPDF because it was prefered to have a cliente-side solution. However by doing pdf.addImage(canvas.toDataURL(),...) we are rasterizing the design.
In second place, we tried server side solution using WKHTMLTOPDF, sending canvas.toSVG(), but there are some issues with fonts and shapes rendering.
The designs are complex as they can have text, shapes, images and svg.
We also tried INKSCAPE (inkscape --without-gui --export-pdf ...), MPDF and MUPDF without good results. IMAGEMAGICK is not a solution has it also rasterize the design.
The main goal is to get a vector pdf, where it's possible to increase size and where the elements of the design are selectable, and if possible that pdf should be ready to print (300 dpi and cmyk)
Yes its possible using TCPDF library.
Please check this ImageSVG api for more information for converting SVG to PDF.
https://tcpdf.org/examples/example_058/
Export the canvas to svg and use pdflib to make the pdf.
You can find an exemple here:https://www.pdflib.com/pdflib-cookbook/graphics/starter-svg/

Fetching PDF file content into NSString

I am working on iPad application in which i have to show PDF data into table. Firstly,I want to fetch PDF file content into NSString, how to achieve this. I tried a lot but i am unable to get it.
Thanks
You have to use Quartz2d.
Check this page of the Quartz 2D Programming Guide, it covers everything you need to open and parse a PDF file in iOS. Note that it is not a simple task, since there's no method to extract the full text in one line. You have to work with the data as an input stream, using a CGPDFScanner