[GRASS-user] Problems with v.external

Hello,

I am trying to use postgis datasets read-only using v.external. However, I
am having problems. Here is my command:

v.external dsn="PG:host=localhost dbname=uster user=an password=mypw"
layer=natur.naturnahe_gaerten output=gaerten

And here is my error message:

Sorry, <dbname> is not a valid parameter
Sorry, <user> is not a valid parameter
Sorry, <password> is not a valid parameter

I expected to run into problems with schemas, maybe, but not with the
login. What am I doing wrong in the dsn parameters?

Thanks for any hints,
Andreas

--
Andreas Neumann
Böschacherstrasse 6, CH-8624 Grüt/Gossau, Switzerland
Email: a.neumann@carto.net, Web:
* http://www.carto.net/ (Carto and SVG resources)
* http://www.carto.net/neumann/ (personal page)
* http://www.svgopen.org/ (SVG Open Conference)
* http://www.geofoto.ch/ (Georeferenced Photos of Switzerland)

hi Andreas,

it seems to work here. Could it be that your OGR installation is
not compiled with PG support?
ogrinfo --formats
tells you.

Markus

Andreas Neumann-7 wrote:

Hello,

I am trying to use postgis datasets read-only using v.external. However, I
am having problems. Here is my command:

v.external dsn="PG:host=localhost dbname=uster user=an password=mypw"
layer=natur.naturnahe_gaerten output=gaerten

And here is my error message:

Sorry, <dbname> is not a valid parameter
Sorry, <user> is not a valid parameter
Sorry, <password> is not a valid parameter

I expected to run into problems with schemas, maybe, but not with the
login. What am I doing wrong in the dsn parameters?

Thanks for any hints,
Andreas

--
Andreas Neumann
Böschacherstrasse 6, CH-8624 Grüt/Gossau, Switzerland
Email: a.neumann@carto.net, Web:
* http://www.carto.net/ (Carto and SVG resources)
* http://www.carto.net/neumann/ (personal page)
* http://www.svgopen.org/ (SVG Open Conference)
* http://www.geofoto.ch/ (Georeferenced Photos of Switzerland)

--
View this message in context: http://www.nabble.com/Problems-with-v.external-tf4944319.html#a14159258
Sent from the Grass - Users mailing list archive at Nabble.com.

Andreas Neumann wrote:

I am trying to use postgis datasets read-only using v.external. However, I
am having problems. Here is my command:

v.external dsn="PG:host=localhost dbname=uster user=an password=mypw"
layer=natur.naturnahe_gaerten output=gaerten

And here is my error message:

Sorry, <dbname> is not a valid parameter
Sorry, <user> is not a valid parameter
Sorry, <password> is not a valid parameter

I expected to run into problems with schemas, maybe, but not with the
login. What am I doing wrong in the dsn parameters?

For some reason the "quotes" are being removed from your command and so the PG:
settings are being treated as command line parameters to v.external. As
v.external doesn't have those options, you get the error message from the GRASS
command line parser.

Hamish

      ____________________________________________________________________________________
Be a better sports nut! Let your teams follow you
with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ

I have submitted some comments upon the documentation of
the "r.regression.line" script in
http://wald.intevation.org/tracker/?func=detail&aid=552&group_id=21&atid=207

Now I have 2 questions.

Apologies if I miss some obvious things but I am confused!

Here it goes:

1. I don't understand why (in lines 84 and 85 in the
r.regression.line script) "sumsqX=sumsqX/tot" and
"sumsqY=sumsqY/tot" ?

2. I can't understand the differences in the following... :
I created two raster maps with the same MASK, each
containing only 6 pixels with the following values:

mapA: 326 641 1336 2020 3197 3484
mapB: 432 850 931 1956 2582 2622

For mapA "r.univar" gives:
n: 6
minimum: 326
maximum: 3484
range: 3158
mean: 1834
mean of absolute values: 1834
standard deviation: 1194.44
variance: 1.4267e+06
variation coefficient: 65.1278 %
sum: 11004)

For mapB... :
n: 6
minimum: 432
maximum: 2622
range: 2190
mean: 1562.17
mean of absolute values: 1562.17
standard deviation: 866.145
variance: 750207
variation coefficient: 55.4451 %
sum: 9373)

In openoffice calc (some of) the respective results are:

For mapA:
MIN: 326
MAX: 3484
AVERAGE: 1834
STDEV: 1308,45
VAR: 1,71E+06
SUM: 11004

For mapB:
MIN: 432
MAX: 2622
AVERAGE: 156217
STDEV: 948,81
VAR: 9,00E+05
SUM: 9373

Based on r.regression.line I get

for map1=mapA and map2=mapB:

a b R N F medX sdX medY sdY
0.000458151 0.809242 0.99157 1021726 -0.98321 0.01077
5.3038 0.00917369 4.32854

and

for map1=mapB and map2=mapB:
a b R N F medX sdX medY sdY
-0.000375823 1.21498 0.99157 1021726 -0.98321 0.00917369
4.32854 0.01077 5.3038

"R" is Pearson's correlation coefficient (as correctly
defined in the script "r.regression.line" in line 83 but
wrongly expressed as "sumXY - sumX*sumY/tot" in the
print-out in line 101).

In openoffice-calc I get for these:
MapA MapB
326 432 1,350792 Slope m
641 850 0,138835 standard error of the slope
1336 931 0,959458 RSQ (Square of "r")
2020 1956 94,662802 4,000000 F value from the variance
analysis std error of regression for Y
3197 2582 8213134,001379 sum of squared deviation of
estimated Y values from their linear mean
3484 2622

or

MapB MapB
432 326 0,710293 Slope m
850 641 0,073004 standard error of the slope
931 1336 0,959458 RSQ
1956 2020 94,662802 4,000000 F value from the variance
analysis std error of regression for Y
2582 3197 4318750,949062 sum of squared deviation of
estimated Y values from their linear mean
2622 3484

(How is really r.regression.line functioning? Trying to
interpret the script is not that easy for me since I lack
of some basics in scripting)

Thank you,

Nikos.

see comments below:

Andreas Neumann wrote:

I am trying to use postgis datasets read-only using v.external. However,
I
am having problems. Here is my command:

v.external dsn="PG:host=localhost dbname=uster user=an password=mypw"
layer=natur.naturnahe_gaerten output=gaerten

And here is my error message:

Sorry, <dbname> is not a valid parameter
Sorry, <user> is not a valid parameter
Sorry, <password> is not a valid parameter

I expected to run into problems with schemas, maybe, but not with the
login. What am I doing wrong in the dsn parameters?

For some reason the "quotes" are being removed from your command and so
the PG:
settings are being treated as command line parameters to v.external. As
v.external doesn't have those options, you get the error message from the
GRASS
command line parser.

yes, this seems to be the case. Any ideas on why the quotes are removed? I
compiled against a nightly version of gdal, somewhere between 1.4.3 and
1.5. I can try with 1.5 again.

Andreas

--
Andreas Neumann
Böschacherstrasse 6, CH-8624 Grüt/Gossau, Switzerland
Email: a.neumann@carto.net, Web:
* http://www.carto.net/ (Carto and SVG resources)
* http://www.carto.net/neumann/ (personal page)
* http://www.svgopen.org/ (SVG Open Conference)
* http://www.geofoto.ch/ (Georeferenced Photos of Switzerland)

My suggestion is again to rewrite it a C program (not sure, based
on r.univar code?). I found a couple of bugs in the script and I am
(as you) not sure that it does what it promises to do).

Markus

Nikos Alexandris wrote:

I have submitted some comments upon the documentation of
the "r.regression.line" script in
http://wald.intevation.org/tracker/?func=detail&aid=552&group_id=21&atid=207

Now I have 2 questions.

Apologies if I miss some obvious things but I am confused!

Here it goes:

1. I don't understand why (in lines 84 and 85 in the
r.regression.line script) "sumsqX=sumsqX/tot" and
"sumsqY=sumsqY/tot" ?

2. I can't understand the differences in the following... :
I created two raster maps with the same MASK, each
containing only 6 pixels with the following values:

mapA: 326 641 1336 2020 3197 3484
mapB: 432 850 931 1956 2582 2622

For mapA "r.univar" gives:
n: 6
minimum: 326
maximum: 3484
range: 3158
mean: 1834
mean of absolute values: 1834
standard deviation: 1194.44
variance: 1.4267e+06
variation coefficient: 65.1278 %
sum: 11004)

For mapB... :
n: 6
minimum: 432
maximum: 2622
range: 2190
mean: 1562.17
mean of absolute values: 1562.17
standard deviation: 866.145
variance: 750207
variation coefficient: 55.4451 %
sum: 9373)

In openoffice calc (some of) the respective results are:

For mapA:
MIN: 326
MAX: 3484
AVERAGE: 1834
STDEV: 1308,45
VAR: 1,71E+06
SUM: 11004

For mapB:
MIN: 432
MAX: 2622
AVERAGE: 156217
STDEV: 948,81
VAR: 9,00E+05
SUM: 9373

Based on r.regression.line I get

for map1=mapA and map2=mapB:

a b R N F medX sdX medY sdY
0.000458151 0.809242 0.99157 1021726 -0.98321 0.01077
5.3038 0.00917369 4.32854

and

