Re: [GRASS-user] Unable to locate Tk includes

2010-10-18 Thread Maris Nartiss
tk-dev and tcl-dev

Maris.

2010/10/18, Chethan S chethanuniver...@gmail.com:
 Greetings!

 I am trying to install GRASS Release branch 6.4 from SVN on Ubuntu. At then
 configure stage, I use the command

 ./configure --with-tcltk-includes=/usr/include/tcl8.5
 --with-proj-share=/usr/share/proj

 But I get the following error at the very last stage:
 checking for location of Tcl/Tk includes... /usr/include/tcl8.5
 checking for tcl.h... yes
 checking for tk.h... no
 *configure: error: *** Unable to locate Tk includes.*

 I tried adding the parameters to the above command -
 --with-tcltk-libs=/usr/share/tcltk -- in this directory I have tcl8.4,
 tcl8.5, tk8.4, tk8.5, tcllib1.12, tklib0.5 directories
 --with-tcltk-libs=/usr/include/tcl8.5

 If I search for file named tk.h, such a file does not show up anywhere in
 the file system. Is there any package I have to install to rectify this.

 Regards,

 Chethan S.
 --
 Chethan S.

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


[GRASS-user] Calculating mode value for each polygon

2010-10-18 Thread Monica Buescu
Greetings

I have an image that is divided in several (300) polygons and, using a
data_map raster, I want to calculate the mode value from this image for each
polygon. Is it possible? can anyone give me a tip on this?

Thanks

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


[GRASS-user] Re: Which version is advisable - SVN or stable, Unable to locate Tk includes

2010-10-18 Thread Chethan S
Greetings!

Which version is advisable - SVN or stable
I took Mr. Neteler's suggestion and now have GRASS GIS 6.4.1svn(2010)
running. Also I could start the R package from within GRASS.2.

Unable to locate Tk includes
Mr. Martin's suggestion definitely works. However I found an effective
answer to such issues from ask ubuntu where I had posted the question
http://goo.gl/82LE. I was suggested to install apt-file tool which enables
one to search for missing files easily using apt-file search* filename*
command. This suggestion proved to be very effective as I could solve some
more missing file problems. Hope this will help GRASS users facing similar
problems in future.

Thanks and regards,

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


Re: [GRASS-user] Calculating mode value for each polygon

2010-10-18 Thread Micha Silver


  
  
On 18/10/2010 10:11,
  Monica Buescu wrote:

Greetings
  
  
  I have an image that is divided in several (300) polygons
and, using a data_map raster, I want to calculate the mode value
from this image for each polygon. Is it possible? can anyone
give me a tip on this?
  
  

Have a look at v.what.rast. That might be what you're looking for.

  Thanks
  
  
  Monica
  
  This mail was received via Mail-SeCure System.
  

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

This mail was received via Mail-SeCure System.






-- 
Micha Silver
http://www.surfaces.co.il/
Arava Development Co.  +972-52-3665918

  

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


Re: [GRASS-user] Calculating mode value for each polygon

2010-10-18 Thread Monica Buescu
I don't think so.. What I want is to calculate the mode (most frequent
value) of a raster file for each polygon that this raster covers. What I
will have is the most frequent raster value that falls inside each polygon.
Is kind of a univariate statistic of a raster for each polygon.

Any ideas?
(thanks Micha for your suggestion)

On Mon, Oct 18, 2010 at 10:19 AM, Micha Silver mi...@arava.co.il wrote:

  On 18/10/2010 10:11, Monica Buescu wrote:

 Greetings

  I have an image that is divided in several (300) polygons and, using a
 data_map raster, I want to calculate the mode value from this image for each
 polygon. Is it possible? can anyone give me a tip on this?

  Have a look at v.what.rast. That might be what you're looking for.

 Thanks

  Monica

 This mail was received via Mail-SeCure System.


 ___
 grass-user mailing 
 listgrass-u...@lists.osgeo.orghttp://lists.osgeo.org/mailman/listinfo/grass-user

 This mail was received via Mail-SeCure System.





 --
 Micha Silverhttp://www.surfaces.co.il/
 Arava Development Co.  +972-52-3665918


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


Re: [GRASS-user] Calculating mode value for each polygon

2010-10-18 Thread Daniel Victoria
This should be done by v.rast.stats but, from the manual I don't think
it includes mode...

