I'm working on openlayers and need to change the format of dwg to GeoJSON with ArcGIS.
how can i do this?
Indeed, GDAL has the necessary tools to get this done. ogr2ogr is a program included with GDAL that can transform a variety of formats, including DWG. If you don't already have GDAL installed, here are good tutorials for windows and mac/linux. The following guide recommends converting to a DXF first, since the library for converting from DXF is included by default with GDAL. You will need to install some additional dependencies to convert directly from DWG. If you convert to DXF first, you can then use command line to convert to GeoJson:
ogr2ogr -f GeoJSON ./mynewfile.geojson ./mycadfile.dxf
If you are using ArcGIS Desktop there is a CAD to Geodatabase tool that you can use.
Even if GDAL is a good and working solution for DXF file (which are CAD files too)
Since the OOP asks about DWG file, I would suggest to use the LibreDWG library that support conversion from DWG to GeoJSON files and has very good performance.
You can use it like so :
dwgread <input_file_path> -O GeoJSON -o <output_file_path>
There are also many other commands provided by this fantastic library.
I am also currently work on an open source project Geofiles-convertor Rest API which is a REST API that aims to make popular geofiles format conversion easier.
It is also based on both GDAL and LibreDWG and there is a Docker image ready to run.
Windows Users
For Windows users, you can download the latest release from GitHub (win32.zip or win64.zip), which has dwgread.exe file.
You can then open a terminal in the downloaded folder location and run the command dwgread.exe "D:\path\to\file.dwg" -O GeoJSON -o "D:\path\to\output.json"
GDAL can be used to do this, and I want to say ogr2ogr too, but not 100%.
Possible that you also need to make match your coordinates from AutoCAD (if meter unit) to geojson (GPS coordinates).
First: lambert 93 to select part of world area you aim.
Second: 3 points to focus on affine transformations to adapt AutoCAD geometries (rotation, translation, scale).
You could have a look at this doc:
https://github.com/open-indoor/openindoor6/blob/main/AUTOCAD.md
Also, a solution for DWG to DXF (ODAFileConverter in unattended Docker):
https://github.com/open-indoor/dwg-to-dxf
Related
Do you know how to generate a draw or graph that I can convert or export in SVG from my SBML models. Or maybe directly generate SVG from SBML model wrote in XML?
I read documentation baut it doesn't help me for this projet.
There are ways to achieve that, but how useful these graphs depend on the content of the SBML file. Suppose the SBML file contains layout information in the SBML layout package. In that case, it is possible to convert it to such an image using tools such as the following:
EscherConverter
SBML Layout Viewer
If the SBML file does not contain layout information, automated layout tools can generate such graphs, e.g.,
Cytoscape with the Cy3SBML app
The online Systems Biology Format Converter (SBFC)
CellDesigner
Another option could be the MINERVA platform that generates layouts similar to that of CellDesigner and provides many options to work with SBML, e.g., via web services.
Please note:
The Systems Biology Format Converter (SBFC) creates GraphViz files for further processing. You can compile them using GraphViz and obtain SVGs based on automated layout.
CellDesigner directly supports exporting SVG. From File > Export Imageā¦ > Select SVG files and then Save. Currently, CellDesigner only supports SBML up to Level 2 Version 4. Its Layouts are often handy and can be easily manually adjusted. However, it may be necessary to downconvert the model first using SBFC. There are also importers and converters for CellDesigner that can deal with the SBML Layout package if needed, such as the CellDesigner Parser.
I would contact the Sauro lab, they have a number of tools in development that should be able to do this (including PDF). They also support the SBML layout/render extension. They are also developing a pydot to SBML converter.
I want to merge multiple tiff images into one single tiff image using nodejs/javascript.
How to get single tiff having multi-pages for multiple tiff images in nodejs?
Is there any way to convert pdf of multiple pages into one tiff image in nodejs?
I struggled to find a solution to this as well and what I learned is that there isn't really a great option. Anything you do, no matter what, will require semi-annoying dependency installations depending on where you are deploying your solution. Also, they will all use some variation of imagemagick or graphicsmagick or libtiff or some other variant I haven't seen yet.
I made a quick setup that will programmatically download image magick binaries and setup correct environment variables and paths to run imagemagick's convert cli tool programmatically through a node.js spawn command. You can check out the full repo here:
https://github.com/wolfejw86/tiff-images-playground
The short answer is this though:
get image magick or libtiff binaries into your environment
ensure your running node.js process has access to those
call the binary directly with child_process's .spawn method or use something like the gm npm module - https://www.npmjs.com/package/gm - that depends on the binary you need.
I'm building a node.js app on Bluemix that should take a pdf file as request and then grey out (blank) some part of the pdf file. And also here the pdf file is the same for all, and the area we need to blank out will be fixed. So can anybody suggest an npm module that can perform this kind of functionality?
Yes I guess the most common used library is pdf-lib. Take a look at the official page.
I suggest you to try HummusPDF. Specifically take a look at the Hummus - Modification page, that explains how to edit existing PDF documents. In your case you could try to use the feature that allows to draw shapes.
Please try Aspose.PDF Cloud SDK for Node.js available at GitHub and npm. It provides API methods for a wide range of document processing operations; including creation, manipulation, conversion and rendering of Pdf documents in the cloud. You can use Redaction Annotation to grey out the required PDF area.
P.S: I work with Aspose as Support Developer
I'm trying to create a new PNG file to serve back to clients via HTTP (as a response type image/png)
The new file is created by concatenating 3 base PNG files and adding a custom text in the middle of the image.
Problem is, there no built-in library in nodejs to do this. I spent a couple of hours searching and to my surprise, there is no pure JS library to do this. The closest thing is node-pngjs but it lacks the ability to add text. I understand that the text part is complicated since it's somewhat dependent on the OS (fonts installed, DLLs to interface with said fonts, etc).
There are other node modules that are wrappers around imageMagick (gm) and GTK (canvas) but unfortunately imageMagick is 155MB of binaries, and to use canvas you need to compile from source, install python and VS 2010 C++ Express Edition and it does not work on the lastest version of GTK.
The best I got right now is to write an .NET assembly and use it from inside node via edge.js, but that will require both Windows OS and .NET framework on the server.
Again, the complicated part here is adding the text inside the image.
Any suggestion on how to get this working without a sh**load of external dependencies?
Yes you are correct, the Node.js support for image processing libraries is weak, most are the wrappers of some CLI application.
The solution that I would use involves PhantomJS which has the canvas and svg support, you could use these features. It's lighter than the other options and does not require external applications to be installed. http://phantomjs.org/quick-start.html
I have some scripts written with d3.js that generate SVG charts. I'd like to generate those charts with a standalone program -- what is the easiest way I can convert those scripts to run in batch mode, without a browser?
You could:
Convert this to a node.js program. You'd have access to the filesystem and would be able to save generated SVGs easily. You'd need node-canvas to replace the HTML canvas. See this d3 example to get started using d3 with node.
You could use the filesystem APIs in Chrome with your existing scripts to write files to the hard disk. This may be easier, because you would just need to implement the filesystem code on top of what you have already. See this html5rocks article for information on writing to the local file system.