for map1=mapB and map2=mapB:
a b R N F medX sdX medY sdY
-0.000375823 1.21498 0.99157 1021726 -0.98321 0.00917369
4.32854 0.01077 5.3038

"R" is Pearson's correlation coefficient (as correctly
defined in the script "r.regression.line" in line 83 but
wrongly expressed as "sumXY - sumX*sumY/tot" in the
print-out in line 101).

In openoffice-calc I get for these:
MapA MapB
326 432 1,350792 Slope m
641 850 0,138835 standard error of the slope
1336 931 0,959458 RSQ (Square of "r")
2020 1956 94,662802 4,000000 F value from the variance
analysis std error of regression for Y
3197 2582 8213134,001379 sum of squared deviation of
estimated Y values from their linear mean
3484 2622

or

MapB MapB
432 326 0,710293 Slope m
850 641 0,073004 standard error of the slope
931 1336 0,959458 RSQ
1956 2020 94,662802 4,000000 F value from the variance
analysis std error of regression for Y
2582 3197 4318750,949062 sum of squared deviation of
estimated Y values from their linear mean
2622 3484

(How is really r.regression.line functioning? Trying to
interpret the script is not that easy for me since I lack
of some basics in scripting)

Thank you,

Nikos.
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

--
View this message in context: http://www.nabble.com/Problems-with-v.external-tf4944319.html#a14167166
Sent from the Grass - Users mailing list archive at Nabble.com.

Hi Andreas,

I had a similar problem (same error message) with postgis data, using "v.out.ogr".
Don't know why I changed the position of the first quote from

... dsn='PG:host=localhost dbname=nrw2005 user=postgres' ...
to
... 'dsn=PG:host=localhost dbname=nrw2005 user=postgres' ...
But then it worked.

Regards,

Hajo

Andreas Neumann schrieb:

see comments below:

Andreas Neumann wrote:
    

I am trying to use postgis datasets read-only using v.external. However,
I
am having problems. Here is my command:

v.external dsn="PG:host=localhost dbname=uster user=an password=mypw"
layer=natur.naturnahe_gaerten output=gaerten

And here is my error message:

Sorry, <dbname> is not a valid parameter
Sorry, <user> is not a valid parameter
Sorry, <password> is not a valid parameter

I expected to run into problems with schemas, maybe, but not with the
login. What am I doing wrong in the dsn parameters?
      

For some reason the "quotes" are being removed from your command and so
the PG:
settings are being treated as command line parameters to v.external. As
v.external doesn't have those options, you get the error message from the
GRASS
command line parser.
    
yes, this seems to be the case. Any ideas on why the quotes are removed? I
compiled against a nightly version of gdal, somewhere between 1.4.3 and
1.5. I can try with 1.5 again.

Andreas

--
chromgruen Planungs- und Beratungs- GmbH & Co. KG
Alfredstr. 51
D-45130 Essen
Telefon +49(0)201 - 185 355 0
Telefax +49(0)201 - 185 355 1
http://www.chromgruen.com
- -------------------------------------------------
Geschäftsführer: Dr. Andreas Müller
Sitz der Gesellschaft: Essen
Amtsgericht Essen HR A 8547
UStIDNr.: DE244104036

Andreas Neumann wrote:
>> I am trying to use postgis datasets read-only using v.external. However,
>> I am having problems. Here is my command:
>>
>> v.external dsn="PG:host=localhost dbname=uster user=an password=mypw"
>> layer=natur.naturnahe_gaerten output=gaerten
>>
>> And here is my error message:
>>
>> Sorry, <dbname> is not a valid parameter
>> Sorry, <user> is not a valid parameter
>> Sorry, <password> is not a valid parameter
>>
>> I expected to run into problems with schemas, maybe, but not with the
>> login. What am I doing wrong in the dsn parameters?

Hamish:

> For some reason the "quotes" are being removed from your command and so
> the PG:
> settings are being treated as command line parameters to v.external. As
> v.external doesn't have those options, you get the error message from the
> GRASS command line parser.

Andreas:

yes, this seems to be the case. Any ideas on why the quotes are removed? I
compiled against a nightly version of gdal, somewhere between 1.4.3 and
1.5. I can try with 1.5 again.

are you running it from the command line or gui? what platform? (win/lin/mac)
in a script?

Hamish

      ____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

hi Nikos,

I have replicated (partially) your experiment:

GRASS 6.3.svn (pat): > cat mapA.asc
north: 2
south: 0
east: 3
west: 0
rows: 2
cols: 3
326 641 1336
2020 3197 3484

GRASS 6.3.svn (pat): > cat mapB.asc
north: 2
south: 0
east: 3
west: 0
rows: 2
cols: 3
432 850 931
1956 2582 2622

