Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Hot answers tagged

12

You georeference rasters and affine vectors :) QGIS has an affine plug-in (qgsAffine) with which you can scale vector layers. You can also apply x and y offsets to all of the vertices in a vector layer if required. I think you will probably need to convert your DXF to a shapefile to use it though (right-click on the layer in the layers panel and go 'Save as....


12

"Layer" is an just an attribute of the feature. But you can use OGR SQL and attribute filters: import ogr driver = ogr.GetDriverByName('DXF') datasource = driver.Open('test1.dxf', 0) layers=datasource.ExecuteSQL( "SELECT DISTINCT Layer FROM entities" ) layer=datasource.GetLayerByIndex(0) for i in range(0, layers.GetFeatureCount()): layerName = ...


11

I stumbled upon your question while trying to do the same thing, here's how I did it: Software used: Inkscape QGIS 2.2 Affine Transformation plugin for QGIS Extracting vector data from PDF It's what you have already done, basically just open the PDF in Inkscape, find the shapes you want and remove all backgrounds and surrounding text. Save as .dxf file. ...


9

Easier then I thought (thanks to BenjaminGolder for the tip): ogr2ogr -f "DXF" Contours.dxf Contours.TAB -zfield Height Contours.TAB is the input MapInfo tab file.


9

Benjamin, DXF (as supposed by OGR) does not support arbitrary GIS attributes. It has a fixed schema that looks like: Layer: String (0.0) SubClasses: String (0.0) ExtendedEntity: String (0.0) Linetype: String (0.0) EntityHandle: String (0.0) and only a few of these are actually examined on write. The simpliest expedient is just to use the -skipfailures ...


9

Another - more interactive - option is the Vector Bender plugin. It does to vectors what georefencers does to raster. This feature is also known as "rubber sheeting". There is even a video showcasing how it works: https://vimeo.com/96142479


9

I'm a little bit late, but hope it helps. Tuts and books If you want something learn about ogr, gdal, python and postGIS you can look at first on these pages and book. Geoprocessing with Python using Open Source GIS http://www.gis.usu.edu/~chrisg/python/ ogr http://www.gdal.org/ogr/ ogr2ogr - cheatsheet http://www.bostongis.com/?content_name=...


7

BTW, if you appreciate Shapely, you may also appreciate Fiona. The Fiona example in https://gist.github.com/1886782 could be adapted to convert a shapefile to DXF. with fiona.collection("file.shp", "r") as source: with fiona.collection( "file.dxf", "w", driver="DXF", schema=source.schema, ) as ...


7

Shapely doesn't directly support exporting to DXF - it supports export to Well Known Text (WKT), Well Known Binary (WKB), Numpy arrays and GeoJSON objects (interoperation from the Shapely manual). As such you need a package that can transform from one of these formats to DXF. I'd suggest OGR as the way to go for my money. The easiest method would be to ...


7

There is now native export into DXF in newer versions of QGIS which allows to export map layers including the labels: More about the functionality can be found here: https://www.qgis.ch/en/projects/dxf-export The DXF export functionality was developed by Jürgen Fischer (Norbit) and Marco Hugentobler (Sourcepole AG). The project was co-financed by SIGE (...


7

If you want to get a 3D DXF from a SHP (SHPfile generated from DTM with Qgis-Processing-Tools-GDAL/OGR Extraction-Contour), you must: 1) have column with Z values into Table attributes of SHP. 2) open "OSGeo4W Shell Commands" if you have Windows OS. 3) write into shell for example: ogr2ogr -f "dxf" d:\Temp\3Doutput.dxf d:\Temp\contour.shp -zfield ELEV ...


6

