Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DXF file can't be saved as SHP #16782

Closed
qgib opened this issue May 26, 2013 · 12 comments
Closed

DXF file can't be saved as SHP #16782

qgib opened this issue May 26, 2013 · 12 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Vectors Related to general vector layer handling (not specific data formats)

Comments

@qgib
Copy link
Contributor

qgib commented May 26, 2013

Author Name: John Sankey (John Sankey)
Original Redmine Issue: 7910
Affected QGIS version: 1.8.0
Redmine category:vectors


I've got a DXF file:
Storage type of this layer: DXF
Source for this layer: /Users/john/QGIS/OVPP/OAK VALLEY Drawing.dxf
Geometry type of the features in this layer: Line
The number of features in this layer: 1708
Editing capabilities of this layer:
Extents:
In layer spatial reference system units : xMin,yMin -357.179,-760.168 : xMax,yMax 16008.1,6793.72
Layer Spatial Reference System:
+proj=utm +zone=18 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs

It displays on the screen partly correctly - line features are shown correctly but all labels, such as in legends, are replaced by a single line for each label.

When I save as SHP, it creates:
Storage type of this layer: ESRI Shapefile
Source for this layer: /Users/john/QGIS/OVPP/oakvalley.shp
Geometry type of the features in this layer: Line
The number of features in this layer: 0
Editing capabilities of this layer: Create Spatial Index, Fast Access to Features at ID, Change Geometries
Extents:
In layer spatial reference system units : unknown extent
Layer Spatial Reference System:
+proj=utm +zone=18 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs


@qgib
Copy link
Contributor Author

qgib commented May 26, 2013

Author Name: Giovanni Manghi (@gioman)


on QGIS master it gives error while exporting to shape, but it gives also a result (attached). Please try and report back. Cheers.

