Re: [GRASS-user] Connecting GRASS to a MySQL database?

2010-09-25 Thread Thom DeCarlo

Richard,
Yeah... Merge might not be the right word. I'm importing a lot of files  
downloaded from the USGS site, for example, state boundaries. There are 6  
separate files, but I want them all to go into the same database table/map  
layer. The import vector function always wants to put each import into its  
own table/layer.


Thom

Sent via DROID on Verizon Wireless

-Original message-
From: Richard Chirgwin rchirg...@ozemail.com.au
To: Thom DeCarlo pixelpus...@cox.net
Cc: grass-user@lists.osgeo.org
Sent: 2010 Sep, Fri, 24 21:46:26 GMT+00:00
Subject: Re: [GRASS-user] Connecting GRASS to a MySQL database?

 It depends on what you mean by merge.

v.patch is the official tool to merge two vectors, but you could use  
v.overlay (option=or).


Richard

On 24/09/10 10:56 PM, Thom DeCarlo wrote:

Richard,
Thanks! That was exactly the information I needed.

Now to figure out how to merge layers...

Thom

/Sent via DROID on Verizon Wireless/


-Original message-

*From: *Richard Chirgwin rchirg...@ozemail.com.au*
To: *grass-u...@lists.osgeo.org*
Sent: *2010 Sep, Thu, 23 07:20:51 GMT+00:00*
Subject: *Re: [GRASS-user] Connecting GRASS to a MySQL database?

On 23/09/10 5:13 PM, grass-user-requ...@lists.osgeo.org wrote:
 Message: 3
 Date: Wed, 22 Sep 2010 16:51:08 -0400 (EDT)
 From: PixelPusher
 Subject: [GRASS-user] Connecting GRASS to a MySQL database?
 To:grass-user@lists.osgeo.org
 Message-ID:
 Content-Type: text/plain; charset=UTF-8; format=flowed; delsp=no

 Sorry for the n00bish question, but I'm confused by the GRASS
on-line
 docs.

 I have a MySQL database running on my local computer. Let's say
that the
 MySQL user name is TRD and he has access to a database called
TRD where
 I want to store my StateBoundaries table.

 I can start the GRASS (6.4.0) Python interface and select
 Database-Manage Databases-Connect from the pulldown menu. I
am then
 faced with the choice of driver, where I select mysql. But,
then it
 needs the Database name. This is where I get lost. The string in the
 text field says, $GISDBASE/$LOCATION_NAME/$MAPSET/TRD. I'm not
sure
 where GRASS is getting the values that substitute for those
things that
 look like script variables. I guess the $LOCATION_NAME and
$MAPSET
 come from the location and mapset that I selected when GRASS
started.
 But, where is $GISDBASE set?

 I also step through the log in process by setting the
appropriate user
 name and password. I know that I can use this combination to
access the
 MySQL database through its command line interface.

 The next thing I do is try to test the connection. However, this
results
 in lots of errors like, Cannot connect to MySQL, Access denied for
 user and ERROR: Unable to open database
 $GISDBASE/$LOCATION_NAME/$MAPSET/TRD. It looks like GRASS is not
 using the right username and password and not doing the variable
 substitution that I was expecting.

 Can anoyone give me some hints on how to get this thing started?

 Thanks!
 Thom
Thom,

Having taught a few people how to use Grass-GIS, I can say that
database parameters confuse a great many of them!

The parameters you see are for the default dbf driver (Grass-GIS
uses this driver as the default for any new mapset). For MySQL,
you provide the database location, and also login.

So where you see the $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/ string,
you want:
database=host=,dbname=TRD

But you'll also have to login. Eg (command line):

db.login user=TRD password=somepassword

(the inverted commas are needed at the command line but not using
the GUI)

Notes:

1. From now on, every map you make in this particular mapset will
use the MySQL database as its default connection. Don't try to mix
different database drivers within a mapset - you'll get a headache!

2. Database parameters are stored only within the mapset you're
using. If you want to connect a different mapset to MySQL, you
have to set its connection.

Richard Chirgwin
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user





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


Re: [GRASS-user] Use variables in GUI?

2010-09-25 Thread Richard Chirgwin

 Hamish,

Being more a scripter than a programmer, I suspect g.pnmcomp is beyond 
me ... I can't really see how to pass a map to the module, and can't 
really find any examples to help.


So here's what I would like (ideally) a script to do:

1. set a variable (eg state)
for i in NSW QLD VIC; do
g.region vect=$i

2. Load gis.m with a .grc file
gis.m dmrc=Mymaps.grc

3. Pass $i to the where variable in a vector.

4. Zoom to the region.

5. Output the image to $i.png

6. Quit gis.m for the next state.

Is it feasible?

Cheers,
Richard
On 24/09/10 11:43 AM, Hamish wrote:

Richard wrote:

  This may be beyond Grass-GIS, but here goes.

nothing is impossible :-)


I have to generate many output maps (50) and I need
transparency - which means I can't just use d.vect and
d.out.file in a script.

i.e. you need blending? that is done for the GUI by the g.pnmcomp
module.
Use the PNG driver (it is map filename extension aware to avoid .png)
or d.out.file to create the files. or just use NetPBM's version of
pnmcomp yourself.



But in the outputs, I have to restrict the display to a
named area (eg: state=NSW).

So I'm wondering - is there any way within the GUI - either
TCL or Python - to use a variable within the SQL query?

That way, it may show state=$variable in the select
window, and I just need to set the variable, zoom to a
region, and produce an output rather than having to adjust
the variable in 50 or so outputs!

my only idea would be to write a script which created a GUI session
file dynamically, then load those.  but g.pnmcomp could bypass the issue?


Also of note, r.out.png in 6.5svn has a new -t flag to make the NULL cells
transparent, and a new -w flag to output a world file. r.out.tiff will get
the same for NULL cells at some point. The main reason for this is that it
makes nice rasters for WMS, TMS, gdal2tiles  OpenLayers web maps. I see
no reason why these shouldn't be backported to 6.4.1 after some quick
testing in 6.5.  (trac #1077)


Hamish







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


Re: [GRASS-user] Connecting GRASS to a MySQL database?

2010-09-25 Thread Richard Chirgwin

 Tom,

OK, you either want to use v.patch or v.overlay, and you want to do it 
via a script so you don't have to handle things manually. Well, ok, six 
files isn't too many ...


Although it can show some bad habits, v.patch is probably the better 
tool here ... eg (in Australia not the US):


v.patch input=NSW,QLD,VIC,SA,WA,TAS,NT,ACT output=Australia -e

This will fail, however, if the tables aren't identical.

Cheers,
Richard

On 25/09/10 4:23 PM, Thom DeCarlo wrote:
Yeah... Merge might not be the right word. I'm importing a lot of 
files downloaded from the USGS site, for example, state boundaries. 
There are 6 separate files, but I want them all to go into the same 
database table/map layer. The import vector function always wants to 
put each import into its own table/layer.


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


Re: [GRASS-user] Use variables in GUI?

2010-09-25 Thread Hamish
Richard wrote:
 Being more a scripter than a programmer, I suspect
 g.pnmcomp is beyond me ... I can't really see how to pass a
 map to the module, and can't really find any examples to help.

#spearfish example:
r.shaded.relief map=elevation.dem shade=elev.shade

g.region rast=elev.shade
d.mon x0
d.resize # ...


d.erase 
d.rast elev.shade
d.out.file -t output=background format=ppm

d.erase
d.rast -o fields
d.out.file -t output=overlay format=ppm


d.erase
d.vect roads
d.out.file -t output=foreground format=ppm


d.erase
d.legend -c fields thin=4
d.barscale at=62.5,94
d.out.file -t output=decorations format=ppm


g.pnmcomp input=background.ppm,overlay.ppm,foreground.ppm,decorations.ppm \
   mask=background.pgm,overlay.pgm,foreground.pgm,decorations.pgm \
   output=merged.ppm outmask=merged.pgm  opacity=1,0.5,1,0.8 \
   width=`d.info -d | cut -f2 -d' '` height=`d.info -d | cut -f3 -d' '`

#from netpbm tools, see also the man page for 'pnmcomp'
pnmtopng merged.ppm  merged.png


(GRASS's g.pnmcomp is rather poorly documented)


 So here's what I would like (ideally) a script to do:
 
 1. set a variable (eg state)
 for i in NSW QLD VIC; do
 g.region vect=$i
 
 2. Load gis.m with a .grc file
 gis.m dmrc=Mymaps.grc

use d.* instead,

 3. Pass $i to the where variable in a vector.
 
 4. Zoom to the region.
 
 5. Output the image to $i.png
 
 6. Quit gis.m for the next state.
 
 Is it feasible?

technically you could set up a gis.m .grc file from a script,
it's just a text file.. but I think you can do all you want 
with a script like the above, or just with 'd.shadedmap' +
d.out.file if the only transparency you want is between 2 raster
maps. (but it sounds like you want it for vectors..)



Hamish



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


[GRASS-user] Re: First time trying to install add on g.extension (r.stream.order)

2010-09-25 Thread Tim Michelsen
 note g.extension is rather new and untested compared the rest of
 the software, especially on Windows. Besides svn for building C
 modules, you will need a C compiler which doesn't ship with the
 GRASS installer.
What about a automtaci build process on the server?
Then the users would download a package and drop in a extension
directory or use g.extension for that task.
I mean something similar to Launchpad PPA or PyPi.


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


[GRASS-user] First time trying to install add on g.extension (r.stream.order)

2010-09-25 Thread Helmut Kudrnovsky
 I have looked through many posts and help files to no avail, if
 anyone can tell me what additional steps/programs/plugins are
 required to install addons I would really appreciate the help.

see  [http://subversion.apache.org]

some time ago I've opened a ticket in osgeo4w to include svn into the stack

note g.extension is rather new and untested compared the rest of
the software, especially on Windows. Besides svn for building C
modules, you will need a C compiler which doesn't ship with the
GRASS installer.

a C compiler is shiped with the Wingrass-installer, because all of the 
osgeo4w-build-
environment is included in the WinGrass-installer.

see output from the msys-rxvt-command-line of WinGrass64-release:

Cleaning up temporary files ...
Starting GRASS ...
WARNUNG: Attention!
WARNUNG: Locking is not supported on Windows!
 __  ___   _____
 / / __ \/   | / ___/ ___/   / /  _/ ___/
 / / __/ /_/ / /| | \__ \\_  \   / / __ / / \__ \ 
 / /_/ / _, _/ ___ |___/ /__/ /  / /_/ // / ___/ / 
 \/_/ |_/_/  |_///   \/___///  

Welcome to GRASS 6.4.0 (2010) 
GRASS homepage:  http://grass.osgeo.org/
This version running thru:   Bourne Shell (/bin/sh)
Help is available with the command:  g.manual -i
See the licence terms with:  g.version -c
If required, restart the GUI with:   g.gui wxpython
When ready to quit enter:exit

GRASS 6.4 gcc --help
Usage: gcc.exe [options] file...
Options:
 -pass-exit-codes Exit with highest error code from a phase
 --help   Display this information
 --target-helpDisplay target specific command line options
 (Use '-v --help' to display command line options of sub-processes)
 -dumpspecs   Display all of the built in spec strings
 -dumpversion Display the version of the compiler
 -dumpmachine Display the compiler's target processor
 -print-search-dirs   Display the directories in the compiler's search pat  
h
 -print-libgcc-file-name  Display the name of the compiler's companion library
 -print-file-name=lib   Display the full path to library lib
 -print-prog-name=prog  Display the full path to compiler component prog
 -print-multi-directory   Display the root directory for versions of libgcc
 -print-multi-lib Display the mapping between command line options and
 multiple library search directories
 -print-multi-os-directory Display the relative path to OS libraries
 -Wa,optionsPass comma-separated options on to the assembler
 -Wp,optionsPass comma-separated options on to the preprocesso  
r
 -Wl,optionsPass comma-separated options on to the linker
 -Xassembler argPass arg on to the assembler
 -Xpreprocessor arg Pass arg on to the preprocessor
 -Xlinker arg   Pass arg on to the linker
 -save-temps  Do not delete intermediate files
 -pipeUse pipes rather than intermediate files
 -timeTime the execution of each subprocess
 -specs=fileOverride built-in specs with the contents of file
 -std=standard  Assume that the input sources are for standard
 -B directory   Add directory to the compiler's search paths
 -b machine Run gcc for target machine, if installed
 -V version Run gcc version number version, if installed
 -v   Display the programs invoked by the compiler
 -### Like -v but options quoted and commands not executed
 -E   Preprocess only; do not compile, assemble or link
 -S   Compile only; do not assemble or link
 -c   Compile and assemble, but do not link
 -o filePlace the output into file
 -x languageSpecify the language of the following input files
 Permissible languages include: c c++ assembler none
 'none' means revert to the default behavior of
 guessing the language based on the file's extension

Options starting with -g, -f, -m, -O, -W, or --param are automatically
 passed on to the various sub-processes invoked by gcc.exe.  In order to pass
 other options on to these processes the -Wletter options must be used.

For bug reporting instructions, please see:
URL:http://www.mingw.org/bugs.shtml.
GRASS 6.4 

best regards
Helmut
___
GRATIS: Spider-Man 1-3 sowie 300 weitere Videos!
Jetzt kostenlose Movie-FLAT freischalten! http://movieflat.web.de


smime.p7s
Description: S/MIME Cryptographic Signature
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] First time trying to install add on g.extension (r.stream.order)

2010-09-25 Thread Helmut Kudrnovsky
-Ursprüngliche Nachricht-
Von: Helmut Kudrnovsky 
Gesendet: 25.09.2010 11:19:32
An: grass-user@lists.osgeo.org
Betreff: First time trying to install add on g.extension (r.stream.order)

 I have looked through many posts and help files to no avail, if
 anyone can tell me what additional steps/programs/plugins are
 required to install addons I would really appreciate the help.

see  [http://subversion.apache.org]

some time ago I've opened a ticket in osgeo4w to include svn into the stack

ah ... and i can see, in preparing the wingrass-package, all svn-exes are 
removed, see

http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/mswindows/GRASS-Packager.bat#L62

I'll remove this line and then we'll see how g.extension is working on windows.

best regards
Helmut
___
Neu: WEB.DE De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
Jetzt De-Mail-Adresse reservieren: https://produkte.web.de/go/demail02
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Unable to load gdal library error

2010-09-25 Thread Glynn Clements

Daniel Victoria wrote:

 It's strange cause I can use gdalinfo and gdal_translate on the SRTM
 tif tiles and last night I patched them using gdal_merge.py. Also,
 r.in.gdal works fine. And I can run r.info on the tiles imported using
 r.external. But I can't display them or query the values (r.what also
 gives ERROR: Unable to load GDAL library).

That error message indicates a failure to load the GDAL library at run
time via dlopen(). r.in.gdal is linked against GDAL, and r.info
doesn't need access to the raster data. You will only get the error
from modules which attempt to access the raster data for a linked
map created with r.external.

The code which loads the library attempts to dlopen() each of
following names in turn:

libgdal.1.1.so
gdal.1.0.so
gdal.so.1.0
libgdal.so.1
libgdal.so

If none of the attempts succeed, you get the above error.

The library must be listed in /etc/ld.so.cache (generated by ldconfig)
or in one of the directories in $LD_LIBRARY_PATH. Also, it must have
complete dependency information, and all of its dependencies must be
satisfied.

-- 
Glynn Clements gl...@gclements.plus.com
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Unable to load gdal library error

2010-09-25 Thread Daniel Victoria
On Sat, Sep 25, 2010 at 7:57 AM, Glynn Clements
gl...@gclements.plus.com wrote:

 Daniel Victoria wrote:

 It's strange cause I can use gdalinfo and gdal_translate on the SRTM
 tif tiles and last night I patched them using gdal_merge.py. Also,
 r.in.gdal works fine. And I can run r.info on the tiles imported using
 r.external. But I can't display them or query the values (r.what also
 gives ERROR: Unable to load GDAL library).

 That error message indicates a failure to load the GDAL library at run
 time via dlopen(). r.in.gdal is linked against GDAL, and r.info
 doesn't need access to the raster data. You will only get the error
 from modules which attempt to access the raster data for a linked
 map created with r.external.

 The code which loads the library attempts to dlopen() each of
 following names in turn:

        libgdal.1.1.so
        gdal.1.0.so
        gdal.so.1.0
        libgdal.so.1
        libgdal.so

 If none of the attempts succeed, you get the above error.

 The library must be listed in /etc/ld.so.cache (generated by ldconfig)
 or in one of the directories in $LD_LIBRARY_PATH. Also, it must have
 complete dependency information, and all of its dependencies must be
 satisfied.


I guess it's a library naming problem then because what I have inside
ld.so.chache is:

dan...@xadrez:/etc$ sudo ldconfig -p | grep gdal
libgdal1.7.0.so.1 (libc6) = /usr/lib/libgdal1.7.0.so.1
libgdal1.7.0.so (libc6) = /usr/lib/libgdal1.7.0.so
libgdal1.6.0.so.1 (libc6) = /usr/lib/libgdal1.6.0.so.1
dan...@xadrez:/etc$

Also, I don't have any of the lib names mentioned by Glynn in
/usr/lib, as you can see bellow.

dan...@xadrez:/usr/lib$ ls *gdal*
libgdal1.6.0.so.1   libgdal1.7.0.a   libgdal1.7.0.so.1
libgdal1.6.0.so.1.13.3  libgdal1.7.0.so  libgdal1.7.0.so.1.14.2

gdal16plugins:
gdal_GRASS.so  ogr_GRASS.so

gdal17plugins:
gdal_GRASS.so  ogr_GRASS.so


So, by linking libgdal.1.1.so to libgdal1.7.0.so everything came back
to normal... Well, sort of... Now, when I try r.what on the raster I
get...

WARNING: category support for [srtm_21_12] in mapset [PERMANENT] missing
ERROR: Unable to read category file of raster map srtm_21_12 in
   PERMANENT

For the record, this is part of the r.info output of the srtm tile:

Type of Map:  raster   Number of Categories: ??  |
 |   Data Type:CELL   |
 |   Rows: 6001   |
 |   Columns:  6001   |
 |   Total Cells:  36012001

Cheers
Daniel

 Glynn Clements gl...@gclements.plus.com

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


Re: [GRASS-user] Estimating Albedo from Landsat

2010-09-25 Thread Nikos Alexandris
Nikos:
...
 Downloaded:
 - extra: LT50160351988258XXX03 (includes visible clouds - maybe good for
 testing?)

# import landsat bands in wgs84, utm, zone 17
# r.proj to nc_spm_08/landsat
# set region
g.region rast=lsat5_1988.1 -p

projection: 99 (Lambert Conformal Conic)
zone:   0
datum:  nad83
ellipsoid:  a=6378137 es=0.006694380022900787
north:  361770
south:  144750
west:   463950
east:   709530
nsres:  30
ewres:  30
rows:   7234
cols:   8186
cells:  59217524

# rgb colors for 742
i.landsat.rgb r=lsat5_1988.2 g=lsat5_1988.4 b=lsat5_1988.7 strength=96
d.rgb r=lsat5_1988.2 g=lsat5_1988.4 b=lsat5_1988.7 # obvious clouds

# toar
i.landsat.toar band_prefix=lsat5_1988 method=uncorrected sensor=5 
product_date=1988-09-14 date=1988-09-14 solar_elevation=48.6773844

# acca
i.landsat.acca -5f2 band_prefix=lsat5_1988.toar output=lsat5_1988.toar.acca

# how many cats?
r.info lsat5_1988.toar.acca -r
min=6
max=9

# draw only acca cat=6
d.erase black
d.rast lsat5_1988.toar.acca cat=6 -o


In the acca result:

- clouds are detected (cat=6), not that bad(ly) I suppose. Some filtering 
could push away the (rest of the) noise. 

- obvious mis-detections (commission errors) found within
  - n=188310 s=168270 w=618870 e=636150 (bare ground? urban area? not sure 
about the confusing land cover/class here...)
  - n=219030 s=180510 w=646410 e=655740 (road)
  - in the borders due to the non-identical extent of all bands (!?)

- categories 7 and 8 seem to be empty, category 9 looks very messy

Could it be that non-cloudy acquisitions are mistreated by the algorithm? I 
can't clearly recognise clouds in the landsat scenes included in NC data set 
(both the 1987 and the 2000 scenes).

Will (then) the algorithm work (only) with (very) cloudy data?

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