-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
2D & 3D geometry from CSV to DXF and vice versa #9080
Comments
Just so I'm not chasing my tail when I look into this, could you please clarify:
I assume one of these "2D" is meant to be "3D"? |
...; the LINESTRING control word is actually responsible for 2D output. 2D-DXF: 3D-DXF: |
There seem to be both |
What I get with 3.8.3 and master is:
so the potential debatable cases are -nlt LINESTRING and -nlt LINESTRINGZ that don't lead to expected geometry types |
…etType (in particular fix POLYGON -> LINESTRING or POLYGON -> LINESTRINGZ) (fixes OSGeo#9080)
with #9083, I now get:
|
…etType (in particular fix POLYGON -> LINESTRING or POLYGON -> LINESTRINGZ) (fixes OSGeo#9080)
Does a Conda environment for gdal version 3.9.0 exist? |
once this PR is merged, you'll be able to use https://gdal.org/download.html#gdal-master-conda-builds |
Sorry for the delay. The following development environment for gdal 3.9 works for me: Automatic install micromamba:[https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html?highlight=Automatic%20install#automatic-install]
GDAL 3.9.0dev-468125c1ce-dirty, released 2024/01/21
Now to the actual analysis.I have changed the geometry data in the input file import.csv in the Z values: "POLYGON Z (( Start GDAL test environment:
The stream output is ok:
GEOMETRY,Layer Transformation from CSV to DXF and back:
Geometry: Unknown (any)
Geometry: Unknown (any) As a result, the Z values are lost in the transition to DXF. Only an averaged height (777777.02555) is calculated and only displayed in two dimensions in the DXF. Z values were expected, as declared in the import file (import.csv). A makefile and log are attached. |
note that this does not test the changes of pull request #9083, since it is not merged yet |
Thank you. Now I understand. |
OGRGeometryFactory::forceTo(): make it honour dimensionality of eTargetType (in particular fix POLYGON -> LINESTRING or POLYGON -> LINESTRINGZ) (fixes #9080)
This is a follow-up ticket to #9060 "3D geometries from a CSV file to a DXF no longer works with version 3.8". It clarifies the ogr syntax for converting from a 3D CSV file to a 3D DXF. Many thanks for the help to @rouault and @atlight.
In the attached example (makefile) I have worked through four variants (L.dxf P.dxf LZ.dxf PZ.dxf). It examines how a DXF is generated from a spatial polygon (rectangle) in CSV format (import.csv) using the OGR commands LINESTRING, LINSTRINGZ, POLYGON and POLYGONZ. The sequence for the targets (L.dxf P.dxf LZ.dxf PZ.dxf) in the makefile first tries to generate a DXF from the source "import.csv" and then to generate a CSV from the DXF. Ideally, the output CSV should look exactly like the input CSV. As an example, the targets "make P.shp ZP.shp P.gpkg ZP.gpkg" run without errors in order to convert a CSV into an ESRI shapefile or geopackage and back.
Kind regards
Expected behavior and actual behavior.
As a result, I only get the variant "test_3.8.2_ID_LINESTRING_dxf.dxf" in 3-D format. Interestingly, the OGR command
ogr2ogr -f "DXF" -nlt LINESTRING out_ID_LINESTRING_dxf.dxf import.csv -dialect sqlite -sql "SELECT ID as Layer, geometry from import";
is actually responsible for a 2D output. The three other variants generate 2D geometries; I would expect a 3D geometry for the targets LZ.dxf and PZ.dxf.Steps to reproduce the problem.
An example can be found in the tar. The Makefile contains the commands I used.
2024.01.14 convert.error - dxf.tar.7z.zip
Operating system
chris@ber24:~$ inxi -SMrb
System: Host: ber24 Kernel: 5.10.0-26-amd64 x86_64 bits: 64 Desktop: Cinnamon 5.6.8 Distro: LMDE 5 Elsie
Machine: Type: Laptop System: Medion product: P7815 v: 1.0 serial:
Mobo: Medion model: P7815 v: 1.0 serial: UEFI: American Megatrends v: 504 date: 09/29/2012
CPU: Info: Quad Core Intel Core i7-3632QM [MT MCP] speed: 2178 MHz min/max: 1200/3200 MHz
Graphics: Device-1: Intel 3rd Gen Core processor Graphics driver: i915 v: kernel
Device-2: NVIDIA GK107M [GeForce GT 640M] driver: nvidia v: 470.199.02
Display: x11 server: X.Org 1.20.11 driver: loaded: modesetting,nouveau unloaded: fbdev,vesa
resolution: 1920x1080~60Hz
OpenGL: renderer: Mesa DRI Intel HD Graphics 4000 (IVB GT2) v: 4.2 Mesa 20.3.5
Network: Device-1: Intel Centrino Wireless-N 2230 driver: iwlwifi
Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet driver: r8169
Drives: Local Storage: total: 14.26 TiB used: 6.72 TiB (47.1%)
Repos: No active apt repos in: /etc/apt/sources.list
Active apt repos in: /etc/apt/sources.list.d/official-package-repositories.list
1: deb http://packages.linuxmint.com/ elsie main upstream import backport #id:linuxmint_main
2: deb https://deb.debian.org/debian bullseye main contrib non-free
3: deb https://deb.debian.org/debian bullseye-updates main contrib non-free
4: deb http://security.debian.org/ bullseye-security main contrib non-free
5: deb https://deb.debian.org/debian bullseye-backports main contrib non-free
Active apt repos in: /etc/apt/sources.list.d/qgis.sources
1: deb deb-src [arch=amd64] https://qgis.org/debian bullseye main
Active apt repos in: /etc/apt/sources.list.d/winehq-bullseye.sources
1: deb [arch=amd64 i386] https://dl.winehq.org/wine-builds/debian bullseye main
Info: Processes: 323 Uptime: 2d 18h 46m Memory: 7.64 GiB used: 3.47 GiB (45.4%) Shell: Bash inxi: 3.3.01
GDAL version and provenance
GDAL 3.8.2, released 2023/16/12 installed with conda/micromamba {micromamba create -n gdal gdal pcraster -y -c conda-forge}
The text was updated successfully, but these errors were encountered: