Hot answers tagged dxf
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 ...
6
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 ...
6
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 ...
6
FME will convert data between formats and has a good story for transforming CAD > GIS.
See: http://www.safe.com/solutions/GIS/CADtoGIS.php
Disclosure - I do work for Safe Software, the creators of FME.
But it is ideal for this scenario, otherwise I wouldn't suggest it.
As to problems with CAD into GIS, one other issue is geometry types.
CAD typically has ...
5
What are the biggest issues
I dont have the time (right now, ill try edit later) to provide a detailed answer, but the main issue with CAD data is typically, CAD technicians create plans with no regard to coordinate systems. i.e. They plot around the origin of 0, 0,
= I've work on plenty of projects where people dont understand that a bit more work is ...
5
GRASS GIS 6.4 supports import and export of 2D and 3D DXF through v.in.dxf and v.out.dxf. In GRASS-Addons there is a new prototpype for a DWG import module, based on LibreDWG.
5
There is quite a bit of missing information in your question.
Despite that here are some ideas.
1. I will assume your data is polygon. You should attempt to export the cad file as polygon and point files seperately.
The text will be your point file with the label point as the location. and the string value as an attribute.
2. use a spatial join (arcmap ...
4
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 ...
4
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 ...
4
"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 = ...
4
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:
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
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
...
4
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.
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:
...
4
Is it possible to create CAD file from shapefile and also create CAD blocks from the database fields
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/
3
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
...
3
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 ...
3
The dxf is an ascii file.
You probably could copy your orig dxf 2 times and then just delete the line section from one,
and the point section from the other.
should be group code 10.
dxf group codes
3
I do that before I load the dxf into QGIS. I use DoubleCAD XT (which is free) to export one layer at a time from the cad package.
DoubleCAD is also useful for going the other way, dxfs out of QGIS aren't very appealing to other users, but if you open them in DoubleCAD and save them as DWG I find I get better results. Often I will rebuild the layers in this ...
2
If you're just trying to get to a gis-friendly format from a DWG/DXF creator, you might try Bentley Microstation (probably with the 'Map' extension), it will import & read dwg/dxf files just fine, and can export those elements & features to a shapefile or something else you could read into a GIS package. It's a bit 'closer to the source' solution but ...
2
GDAL/OGR supports read&write for DXF, so any GIS that uses GDAL(QGIS, GRASS) should allow you to at least use that format. The only time i really use the CAD formats is exporting data for one of our engineers so i don't have much experiecne other than exporting into DXF.
There is another DWG/DXF driver for GDAL available the offers write only support, ...
2
ArcGIS can import AutoCAD data quite easily. You can use the georefencing tools if need be but often it is necessary to export the drawing to an ArcGIS format in order to utilize the spatial adjustment tools. You can also export to DXF and DNG but i am not sure how usable the files are on the AutoCAD end. I know i can open and edit them but have had problems ...
2
with the answer from Frank and the hint from the "GIS-Kompetenzzentrum" of the town of Uster (only in german)
http://gis.uster.ch/dokumentation/datenkonvertierung/ogr
I have figured out that PostGIS to dxf can be done like so:
ogr2ogr -f DXF $TITLE$.dxf PG:"dbname='$DBNAME$' host='$HOST$' port='$PORT$' user='$USER$' password='$PASSWORD$'" -sql "select ...
2
I believe this can be accomplished in QGIS .
However I use cad software with my gis software and would do the following in it.
Either way you need some basic information about the dxf.
1. You should know the units of the dxf.
2. You should have a set of known points in the dxf. (at the very least 2 points).
1a. If the original coordinate system (or ...
2
I have been trying to find a way of doing this for months. In the end, the only method I could find was to load the DXF into gvSIG and export it as a shapefile. Doing this adds the linestring z-value to the shapefile's DBF as an attribute.
In my case, the DXFs were OS OpenData containing contours, along with other data that I did not require, so I extracted ...
2
To lighten some happy mood, I suggest you to use FME Server. Since FME is a very powerful engine, your conversion should be done without much complexion. Figuratively, numerous format can be selected here. But bear in mind that the files should be organized. Otherwise, it would means nothing.
Click here: ...
2
Just picking this up because no one else has, not because I have much experience with DXFs.
An example. I have a mixed geometry DXF called su66.dxf. One of its layers, G8040201, contains contours that I wish to extract to a shapefile. I can do this using ogr2ogr:
ogr2ogr su66.shp -where "LAYER='G8040201'" su66.dxf
This is fine if you happen to know the ...
2
It sounds like you have some major batch processing and therefore, I would be inclided to script this. Doing this all by hand might be feasible but a pain. At least with a script, if you muck something up you can just correct the script and re-run. Also, you have a chance to unify a lot of the non-standard naming etc by using regular expressions and ...
2
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 ...
Only top voted, non community-wiki answers of a minimum length are eligible