On Mon, Oct 18, 2010 at 8:32 AM, Monica Buescu
monicabuescu1...@gmail.com wrote:
 I don't think so.. What I want is to calculate the mode (most frequent
 value) of a raster file for each polygon that this raster covers. What I
 will have is the most frequent raster value that falls inside each polygon.
 Is kind of a univariate statistic of a raster for each polygon.
 Any ideas?
 (thanks Micha for your suggestion)

 On Mon, Oct 18, 2010 at 10:19 AM, Micha Silver mi...@arava.co.il wrote:

 On 18/10/2010 10:11, Monica Buescu wrote:

 Greetings
 I have an image that is divided in several (300) polygons and, using a
 data_map raster, I want to calculate the mode value from this image for each
 polygon. Is it possible? can anyone give me a tip on this?

 Have a look at v.what.rast. That might be what you're looking for.

 Thanks
 Monica
 This mail was received via Mail-SeCure System.

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

 This mail was received via Mail-SeCure System.




 --
 Micha Silver
 http://www.surfaces.co.il/
 Arava Development Co.  +972-52-3665918


 ___
 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] Calculating mode value for each polygon

2010-10-18 Thread Monica Buescu
Uhm That is a pittty. Is anyone planning on developing this?

On Mon, Oct 18, 2010 at 12:33 PM, Daniel Victoria daniel.victo...@gmail.com
 wrote:

 This should be done by v.rast.stats but, from the manual I don't think
 it includes mode...

 On Mon, Oct 18, 2010 at 8:32 AM, Monica Buescu
 monicabuescu1...@gmail.com wrote:
  I don't think so.. What I want is to calculate the mode (most frequent
  value) of a raster file for each polygon that this raster covers. What I
  will have is the most frequent raster value that falls inside each
 polygon.
  Is kind of a univariate statistic of a raster for each polygon.
  Any ideas?
  (thanks Micha for your suggestion)
 
  On Mon, Oct 18, 2010 at 10:19 AM, Micha Silver mi...@arava.co.il
 wrote:
 
  On 18/10/2010 10:11, Monica Buescu wrote:
 
  Greetings
  I have an image that is divided in several (300) polygons and, using a
  data_map raster, I want to calculate the mode value from this image for
 each
  polygon. Is it possible? can anyone give me a tip on this?
 
  Have a look at v.what.rast. That might be what you're looking for.
 
  Thanks
  Monica
  This mail was received via Mail-SeCure System.
 
  ___
  grass-user mailing list
  grass-user@lists.osgeo.org
  http://lists.osgeo.org/mailman/listinfo/grass-user
 
  This mail was received via Mail-SeCure System.
 
 
 
 
  --
  Micha Silver
  http://www.surfaces.co.il/
  Arava Development Co.  +972-52-3665918
 
 
  ___
  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


[GRASS-user] Re: Wingrass 6.4 with MSYS does not work

2010-10-18 Thread Daniel Victoria
Sorry to revive a very old tread but I just found out why WinGrass was
not working for me so I though I should documment it somehow. I had a
leftover environment variable due to an old Cygwin instal but it was
NOT in the system path... There was a variable called CYGWIN with the
value set to tty. I removed that and now everything works.

Cheers
Daniel

On Tue, Jul 6, 2010 at 1:05 PM, Daniel Victoria
daniel.victo...@gmail.com wrote:
 I have no idea how mingw got into the path. Can't find it in my system
 environment variables. removing it from the path will not change the
 GNU Bash (Cygwin) line but now I don't see that bunch of python erros
 on screen. All it does is, after I select the location, it will start
 grass, tell me that wxvdigit does not work in windows and then gives
 me a Goodbye from Grass. The next line shows:
 $ Quit wxGUI. Grass is not running.

 Could other python installs be messing this up (python 2.4 from ArcGIS)?

 Thanks
 Daniel

 On Tue, Jul 6, 2010 at 10:47 AM, Luigi Ponti lpo...@inbox.com wrote:
 Dear Daniel,

 On 06/07/2010 14:03, Daniel Victoria wrote:

 Another thing I just noticed looking at grass64svn script

 ArcGIS has set the variable PYTHONPATH=C:\Program Files (x86)\ArcGIS\bin


 I don't know, but there seem to be no PYTHONPATH string in the my GRASS
 installation folder.

 Could that be related?

 On Tue, Jul 6, 2010 at 8:54 AM, Daniel Victoria
 daniel.victo...@gmail.com wrote:


 Hi all,

 I don't see any leftover cygwin instalation in my path. I even tried
 removing python(xy) to see if that was the culprit.
 Here are some of the environmental variables set in the msys shell
 that I believe influences grass:


 PATH=.:/usr/local/bin:/mingw/bin:/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/c/Program
 Files (x86)/OpenSSH/bin:/c/Windows/System32


 There is a mingw thing that may be where bash.exe comes from. Why do you
 need mingw in GRASS MSys? Wingrass has its own copy of MSys, and should not
 need to point to /mingw/bin or anything else related to unix shell.
 Kind regards,

 Luigi


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


