[GRASS-dev] OGR SQLite question

Markus Neteler neteler at osgeo.org
Fri Aug 4 02:20:38 PDT 2017


On Sat, Jul 29, 2017 at 5:59 PM, Michael Barton <Michael.Barton at asu.edu> wrote:
[ ...]
> I'd like to export the distance matrix table
> created with v.distance -a.

You could redirect it to a file (of course a "file=" parameter would
be more elegant):

# test case, NC dataset
v.extract input=hospitals output=hospitals_test where="COUNTY='Swayne'
OR COUNTY = 'Watauga' OR COUNTY = 'Mecklenburg'"

# reduced dataset for test purpose
v.db.select hospitals_test -c  | wc -l
13

# distance matrix, incl direct export to file
v.distance -pa from=hospitals_test to=hospitals_test upload=dist
separator=comma  > matrix.csv

# verification:
cat matrix.csv
from_cat,to_cat,dist
 ,3,30,31,32,33,34,35,36,112,113,144,153,158
3,0,133276.42086464912,133041.35107619612,141872.64495940649,132555.12137443203,146710.29481383949,132452.46169504456,132808.38654187109,132674.02650356843,135717.81027315429,128054.31107769182,133073.02636643461,8321.7239556961049
30,133276.42086464912,0,566.10649525099063,14086.796281187319,938.12265075535947,13680.491183464996,1228.7359334346045,810.6623841657422,2198.585588861451,2465.1333840697835,13866.283103129103,1122.5705627816278,128211.04370485671
[...]

Best
Markus


More information about the grass-dev mailing list