[GRASS-user] Importing a SDTS/DLG files?

Tom Russo russo at bogodyn.org
Thu Nov 30 09:37:51 EST 2006


On Thu, Nov 30, 2006 at 07:19:24AM -0700, we recorded a bogon-computron collision of the <russo at bogodyn.org> flavor, containing:
> > James McManus wrote:
> > ..
> > > When I issue the "g.region vect=BHroads" or "v.info BHroads" I get the
> > > 
> > > following error message:
> > > 
> > > ERROR: Cannot open old vector BHroads at PERMANENT on level 2
> > > 
> 
> SDTS files contain several tables with no geometry (OGR calls them "Layers")
> that probably confuse v.in.ogr, and also contain point, line, and polygon
> features.  My guess is that v.in.ogr doesn't quite grok which things it needs
> to ignore.
> 
> When I do an ogrinfo on an SDTS road file I see:
> > ogrinfo TR01CATD.DDF 
> ERROR 4: SDTS Driver doesn't support update.
> Had to open data source read-only.
> INFO: Open of `TR01CATD.DDF'
>       using driver `SDTS' successful.
> 1: ARDF (None)
> 2: ARDM (None)
> 3: AHDR (None)
> 4: NP01 (Point)
> 5: NA01 (Point)
> 6: NO01 (Point)
> 7: LE01 (Line String)
> 8: PC01 (Polygon)
> 
> I bet if you were to use a "layer=NO01,LE01,PC01" option to v.in.ogr your
> woes would go away.  In fact, when I try to import the very same SDTS file
> above, it worked fine and gave line, point, and polygon features; the vector
> map displays Just Fine.

That particular choice of "layers" is appropriate for SDTS files that contain 
only polylines (such as road layers), but not for anything that contains 
meaningful polygons --- if you tried to use this on, say, a surface cover
layer all the attributes of the polygons would be missing because those are
in the centroids from the NA "module" (which is the SDTS terminology).  To 
get polygons with attributes you'll need to attach centroids to the polygons, 
and those are in the NA module.  You'll need to use the "type=" option to 
v.in.ogr to read in "layers" with the right types.  I'm not exactly sure how 
to do that, although I think I can guess:

  v.in.ogr dsn=<catd file> layer=NO01,LE01,PC01,NA01 type=point,line,boundary,centroid output=...

If I read the v.in.ogr help correctly, that should import the NO01 
module/"layer" as points, the LE01 module/"layer" as polylines, the PC01 
"layer" as boundaries, and the NP01 "layer" as area centroids.  But 
someone more knowledgable should step in and correct me.

-- 
Tom Russo    KM5VY   SAR502   DM64ux          http://www.swcp.com/~russo/
Tijeras, NM  QRPL#1592 K2#398  SOC#236 AHTB#1 http://kevan.org/brain.cgi?DDTNM
"And, isn't sanity really just a one-trick pony anyway? I mean all you get is
 one trick, rational thinking, but when you're good and crazy, oooh, oooh,
 oooh, the sky is the limit!"  --- The Tick




More information about the grass-user mailing list