[GRASS-user] Re: Calculating mode value for each polygon

2010-10-18 Thread Luisa Peña
well I don't know if I'm going to say something foolish but, how about
r.mode? is it applicable?
From the description is not very clear
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Re: Calculating mode value for each polygon

2010-10-18 Thread Micha Silver


  
  
On 18/10/2010 15:23,
  Luisa Pea wrote:

well I don't know if I'm going to say something
  foolish but, how about r.mode? is it applicable?
  From the description is not very clear
  

Bingo!
The vector polygon map should be converted to raster and that raster
will be used and the "base" parameter to r.mode. The original image
"data_map" will be the "cover" parameter. And the output raster will
hold mode values for each polygon region.

  This mail was received via Mail-SeCure System.
  

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

This mail was received via Mail-SeCure System.






-- 
Micha Silver
http://www.surfaces.co.il/
Arava Development Co.  +972-52-3665918

  

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


Re: [GRASS-user] Re: Calculating mode value for each polygon

2010-10-18 Thread Sylvain Maillard
hello,

something strange, i was quite sure to have send a response but it seems
something goes wrong ...

I wrote a little script that use r.mode:
- convert the vector with polygon to raster
- loop for each polygon
- get the mode and update the specified column in the vector file

it process only one polygon at a time and is quite slow, but do the job ;)

cheers,
Sylvain

[code]
#!/bin/bash

# vector with polygon
vect=Parcellaire
# name of the column to store the mode
col=new2000
# name of your data_map raster
cover=classif
# name for the tmp raster to compute the polygon
base=parcelles

g.region rast=${cover}
v.to.rast input=${vect} output=${base} use=cat

for cat in `r.stats ${base} | grep -v *`
do

cat_u=$(($cat - 1))
cat_o=$(($cat + 1))

g.copy rast=${base},${base}.${cat}
r.null map=${base}.${cat} setnull=0-${cat_u},${cat_o}-11000
g.copy rast=${base}.${cat},MASK
r.mapcalc ${cover}.${cat}=${cover}
r.mode base=${base}.${cat} cover=${cover}.${cat}
output=${base}.${cat}.reclass --o --v
class=$(echo `r.stats ${base}.${cat}.reclass | grep -v *`);
v.db.update map=${vect} column=${col} value=${class} where=cat=${cat}
g.remove rast=MASK,${base}.${cat}.reclass,${base}.${cat},${cover}.${cat}

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


Re: [GRASS-user] Re: Calculating mode value for each polygon

2010-10-18 Thread Micha Silver


  
  
On 18/10/2010 16:07,
  Sylvain Maillard wrote:

hello,
  
  something strange, i was quite sure to have send a response but it
  seems something goes wrong ...
  
  I wrote a little script that use r.mode:
  - convert the vector with polygon to raster
  - loop for each polygon

Don't think this is necessary. Once the vector is rasterized, the
values in the output raster will represent the mode, calculated from
the cover map, for each area. Then just convert the output raster
back to a vector with the '-v' flag to r.to.vect and it should
contain the mode as it's cat value for each polygon. 


  - get the mode and update the specified column in the vector file
  
  
  it process only one polygon at a time and is quite slow, but do
  the job ;)
  
  cheers,
  Sylvain
  
  [code]
  #!/bin/bash
  
  # vector with polygon
  vect=Parcellaire
  # name of the column to store the mode 
  col=new2000
  # name of your data_map raster
  cover=classif
  # name for the tmp raster to compute the polygon
  base=parcelles
  
  g.region rast=${cover}
  v.to.rast input=${vect} output=${base} use=cat
  
  for cat in `r.stats ${base} | grep -v "*"`
  do
  
  cat_u=$(($cat - 1))
  cat_o=$(($cat + 1))
  
  g.copy rast=${base},${base}.${cat}
  r.null map=${base}.${cat} setnull=0-${cat_u},${cat_o}-11000
  g.copy rast=${base}.${cat},MASK
  r.mapcalc "${cover}.${cat}=${cover}"
  r.mode base=${base}.${cat} cover=${cover}.${cat}
  output=${base}.${cat}.reclass --o --v
  class=$(echo `r.stats ${base}.${cat}.reclass | grep -v "*"`);
  v.db.update map=${vect} column=${col} value=${class}
  where="cat=${cat}"
  g.remove
  rast=MASK,${base}.${cat}.reclass,${base}.${cat},${cover}.${cat}
  
  done
  [/code]
  
  
  This mail was received via Mail-SeCure System.
  

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