autocad map 3d will easily geo-reference your dwg/dxf files and allow conversion to 12 gis formats. Unless you add FME desktop also (FME extsion for ArcGIS). Then with FME extended to arcmap and autocad you have all ~275 formats. But doing it through map3d you have access to some particularly useful tools. (i.e. select by layer, color, linetype, or even ...


6

Given that your autocad version is 12+ years old it may be an issue with autocad dwg or dxf file format version (major format version: http://en.wikipedia.org/wiki/.dwg#Version_history). You should try to open it in a newer version of ACAD, or try saving it into an older format.


6

When you generate the contours in QGIS, make sure that you tick the Attribute name box. Then when you ogr2ogr (you must use command line - this is not an option in QGIS Save AS), specify the zfield. For example, if your elevation attribute is "ELEV", then your command could look something this: ogr2ogr -f "DXF" contours-out.dxf contours.shp -zfield ELEV ...


6

When talking about having only contours in 3D dxf, the proper way is definitely NOT extracting the vertices as XYZ and interpolating the surface from points. That way you lose the information about how are the points connected which at least leads to losing some detail or it can be even worse. If you use Dxf2xyz and you don't want to lose information I ...


6

Miro's answer will work fine, but if you just want to add a Z value to your attributes table (perhaps for labeling in a map or some other reason), I would start as he suggests: v.in.dxf - to import contours including z dimension (SQLite works well as an output format) Now instead of rasterizing, use the field calculator to pull the Z value from the 3D ...


5

In QgiS: rightclick in left panel on layer and use save as and select Autocad dxf as export format - this works for me. areyou using qgis 1.8? edit: I now also tried "save selection as", seems to work too edit #2 : I enclose a screenshot from qgis: and one screenshot from inkscape with the imported dxf-file:


5

It seems to me that the main problem for you is to introduce some order to your tons of DWG/DXF files with information (in several layers). Regardless of choosing software/tool I can recommend you to describe your data. Here is some thoughts: You should develop some kind of unique codes for all types of your features. It can be one attribute or several or ...


5

I think you best bet is to stick with 2003 ASCI DXF. This is the format that I have always used and it works fine. Also depending on your needs you might not need the Dxf2Shp plugin as QGIS (using OGR) can open .dxf file directly via the Add Vector Layer button.


5

Here is another workflow, using ogr2ogr with GCP points: Extract the lines as svg (as above) load into inkscape and save as dxf Load into QGIS, with EPSG:31467 as CRS Read a couple of coordinates from significant edges of the surrounding city border Open OSM editor JOSM and download the relation 62591 of the city border Save that as GPX Load the border into ...


5

As far as I know, which may not be very far, you can't do that. An mxd is a separate document from the data it contains. Many CAD programs can use shapefiles, although again you wouldn't get symbology. For text, try converting it to annotation and maybe that will export to CAD. Do this on a copy of your data. I'm more used to bringing CAD into Arc than Arc ...


4

The v.in.ogr.dxf module of GRASS (also available in QGIS trough the QGIS/GRASS plugin) works better (in same cases) than the OGR driver (that QGIS uses to handle DXFs). Once imported it in a GRASS location/mapset you can easy export by just clicking "save as...".


4

If you want the labels in CAD, here's a workaround (you're not being very specific as to what you're trying to accomplish). In ESRI, create a point file for the centroid of each label. Populate the label field in the attribute table. Next, in a "map capable" version of AutoCAD, tpye "mapconnect" in the command line. This will bring up the screen shown ...


4

Python is case sensitive and gdal/ogr doesn't really follow the Python PEP8 naming conventions. "getZ" is not an ogr.Geometry method, "GetZ" is what you are looking for. >>> help(ogr.Geometry.GetZ) Help on method GetZ in module osgeo.ogr: GetZ(self, *args, **kwargs) unbound osgeo.ogr.Geometry method GetZ(self, int point = 0) -> double >&...


4

Since you have the Data Interoperability extension, you can create a ETL tool to load all the dxf's into a gdb (or another format of your choice), just check the help section of Data Interop. Might find something helpful read also here- http://www.esri.com/software/arcgis/extensions/datainteroperability


4

QGIS does not manage Z coordinates importing CSV files. You can convert the CSV to DXF using ogr2ogr from the command-line shell. This should be already installed since QGIS uses OGR too. You need to create a .vrt file along your CSV. This is a plain-text file that you can create with any text editor. It is really easy in your case: <OGRVRTDataSource&...


4

You can't do it from within QGIS itself but you can do it this way: http://nathanw.net/2011/05/05/3d-dxf-using-ogr/ ogr2ogr -f "DXF" {outFile} {inFile} -zfield {ColumnWithZValue}


4

FME can do Shape to AutoCAD Blocks This was modified (for FME 2013) from the original on FMEPedia http://fmepedia.safe.com/articles/How_To/Creating-AutoCAD-Blocks-with-FME Product: FME Desktop http://www.safe.com/fme/fme-technology/fme-desktop/overview/


4

You can try the GRASS command v.in.dxf in Processing or in the Grass plugin (look at GRASS GIS: import DXF). Some results in GRASS GIS with 3D dxf files: from Vector support in GRASS GIS: Möbius strip visualization to show the 3D vector capabilities of GRASS 6 - imported from 3D DXF (screenshot: M. Neteler) or geological layers (3D dxf) (my work from ...


4

You can accomplish it by using the QGIS Vector Bender plugin, which allows you to translate, rotate, scale, and even distort (if necessary) your original DXF layer. Basically, you will need to provide the plugin with a line layer representing pairs of points (one pair per line) that are the basis of the transformation. For instance, take a corner of the ...


Only top voted, non community-wiki answers of a minimum length are eligible