D 2013-06-01T13:40:46.252
L DXF
P d292d62d274e98a07b11799a900642ad2fc9d83f
U sandro
W 32500
back to 4.1.0-doc
For this first example we'll use Wichita Township's Parcel Data.
http://gis.sedgwick.gov/dxf/twnshpDXF.asp?08widxfWichita
step#1 - downloading the DXF input files
Now you have to create a new (possibly empty) folder, then saving into it the following DXF files you'll download:
http://gis.sedgwick.gov/pub/Aerials/section/wi27s1e/wi01lb.dxf
http://gis.sedgwick.gov/pub/Aerials/section/wi27s1e/wi02lb.dxf
http://gis.sedgwick.gov/pub/Aerials/section/wi27s1e/wi03lb.dxf
http://gis.sedgwick.gov/pub/Aerials/section/wi27s1e/wi04lb.dxf
http://gis.sedgwick.gov/pub/Aerials/section/wi27s1e/wi05lb.dxf
http://gis.sedgwick.gov/pub/Aerials/section/wi27s1e/wi06lb.dxf
http://gis.sedgwick.gov/pub/Aerials/section/wi27s1e/wi07lb.dxf
http://gis.sedgwick.gov/pub/Aerials/section/wi27s1e/wi08lb.dxf
http://gis.sedgwick.gov/pub/Aerials/section/wi27s1e/wi09lb.dxf
http://gis.sedgwick.gov/pub/Aerials/section/wi27s1e/wi10lb.dxf
http://gis.sedgwick.gov/pub/Aerials/section/wi27s1e/wi11lb.dxf
http://gis.sedgwick.gov/pub/Aerials/section/wi27s1e/wi12lb.dxf
If you wish you could eventually download even more DXF files; anyway the above selection is a good realistic staring point.
step#2 - inserting a custom Reference System
The Spatial Reference System adopted by these Parcel Data seems to be NAD 1983 StatePlane Kansas South FIPS 1502 Feet; such SRS isn't currently supported between the standard ones, so you are now required to manually insert this custom definition:
INSERT INTO spatial_ref_sys (srid, auth_name, auth_srid, ref_sys_name, proj4text)
VALUES (102678, 'ESRI', 102678, 'NAD 1983 StatePlane Kansas South FIPS 1502 Feet',
'+proj=lcc +lat_1=37.26666666666667 +lat_2=38.56666666666667 +lat_0=36.66666666666666 ' ||
'+lon_0=-98.5 +x_0=399999.9999999999 +y_0=399999.9999999999 +ellps=GRS80 ' ||
'+datum=NAD83 +to_meter=0.3048006096012192 +no_defs');
All right: now you are ready to import all DXF maps into a SpatiaLite DB.
|
You can start a DXF import session indifferently from the main menu or by pressing the corresponding toolbar button.
|
|
Now you simply have to set few import options as more appropriate:
- Please note: you can import more DXF files (actually, a whole folder) in a single step.
- DXFs have no idea at all about SRID: you are always required to explicitly set the appropriate SRID value.
- you can optionally set a prefix for all table-names to be created into the DB; sometimes it's an useful option.
- all DXF theoretically contain 3D data; anyway it's a very common case that the Z coordinate is constantly set as ZERO, so it will automatically be assumed that 2D is the more precise GeoSpatial equivalent.
- any DXF is internally structured by distinct layers: anyway it's often useful reaggregating all layers sharing the same GeometryType and Dimension in the same DB table.
|
|
As you can easily verify, after importing DXFs now two new DB tables have been created.
Please note: there are absolutely no lines within Wichita's Parcel Data; this is very uncommon and rather exceptional.
A single DB table will now contain any imported geometry of the polygon type.
Anyway the DXF import tool has carefully preserved a full track of both the origin file and the corresponding DXF layer.
|
|
A second DB table now contains all text labels; this kind of feature has no direct equivalent in GeoSpatial terms.
It basically corresponds to a point geometry associated with a text label and a rotation angle.
|
|
this is a medium scale screenshot of the imported map as rendered by QGIS
|
|
and here is an enlarged map detail of Wichita's Parcel Data
|
|
|
In this second example we'll use Parma DXF maps.
http://www.sit.comune.parma.it/ComuneParma/Cartografia%20vettoriale.aspx?idArea=2&idElenco=69
Downloading the DXF input files
Yet again, you have to create a new (possibly empty) folder, then saving into it the following DXF files you'll download:
http://www.sit.comune.parma.it/cgi-bin/files/2012/DXF_Tavole/20.zip
http://www.sit.comune.parma.it/cgi-bin/files/2012/DXF_Tavole/21.zip
http://www.sit.comune.parma.it/cgi-bin/files/2012/DXF_Tavole/22.zip
http://www.sit.comune.parma.it/cgi-bin/files/2012/DXF_Tavole/23.zip
http://www.sit.comune.parma.it/cgi-bin/files/2012/DXF_Tavole/26.zip
http://www.sit.comune.parma.it/cgi-bin/files/2012/DXF_Tavole/27.zip
http://www.sit.comune.parma.it/cgi-bin/files/2012/DXF_Tavole/28.zip
http://www.sit.comune.parma.it/cgi-bin/files/2012/DXF_Tavole/29.zip
You could eventually download even more DXF files; and finally you'll be able to start importing all DXF maps into a SpatiaLite DB.
|
Exactly as before, you simply have to set few import options:
- In the Parma case the appropriate SRID value is 23032, corresponding to ED50 / UTM zone 32N.
- Now we'll not use any prefix for DB table names.
- And we'll create many distinct DB tables, one for each single DXF layer
|
|
As you can easily check, this second DXF import has now created an impressive number of new DB tables.
Please note: one of most relevant differences between GIS and CAD layers is in that the same CAD layer can easily contain many different kind of Geometries.
This is absolutely not allowed under the more strict GIS/GeoSpatial requirements, where each single layer absolutely has to contain Geometries of the same identical type and dimension.
So a rather impressive proliferation of many different DB tables is what you can reasonably expect while importing DXF data fully respecting the original layers' layout.
|
|
this is a medium scale screenshot of the imported map as rendered by QGIS
|
|
and here is an enlarged map detail of the Old Town, just near the wonderful Baptistery of Parma.
|
|
|
Special Rings Handling (holes)
A striking difference between CAD and GIS Geometries is the one related to Polygon's interior rings (aka holes).
- The standard GIS/GeoSpatial model dictates that:
- there is always a clear and net distinction differentiating closed linestrings and polygon rings.
- every Polygon must have an exterior ring and could eventually have as many interior rings as required.
- The standard CAD model strongly differs from this:
- a single unqualified Polyline class groups altogether both open Linestrings, closed Linestrings and Polygon rings.
- a special boolean flag is supposed to be activated in order to declare an
explicit closure; when this special flag is set we can safely assume that the Polyline effectively corresponds to a Polygon exterior ring.
- there is no (simple) way allowing to define complex Polygons presenting interior rings (aka holes).
Accordingly to all this, many users / organizations have invented during the past years some useful conventional trick allowing to translate GIS Polygons into CAD Polylines (and the opposite) still continuing to fully preserve all holes without any information loss.
It looks like the two following criteria are rather popular:
- the unlinked rings conventional representation.
- the linked rings conventional representation.
|
Unlinked Rings
- All Rings belonging to the same Polygon will be simply exported into a single Polyline, just one after the other.
- Some phantom segment will appear joining two consecutive Rings.
- While parsing back the CAD Polyline, each time that a Vertex will be encountered for the second time a Ring should be considered to be completed.
- And the immediately following Segment should be discarded, because it simply corresponds to a phantom segment.
- Finally, all parsed Rings will be re-assembled into a single Polygon.
|
|
Linked Rings
- Using this more complex schema, each phantom segment requires to be traversed twice, in opposite directions.
- All segments will then require to be rearranged so to define a path respecting the above constraint.
- While parsing back the CAD Polyline, all segments traversed twice in opposite directions will be discarded.
- Finally, all remaining Segments will be re-assembled into a single Polygon.
|
|