This mail was received via Mail-SeCure System.






-- 
Micha Silver
http://www.surfaces.co.il/
Arava Development Co.  +972-52-3665918

  

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


Re: [GRASS-dev] Re: [GRASS-user] v.db.join script

2010-10-18 Thread Moritz Lennert

On 13/10/10 22:23, Micha Silver wrote:

One line from the v.db.join script uses grep and cut to get the column
names and the next line gets the column types like so:

db.describe -c bike_rides2 | grep '^Column' | cut -d ':' -f 3
INTEGER
CHARACTER
INTEGER
CHARACTER
CHARACTER
CHARACTER
CHARACTER

So the column size is actually ignored.

Next, in the script the above output is used by v.db.addcol to create
the new columns in the joined vector. So all new character columns are
created as a single char and the actual length is never used.

Questions:
Is the db.describe output the same for all db drivers?
Any suggestions how to fix this as a script?


Why not use an SQL join, i.e. something like the following ?

1) CREATE TABLE temp AS (SELECT * FROM $maptable JOIN $otable ON 
$column=$ocolumn)


2) rename table $maptable to something else

3) rename table temp to $maptable

4) if this works, remove the original $maptable

Not tested, but might be a more elegant solution ?

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


Re: [GRASS-user] Calculating mode value for each polygon

2010-10-18 Thread Monica Buescu
About the sugfgestion from Luisa, of using r.mode it seems exacly what I
want... But instead of using polygons I use a raster (coverage map). For me,
its ok

I have tested and, I'm obtaining a bit weird error on this:
r.mode base...@permanent cover=1107...@permanent output=test_outputv0


ERROR: reading r.stats output
ERROR: No rules specified

My 11073_B  is a  CELL satellite image (0-1000)
my v0 is a FCELL raster with values that range from 1 til 5 (but I don't
have that many values only 30 of them but are dispersed between 1 and 5.

Any ideas to fix this?
THanks
Monica

On Mon, Oct 18, 2010 at 12:33 PM, Daniel Victoria daniel.victo...@gmail.com
 wrote:

 This should be done by v.rast.stats but, from the manual I don't think
 it includes mode...

 On Mon, Oct 18, 2010 at 8:32 AM, Monica Buescu
 monicabuescu1...@gmail.com wrote:
  I don't think so.. What I want is to calculate the mode (most frequent
  value) of a raster file for each polygon that this raster covers. What I
  will have is the most frequent raster value that falls inside each
 polygon.
  Is kind of a univariate statistic of a raster for each polygon.
  Any ideas?
  (thanks Micha for your suggestion)
 
  On Mon, Oct 18, 2010 at 10:19 AM, Micha Silver mi...@arava.co.il
 wrote:
 
  On 18/10/2010 10:11, Monica Buescu wrote:
 
  Greetings
  I have an image that is divided in several (300) polygons and, using a
  data_map raster, I want to calculate the mode value from this image for
 each
  polygon. Is it possible? can anyone give me a tip on this?
 
  Have a look at v.what.rast. That might be what you're looking for.
 
  Thanks
  Monica
  This mail was received via Mail-SeCure System.
 
  ___
  grass-user mailing list
  grass-user@lists.osgeo.org
  http://lists.osgeo.org/mailman/listinfo/grass-user
 
  This mail was received via Mail-SeCure System.
 
 
 
 
  --
  Micha Silver
  http://www.surfaces.co.il/
  Arava Development Co.  +972-52-3665918
 
 
  ___
  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


[GRASS-user] Question about r.in.xyz

2010-10-18 Thread Franz Schiller
Hello there