r.in.ascii mapA.asc out=mapA
r.in.ascii mapB.asc out=mapB
g.region w=0 e=3 s=0 n=2 res=1 -p

r.regression.line map2=mapA map1=mapB -g
100%
a=-276.162
b=1.35079
R=0.979519
N=6
F=-0.827183
medX=1562.17
sdX=866.145
medY=1834
sdY=1194.44

# note the new -s flag for slow but accurate computation in
# case of FP maps

To compare, I run the same in R-stats:

library(spgrass6)
maps <- readRAST6(c("mapA","mapB"), cat=c(FALSE,FALSE))
names(maps) <- c("mapA","mapB")
mapA <- as.vector(maps$mapA)
mapB <- as.vector(maps$mapB)
lm(mapA ~ mapB)

Call:
lm(formula = mapA ~ mapB)

Coefficients:
(Intercept) mapB
   -276.162 1.351

summary(lm(mapA ~ mapB))

Call:
lm(formula = mapA ~ mapB)

Residuals:
      1 2 3 4 5 6
  18.62 -231.01 354.57 -345.99 -14.58 218.39

Coefficients:
             Estimate Std. Error t value Pr(>|t|)
(Intercept) -276.1615 247.9893 -1.114 0.327852
mapB 1.3508 0.1388 9.729 0.000625 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 294.6 on 4 degrees of freedom
Multiple R-Squared: 0.9595, Adjusted R-squared: 0.9493
F-statistic: 94.66 on 1 and 4 DF, p-value: 0.0006249

It would be good to have a bit more statistics in r.regression.line.

Best,
Markus

Nikos Alexandris wrote:

I have submitted some comments upon the documentation of
the "r.regression.line" script in
http://wald.intevation.org/tracker/?func=detail&aid=552&group_id=21&atid=207

Now I have 2 questions.

Apologies if I miss some obvious things but I am confused!

Here it goes:

1. I don't understand why (in lines 84 and 85 in the
r.regression.line script) "sumsqX=sumsqX/tot" and
"sumsqY=sumsqY/tot" ?

2. I can't understand the differences in the following... :
I created two raster maps with the same MASK, each
containing only 6 pixels with the following values:

mapA: 326 641 1336 2020 3197 3484
mapB: 432 850 931 1956 2582 2622

For mapA "r.univar" gives:
n: 6
minimum: 326
maximum: 3484
range: 3158
mean: 1834
mean of absolute values: 1834
standard deviation: 1194.44
variance: 1.4267e+06
variation coefficient: 65.1278 %
sum: 11004)

For mapB... :
n: 6
minimum: 432
maximum: 2622
range: 2190
mean: 1562.17
mean of absolute values: 1562.17
standard deviation: 866.145
variance: 750207
variation coefficient: 55.4451 %
sum: 9373)

In openoffice calc (some of) the respective results are:

For mapA:
MIN: 326
MAX: 3484
AVERAGE: 1834
STDEV: 1308,45
VAR: 1,71E+06
SUM: 11004

For mapB:
MIN: 432
MAX: 2622
AVERAGE: 156217
STDEV: 948,81
VAR: 9,00E+05
SUM: 9373

Based on r.regression.line I get

for map1=mapA and map2=mapB:

a b R N F medX sdX medY sdY
0.000458151 0.809242 0.99157 1021726 -0.98321 0.01077
5.3038 0.00917369 4.32854

and

for map1=mapB and map2=mapB:
a b R N F medX sdX medY sdY
-0.000375823 1.21498 0.99157 1021726 -0.98321 0.00917369
4.32854 0.01077 5.3038

"R" is Pearson's correlation coefficient (as correctly
defined in the script "r.regression.line" in line 83 but
wrongly expressed as "sumXY - sumX*sumY/tot" in the
print-out in line 101).

In openoffice-calc I get for these:
MapA MapB
326 432 1,350792 Slope m
641 850 0,138835 standard error of the slope
1336 931 0,959458 RSQ (Square of "r")
2020 1956 94,662802 4,000000 F value from the variance
analysis std error of regression for Y
3197 2582 8213134,001379 sum of squared deviation of
estimated Y values from their linear mean
3484 2622

or

MapB MapB
432 326 0,710293 Slope m
850 641 0,073004 standard error of the slope
931 1336 0,959458 RSQ
1956 2020 94,662802 4,000000 F value from the variance
analysis std error of regression for Y
2582 3197 4318750,949062 sum of squared deviation of
estimated Y values from their linear mean
2622 3484

(How is really r.regression.line functioning? Trying to
interpret the script is not that easy for me since I lack
of some basics in scripting)

Thank you,

Nikos.

--
View this message in context: http://www.nabble.com/Problems-with-v.external-tp14154685p15124758.html
Sent from the Grass - Users mailing list archive at Nabble.com.