Export to vector file failed.
Error: Feature write errors:
Feature creation error (OGR error: Attempt to write non-linestring (POINT) geometry to ARC type shapefile.)
...
Feature creation error (OGR error: Attempt to


  • status_id was changed from Open to Feedback
  • 5779 was configured as test.tar.gz

@qgib
Copy link
Contributor Author

qgib commented May 26, 2013

Author Name: John Sankey (John Sankey)


DXF can contain points, lines and polygons - this one comes from an AutoCAD user. (So can WKT, which I also tried to use for another user's maps earlier - see #16614.) QGIS needs to creat three layers for this DXF, one pont, one line, one polygon. It doesn't, and that's why it fails. This is not only a bug, but a blocker for bringing in these AutoCAD maps. I attach a PDF from the user showing what the result should look like, also a GIF of what I get in QGIS 1.8 with this file.


  • 5783 was configured as OAK_VALLEY_A1_Drawing-Model.pdf
  • 5784 was configured as ovpp.gif

@qgib
Copy link
Contributor Author

qgib commented May 26, 2013

Author Name: Alessandro Ciali (Alessandro Ciali)


I tried to import the dxf file as it is, obtaining the same error. but, performing the following feature subset:
"SubClasses" = 'AcDbEntity:AcDbLine' OR "SubClasses" = 'AcDbEntity:AcDbPolyline' OR "SubClasses" = 'AcDbEntity:AcDbCircle' OR "SubClasses" = 'AcDbEntity:AcDbCircle:AcDbArc'
and then saving layer as shape, I obtained the polyline shape attached.
Performing a feature subset:
"SubClasses" = 'AcDbEntity:AcDbText'
In order to isolate the only text features, I was able to correctly represent text in QGIS, but when I tried to export the layer as shape, I was prompted by:
|Export to vector file failed.
|Error: Feature write errors
reported in your previous messages. It seems that QGIS tries to import text layer in a line shape:
|Feature creation error (OGR error: Attempt to write non-linestring (POINT) geometry to ARC type |shapefile.)
regardless of text layer feature type (point, see the project attached); this can be the problem.
BTW, I can't open the dwg file in autocat (autocad LT 2009), so check the Autocad version, It could be an unsupported one.
Please, give a feedback so that we can refine the problem


  • 5785 was configured as OAK.zip

@qgib
Copy link
Contributor Author

qgib commented May 27, 2013

Author Name: John Sankey (John Sankey)


I've asked the user for his version. In the meantime, here is the native DWG of AutoCAD.
The drawing was originally in Drafix CAD - it was bought by AutoCAD and shut down; the user migrated to AutoCAD Lt 2008 which is what has produced his DWG and DXF.


  • 5788 was configured as OAK_VALLEY_Drawing.dwg

@qgib
Copy link
Contributor Author

qgib commented May 27, 2013

Author Name: Alessandro Ciali (Alessandro Ciali)


I exported the DWG to dxf2000 version. I exported then to shp without problem (see attached shape).
The problem was surely related to dxf version. Used QGIS current master, but it works the same with 1.8

In order to correctly export dxf layer to shape, I suggest to follow these steps:

  1. open dxf in QGIS;
  2. make a feature subset depending on type of feature you are interested (then, you have to reset the symbology type (point, line, area), maybe it could not be the right one);
  3. Save as the layer

I think that you can close this ticket.


  • 5791 was configured as OAK_VALLEY_Drawing_text2.zip

@qgib
Copy link
Contributor Author

qgib commented May 27, 2013

Author Name: John Sankey (John Sankey)


Alessandro, how do I do step 2 within a DXF layer? (With 1700+ features, it can't be one by one...)

Also, when I save-as there is no option to set SHP type to point,line or polygon - I can only do that when I create a new SHP.

@qgib
Copy link
Contributor Author

qgib commented May 27, 2013

Author Name: Alessandro Ciali (Alessandro Ciali)


  1. About step 2: in layer properties you can find Feature subset. You have not to do one by one, but define a query on "Subclasses" field of dxf layer like:
    |"SubClasses" = 'AcDbEntity:AcDbLine'
  2. There is no option to set SHP type on save as, the type is automatically determined on the type of feature you are saving. That's why you have to make a subset query on the feature type before save.

@qgib
Copy link
Contributor Author

qgib commented May 27, 2013

Author Name: John Sankey (John Sankey)


Alessandro, I can't find anything about this in the user manual. I tried the exact phrase you quote and it wiped out many of the lines as well as all points and labels. What are the subclass statements for Polygons, Points, multiline, multipoint etc.? And, how do I get labelled points, which are most of the features on this map?

This is definitely a workaround method, not one that should be considered as final in a stable version of QGIS...

@qgib
Copy link
Contributor Author

qgib commented May 27, 2013

Author Name: Alessandro Ciali (Alessandro Ciali)


Hi jhon, the user manual does not contain anything about this because this is a workaround that I use for representing CAD drawing in QGIS. I found this way through some attemps. I attached a QGIS project, you have only to reconnect the dxf you find to the project. See how I have represented the different layers (based from different subclesses of the same dxf file).


  • 5792 was configured as OAK2.zip

@qgib
Copy link
Contributor Author

qgib commented May 27, 2013

Author Name: Giovanni Manghi (@gioman)


This is definitely a workaround method, not one that should be considered as final in a stable version of QGIS...

There are well known issues around DXF files, please see

http://lists.osgeo.org/pipermail/qgis-developer/2013-February/024592.html

and add your notes. Cheers!

@qgib
Copy link
Contributor Author

qgib commented May 28, 2013

Author Name: John Sankey (John Sankey)


Hi all: please do not close this thread. Here's why:

Until very recently GIS systems were far too expensive for individual professionals - of course I thank all those working on QGIS for dramatically changing that. What it meant was that all of us involved in mapping looked for an affordable system, usually one we needed for other work, that allowed numeric data from field surveys to be entered. I started in the '60s with Fortran programs I wrote myself, and transitioned to the 1980's SigmaPlot when it became available. The output of many, such as SigmaPlot, can be converted with a script to WKT - but see #16614 for my problems with that. The next person I tried used AutoCAD, which outputs in DWG (closed, proprietary i.e. useless for open source) and DXF; you can see here the problems with it. I'm certain the next user I try will use yet another available numeric-based system.

QGIS needs to work on dealing with these old ersatz methods to allow us all to move to the far superior control of output that a true GIS gives. But in particular, it needs to provide continuing solid support for numerical data from surveys - these continue to be produced by all surveyors.

WKT would probably be the most flexible if someone would be willing to work on it to make it solid, as it's easily written directly by anyone with survey data in hand - most of us keep our fieldbooks. My most recent user has his original survey data, so it might well be easier for me to rewrite it in WKT rather than deal with the uncertainties of unknown-vintage DXF or who knows what next format.

Many thanks all - I'll do my best to work with Alessandro's work.

@qgib
Copy link
Contributor Author

qgib commented Jun 21, 2014

Author Name: Jürgen Fischer (@jef-n)


  • status_id was changed from Feedback to Closed
  • category_id was configured as Vectors

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Vectors Related to general vector layer handling (not specific data formats) labels May 24, 2019
@qgib qgib closed this as completed May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Vectors Related to general vector layer handling (not specific data formats)
Projects
None yet
Development

No branches or pull requests

1 participant