I have a simple question related with r.in.xyz:
When I import a ASCII file I do this:
r.in.xyz input=C:\Test_areas\graphbased\filev2 output=v...@permanent

But in the metadata I get the following:
- number of categories: 255 = Why is this? I haven't set anything
- and in the r.info v2 I get a command slightly different from the one I
typed:
r.in.xyz input=C:\Test_areas\graphbased\saidav2 output=v...@permanent
method=mean type=FCELL fs=  x=1 y=2 z=3 zscale=1.0 percent=100
Why?

Sorry for bothering you with this but, this is relevant for my work
Thanks
Franz
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] Re: Type of data to be used in i.maxlik

2010-10-18 Thread Kim Besson
Hello

I have sent this message but no one answered me. Can anyone help me on this?
Thanks
Kim

2010/10/15 Kim Besson kimbesson1...@gmail.com

 Greetings

 Before I used i.maxlik I decided to give a look at the code. And I have one
 question:
 - the input data, I mean the data inside the group, must it be CELL
 (integers that range 0-255) or can it be DOUBLE (double precision that range
 whatever)?

 I believe that the training_area MUST be integers (for the obvious reason)

 Thanks
 Kim

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


[GRASS-user] Retrieve current region ncols and rrows in Python

2010-10-18 Thread katrin eggert
Greetings

For a small python script that I'm making I need the number of cols and rows
that are currently active. I've found for a C routine :) but not for a
Python Script. I believe it's simple but..

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


Re: [GRASS-user] Retrieve current region ncols and rrows in Python

2010-10-18 Thread Martin Landa
2010/10/18 katrin eggert katrineggert1...@gmail.com:
 For a small python script that I'm making I need the number of cols and rows
 that are currently active. I've found for a C routine :) but not for a

grass.region() [1]

Martin

[1] 
http://grass.osgeo.org/programming6/namespacegrass_1_1script_1_1core.html#ac0f1d6516f98839d5330f6c5accc0120

-- 
Martin Landa landa.martin gmail.com * http://geo.fsv.cvut.cz/~landa
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Retrieve current region ncols and rrows in Python

2010-10-18 Thread Mohammed Rashad
see this
http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/doc/python/example_ctypes.py

On Mon, Oct 18, 2010 at 10:35 PM, katrin eggert
katrineggert1...@gmail.comwrote:

 Greetings

 For a small python script that I'm making I need the number of cols and
 rows that are currently active. I've found for a C routine :) but not for a
 Python Script. I believe it's simple but..

 Thanks
 Kat

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




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


Re: [GRASS-user] Retrieve current region ncols and rrows in Python

2010-10-18 Thread Martin Landa
2010/10/18 Mohammed Rashad mohammedrasha...@gmail.com:
 see this
 http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/doc/python/example_ctypes.py

you are referring to ctypes python interface, not the python scripting
library. They are two different things, ctypes is the python interface
to GRASS C libraries, the scripting library is a interface to GRASS
modules.

Martin

-- 
Martin Landa landa.martin gmail.com * http://geo.fsv.cvut.cz/~landa
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Question about r.in.xyz

2010-10-18 Thread Hamish
Franz wrote:
 I have a simple question related with r.in.xyz:
 When I import a ASCII file I do this:
 r.in.xyz input=C:\Test_areas\graphbased\filev2 output=v...@permanent

 But in the metadata I get the following:
 - number of categories: 255 = Why is this? I haven't set
 anything

that's simply a function of what's present in your input data.
for floating point values it will just be the next highest
integer beyond the maximum data value and can be ignored.

see also the output of r.univar and the display histogram tool.


 - and in the r.info v2 I get a command slightly different from
 the one I typed:
 r.in.xyz input=C:\Test_areas\graphbased\saidav2 \
   output=v...@permanent method=mean type=FCELL fs=  \
   x=1 y=2 z=3 zscale=1.0 percent=100
 Why?

it's the same thing, just that the default options have been
explicitly, instead of implicitly, listed.

output= should not be given an @mapset part, as output is
always in the current mapset.


no worries,
Hamish



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


[GRASS-user] Re: v.db.join

2010-10-18 Thread Markus Neteler
On Fri, Oct 8, 2010 at 12:56 PM, Jón Eiríksson j...@hi.is wrote:
 Hi,

 I have a truncation problem with v.db.join. This has been raised before -

