[GRASS-dev] Direct OGR access requires layer and is unclear about read only

Vaclav Petras wenzeslaus at gmail.com
Tue Sep 1 15:31:21 PDT 2015


Hi,

in the source code I stumbled on direct OGR access and realized that I
don't know what it is. I haven't found any documentation (now I think there
might be something on the wiki) but at the end I remembered I've seen it
(probably lately for the GSoC idea) and figured out that you can do the
following:

# prepare data
v.random output=direct_ogr_test -z npoints=10
v.out.ogr input=direct_ogr_test output=direct_ogr_test.shp

# magic
v.info direct_ogr_test.shp at OGR layer=direct_ogr_test

This is pretty cool. There are just some issue and my question is weather I
should create tickets for them.

1) You need to specify layer, in my case it was the same as filename
without suffix. This took my some time to find out. Perhaps natural for
GDAL/OGR, not so much for common users.

2) It gives strange errors when you use it for output.

# note @OGR in output
v.clean input=direct_ogr_test.shp at OGR output=direct_ogr_test_clean at OGR
tool=rmdac layer=direct_ogr_test

# gives (which is not true):
ERROR: option <output>: <direct_ogr_test_clean> exists. To overwrite, use
the --overwrite flag

# note @OGR in output and --o
v.clean input=direct_ogr_test.shp at OGR output=direct_ogr_test_clean at OGR
tool=rmdac layer=direct_ogr_test --o

# gives:
ERROR: Output vector map name <direct_ogr_test_clean at OGR> is not in the
       current mapset (manual)

Which is at least right but perhaps not 100% fitting the OGR case.

3) Is the above read-only limitation necessary? I suppose it is not
implemented but now the code is shared for reading with the external/link
driver for reading. The issue is of course writing to different Mapset. I
don't like to potential mess in code and increased complexity in
documentation and in writing checks (e.g. in GUI). However, it would be
nice to find a way our it.

4) I haven't tried GUI much but v.clean went through. Unfortunately, you
cannot browse the file as a user. I guess this is a feature worth putting
there. Some ideas on that would be good. Or is there a reason for not
having it there?

5) I guess some documentation is needed. Perhaps even a separate page.
Maybe we can try to replace text in manual "direct OGR access" in modules'
pages by a link to that page when building the pages.

6) The name OGR might not be really the right thing anymore since OGR
merged more under GDAL if I'm following the website properly. We should
consider this before writing the documentation or putting it to GUI.

Thanks,
Vaclav
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20150901/647623c7/attachment.html>


More information about the grass-dev mailing list