...
 The new data columns are apparently defined as 1 character long, and the
 data become truncated accordingly, much against my intention. I use mysql.

 Can anyone point out a solution? I copy a session with the spearfish60
 data below.

 Jon

 GRASS 6.4.0 (spearfish60):~  g.copy vect=soils,mysoils
 Copy vector so...@permanent to current mapset as mysoils
 GRASS 6.4.0 (spearfish60):~  db.select mysoils
 cat|label
 1|Aab
 2|Ba
 3|Bb
 4|BcB
 5|BcC
 6|BeE
 .
 .
 .
 GRASS 6.4.0 (spearfish60):~  db.in.ogr soils_legend.csv out=soils_legend
 Imported table soils_legend with 55 rows
 GRASS 6.4.0 (spearfish60):~  db.select soils_legend
 id|shortname|longname
 0|no data|no data
 1|AaB|Alice fine sandy loam, 0 to 6
 2|Ba|Barnum silt loam
 3|Bb|Barnum silt loam, channeled
 4|BcB|Boneek silt loam, 2 to 6
 5|BcC|Boneek silt loam, 6 to 9
 6|BeE|Butche stony loam, 6 to 50
 .
 .

...so far so nice...

could you please edit v.db.join and add a -x to the first line?
Find the script with
 which v.db.join

So: before
#!/bin/sh

after:

#!/bin/sh -x

Then run v.db.join:

 GRASS 6.4.0 (spearfish60):~  v.db.join mysoils col=label
 otable=soils_legend ocol=shortname

and check where the stuff is eaten. Please send relevant chunks (if long,
maybe better open a ticket at http://trac.osgeo.org/grass/ for this).

 GRASS 6.4.0 (spearfish60):~  v.db.select mysoils
 cat|label|id|shortname|longname
 1|Aab|1|A|A
 2|Ba|2|B|B
 3|Bb|3|B|B
 4|BcB|4|B|B
 5|BcC|5|B|B
 6|BeE|6|B|B
 .
 .
 .
 GRASS 6.4.0 (spearfish60):~  db.describe -c mysoils
 ncols: 5
 nrows: 54
 Column 1: cat:INTEGER:11
 Column 2: label:CHARACTER:13
 Column 3: id:CHARACTER:1
 Column 4: shortname:CHARACTER:1
 Column 5: longname:CHARACTER:1
 GRASS 6.4.0 (spearfish60):~  db.describe -c soils_legend
 ncols: 3
 nrows: 55
 Column 1: id:CHARACTER:255
 Column 2: shortname:CHARACTER:255
 Column 3: longname:CHARACTER:255

We need to understand what happens in v.db.join with mysql.

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


Re: [GRASS-user] Type of data to be used in i.maxlik

2010-10-18 Thread Markus Neteler
On Fri, Oct 15, 2010 at 1:54 PM, Kim Besson kimbesson1...@gmail.com wrote:
 Greetings
 Before I used i.maxlik I decided to give a look at the code. And I have one
 question:
 - the input data, I mean the data inside the group, must it be CELL
 (integers that range 0-255) or can it be DOUBLE (double precision that range
 whatever)?

The input can be double but will be read as integer (CELL) since the function
G_open_cell_old() is used [1].

 I believe that the training_area MUST be integers (for the obvious reason)

Yes.

Markus

[1]  
http://grass.osgeo.org/programming6/opencell_8c.html#a1f48562fa8324da9929e8a089f124d2b
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] v.db.join script

2010-10-18 Thread Markus Neteler
On Fri, Oct 15, 2010 at 2:08 PM, Micha Silver mi...@arava.co.il wrote:
 Hi Jon:

(Jon, sorry for my previous email, I missed this thread).

 So we're pretty clear that this problem creeps up only on PostgreSQL and
 MySQL based vector layers. I checked in the documentation and both databases
 will create a *one* char wide column when the CHARACTER type is used without
 any size. Sqlite uses their dynamic typing  so any CHAR column can be any
 size and the bug gets hidden...

 Here's a new v.db.join script that seems to overcome the width problem. I
 tested *only* on a Postgresql based vector. It creates the full width
 columns like in the original table. Would you mind testing on MySQL? To use
 this scrpt, you'll have to drop it into your GRASS scripts directory
 (probably /usr/lib/grass64/scripts ) and make sure it's executable. Then run
 it as v.db.join2.

@Micha: Since Jon tested it on MySQL successfully, please consider to submit it
as patch to trac (please clean it up a bit then).

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