Re: [GRASS-user] How to rescale

2012-01-11 Thread Moritz Lennert

On 09/01/12 20:42, leonidas wrote:

I created a raster using *r.grow.distance*
I need to rescale that file to a scale 0-255 but in reverse order where high
values in distance file will be converted in low values to the rescaled
file.
I'm using the following command:


r.recode input=dist_file output=recoded_file EOF
0:133000:255:0
EOF

[BTW: I don't know how you formatted your mail, but for me the above 
three lines showed as:



*
*




But the output file has a range 60-255
What's going wrong?
Is there any better way to do that?


Are you sure that 133000 is the max of your map in the region you are 
using ? Be aware that r.info gives the info for the whole map, ignoring 
region settings and a possible mask. You can use r.univar or r.stats to 
see the max in the current region/mask.


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


Re: [GRASS-user] problems with colors resulting of an image fusion

2012-01-11 Thread Moritz Lennert

On 09/01/12 19:16, Moritz Lennert wrote:

On 09/01/12 00:50, Markus Neteler wrote:

On Fri, Jan 6, 2012 at 5:42 PM, Moritz Lennert
mlenn...@club.worldonline.be wrote:

Hi everyone,

I have some troubles with image fusion through IHS transformation of a
Landsat image.


Hi Moritz,

could you please post the procedure you used?


The same procedure as the one you describe in the book, i.e. the
classical i.rgb.his  i.his.rgb approach with grey.eq color table for
the resulting three bands.

I'll try to write up a reproducible example, including relevant data if
the NC set does not show the same behaviour.


Ok, here we go using nc_spm_08:

- Using real-color channels I get weird colors

g.region rast=lsat7_1002_20@PERMANENT

r.colors lsat7_1002_30@PERMANENT color=grey.eq
r.colors lsat7_1002_20@PERMANENT color=grey.eq
r.colors lsat7_1002_10@PERMANENT color=grey.eq

g.region -p rast=lsat7_1002_80@PERMANENT

i.rgb.his red_input=lsat7_1002_30@PERMANENT 
green_input=lsat7_1002_20@PERMANENT blue_input=lsat7_1002_10@PERMANENT 
hue_output=h intensity_output=i saturation_output=s --o


i.his.rgb hue_input=h@fusion_test 
intensity_input=lsat7_1002_80@PERMANENT saturation_input=s@fusion_test 
red_output=fr green_output=fg blue_output=fb --o


r.colors map=fr@fusion_test color=grey.eq
r.colors map=fg@fusion_test color=grey.eq
r.colors map=fb@fusion_test color=grey.eq


Color composite before fusion (d.rgb -o red=lsat7_2002_30@PERMANENT 
green=lsat7_2002_20@PERMANENT blue=lsat7_2002_10@PERMANENT):


http://geog-pc40.ulb.ac.be/grass/fusion_test/d_rgb_30_20_10_grey_eq.png

Color composite after fusion (d.rgb -o red=fr@fusion_test 
green=fg@fusion_test blue=fb@fusion_test):


http://geog-pc40.ulb.ac.be/grass/fusion_test/d_rgb_fr_fg_fb_grey_eq.png


- Using near-infrared false color composition the colors are as expected:


g.region rast=lsat7_2002_30@PERMANENT

r.colors lsat7_2002_40@PERMANENT color=grey.eq
r.colors lsat7_2002_30@PERMANENT color=grey.eq
r.colors lsat7_2002_20@PERMANENT color=grey.eq

g.region -p rast=lsat7_2002_80@PERMANENT

i.rgb.his red_input=lsat7_2002_40@PERMANENT 
green_input=lsat7_2002_30@PERMANENT blue_input=lsat7_2002_20@PERMANENT 
hue_output=h intensity_output=i saturation_output=s --o


i.his.rgb hue_input=h@fusion_test 
intensity_input=lsat7_2002_80@PERMANENT saturation_input=s@fusion_test 
red_output=pir_fr green_output=pir_fg blue_output=pir_fb --o


r.colors map=pir_fr@fusion_test color=grey.eq
r.colors map=pir_fg@fusion_test color=grey.eq
r.colors map=pir_fb@fusion_test color=grey.eq

Color composite before fusion (d.rgb -o red=lsat7_2002_40@PERMANENT 
green=lsat7_2002_30@PERMANENT blue=lsat7_2002_20@PERMANENT):


http://geog-pc40.ulb.ac.be/grass/fusion_test/d_rgb_40_30_20_grey_eq.png

Color composite after fusion (d.rgb -o red=pir_fr@fusion_test 
green=pir_fg@fusion_test blue=pir_fb@fusion_test):


http://geog-pc40.ulb.ac.be/grass/fusion_test/d_rgb_pir_fr_fg_fb_grey_eq.png

Can anyone reproduce this ? Any explanation ?

Moritz



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


[GRASS-user] python scripting using eclipse

2012-01-11 Thread Ismael Gómez
Hello everyone,


I would like to run some scripts using python. I am not a computer
scientist/engineer, just a python newbie, but I find that's a really
interesting matter.
Thus, I followed the instructions here:
http://grass.osgeo.org/wiki/Using_Eclipse_to_develop_GRASS_Python_programs
and doing so i was able to run from Eclipse the following simple script
under windows (WinGRASS 6.4RC2):


--
--
#!/usr/bin/env python
#

#
# MODULE:   model
#
# AUTHOR(S): ismael
#
# PURPOSE:  Script generated by wxGUI Graphical Modeler.
#
# DATE: Mon Dec 19 18:49:29 2011
#
#

import sys
import os
import atexit

import grass.script as grass

def cleanup():
pass

def main():
grass.run_command(v.extract --overwrite,
  input = parcelas@Modelo1a,
  output = parcelasLucrativas,
  where = Lucr=1)
grass.run_command(v.overlay --overwrite,
  ainput = fincas@Modelo1a,
  binput = parcelasLucrativas,
  output = Xik,
  operator = and)

return 0

if __name__ == __main__:
options, flags = grass.parser()
atexit.register(cleanup)
sys.exit(main())
--
--


However, when I try to run it in linux (both Ubuntu 11.10 and Linux Mint 12
installations using the ppa repository) i always get error messages like
the following:

--

Traceback (most recent call last):
  File
/home/rosie/Dropbox/REPARCELIA-COMUN/GIS/script/GRASS/Modelo1a/modelo1a.py,
line 40, in module
sys.exit(main())
  File
/home/rosie/Dropbox/REPARCELIA-COMUN/GIS/script/GRASS/Modelo1a/modelo1a.py,
line 28, in main
where = Lucr=1)
  File /usr/lib/grass64/etc/python/grass/script/core.py, line 176, in
run_command
ps = start_command(*args, **kwargs)
  File /usr/lib/grass64/etc/python/grass/script/core.py, line 164, in
start_command
return Popen(args, **popts)
  File /usr/lib/grass64/etc/python/grass/script/core.py, line 55, in
__init__
startupinfo, creationflags)
  File /usr/lib/python2.6/subprocess.py, line 623, in __init__
errread, errwrite)
  File /usr/lib/python2.6/subprocess.py, line 1141, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory


--

Since my knowledge is still very limited, I've spent three days turnning
around it without success.

Could someone give me some hint on where to start to find a solution for
this, please?
Also: when I run it, how/where could I get more information on the
processes running further than those console messages? (sorry, i guess
that's more a Eclipse/Python question than a GRASS one)
Thank you very much in advance.

Regards,

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


[GRASS-user] Grass 6.4.2 on mac with lion

2012-01-11 Thread Salvatore Mellino
I'm trying to compile GRASS 6.4.2 on my macbook with Lion OSX. I stopped at one 
point. How can I solve my problem?

Thanks.

Salvatore


MacBook-Pro-di-Salvatore-Mellino:grass-6.4.2RC2 salvatore$ ./configure 
--enable-sysv --with-x --with-opengl=x11 --without-odbc --with-cxx 
--with-sqlite --with-sqlite-libs=/Library/Frameworks/SQLite3.framework/unix/lib 
--with-sqlite-includes=/Library/Frameworks/SQLite3.framework/unix/include 
--with-fftw 
--with-fftw-includes=/Library/Frameworks/FFTW3.framework/unix/include 
--with-fftw-libs=/Library/Frameworks/FFTW3.framework/unix/lib 
--with-postgres-includes=/usr/local/pgsql/include 
--with-postgres-libs=/usr/local/pgsql/lib
checking host system type... i386-apple-darwin11.2.0
checking for gcc... gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking for Cygwin environment... no
checking for mingw32 environment... no
checking for executable suffix... no
checking for full floating-point support... yes
checking for pwd... /bin/pwd
checking for source directory... /Users/salvatore/GIS/grass-6.4.2RC2
checking for build directory... /Users/salvatore/GIS/grass-6.4.2RC2
checking for svnversion... /usr/bin/svnversion
checking for MacOSX App... no
checking for MacOSX architectures... no
checking for MacOSX SDK... no
checking how to build libraries... shared
checking for ranlib... ranlib
checking how to run the C preprocessor... gcc -E
checking if 64bit support is requested... no
checking if 64bit Sparc VIS support is requested... no
checking system version (for dynamic loading)... Darwin-11.2.0
checking for dlopen in -ldl... yes
checking for ar... ar
checking for additional include dirs... 
checking for additional library dirs... 
checking for a BSD compatible install... /usr/bin/install -c
checking for flex... flex
checking for yywrap in -lfl... yes
checking for bison... bison -y
checking for ranlib... ranlib
checking for ar... ar
checking for env... env
checking for perl... /usr/bin/perl
checking for ANSI C header files... yes
checking for limits.h... yes
checking for termio.h... no
checking for termios.h... yes
checking for unistd.h... yes
checking for values.h... no
checking for f2c.h... no
checking for g2c.h... no
checking for sys/ioctl.h... yes
checking for sys/mtio.h... no
checking for sys/resource.h... yes
checking for sys/time.h... yes
checking for sys/timeb.h... yes
checking for sys/types.h... yes
checking for sys/utsname.h... yes
checking for libintl.h... no
checking for iconv.h... yes
checking for langinfo.h... yes
checking whether time.h and sys/time.h may both be included... yes
checking for off_t... yes
checking for uid_t in sys/types.h... yes
checking return type of signal handlers... void
checking for Cygwin environment... no
checking for ftime... yes
checking for gethostname... yes
checking for gettimeofday... yes
checking for lseek... yes
checking for nice... yes
checking for time... yes
checking for uname... yes
checking for seteuid... yes
checking for setpriority... yes
checking for setreuid... yes
checking for setruid... yes
checking for drand48... yes
checking for putenv... yes
checking for setenv... yes
checking for nanosleep... yes
checking whether setpgrp takes no argument... yes
checking for long long int... yes
checking for W11... no
checking for X... no
checking whether to use Curses... yes
checking for curses.h... yes
checking curses.h WINDOW structure component... NONE
checking for initscr in -lncurses... yes
checking for keypad in -lncurses... yes
checking for gtty in -lcompat... no
checking for gtty in -lbsd-compat... no
checking for gtty in -lbsd... no
checking for library containing cuserid... no
checking for xdrmem_create... yes
checking for asprintf... yes
checking for atan... yes
checking for dlsym... yes
checking for iconv... no
checking for iconv in -liconv... yes
checking for socket... yes
checking for location of zlib includes... 
checking for zlib.h... yes
checking for location of zlib library... 
checking for deflate in -lz... yes
checking for location of External PROJ.4 includes... 
checking for proj_api.h... yes
checking External PROJ.4 version... 470
checking for location of External PROJ.4 library... 
checking for pj_get_def in -lproj... yes
checking for location of External PROJ.4 data files... 
configure: warning: *** External PROJ.4 directory not specified; default will 
be used
checking for /usr/local/share/proj/epsg... yes
checking for nad2bin... /usr/local/bin/nad2bin
checking whether to use regex... yes
checking for location of regex includes... 
checking for regex.h... yes
checking for location of regex library... 
checking for regcomp... yes
checking whether to use Readline... no
checking whether to use JPEG... yes
checking for location of JPEG includes... 
checking for jpeglib.h... yes
checking for location of JPEG library... 
checking for jpeg_start_compress 

[GRASS-user] Re: How to rescale

2012-01-11 Thread leonidas
Indeed, I run *r.univar* and the max value is 101812!!!
So using:
r.recode input=dist_coastline output=recoded_file 
0:101812:255:0

the range of the output file was 0-255

I also checked Markus method.
eval `r.univar -g map=myrast` returns max value = 101812.211145335

I re-run r.recode using 101812.211145335 as max value.

Running r.univar for the two output files I get defferent results (but very
simiral):

Output from Markus method:



Output from Moritz method:








--
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/How-to-rescale-tp7169303p7177559.html
Sent from the Grass - Users mailing list archive at Nabble.com.
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] Filling an Area Added to Vector Map

2012-01-11 Thread Rich Shepard

  I've not done this before and my trial-and-error approach doesn't work. I
need to add a reservoir to a stream system so I used the on-screen editing
feature to digitize the area, then rebuilt the topology. But, despite having
a fill color selected the new area is not filled.

  I've attached a screenshot and the reservoir is the heavy-lined area near
the center of the map.

  What step(s) have I missed here? I need to have that area filled so the
underlying stream channels are hidden, but it's the same blue color as the
stream channels.

TIA,

Richattachment: screenshot-small.png___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] Filling an Area Added to Vector Map

2012-01-11 Thread Alex Mandel
On 01/11/2012 11:59 AM, Rich Shepard wrote:
   I've not done this before and my trial-and-error approach doesn't work. I
 need to add a reservoir to a stream system so I used the on-screen editing
 feature to digitize the area, then rebuilt the topology. But, despite
 having
 a fill color selected the new area is not filled.
 
   I've attached a screenshot and the reservoir is the heavy-lined area near
 the center of the map.
 
   What step(s) have I missed here? I need to have that area filled so the
 underlying stream channels are hidden, but it's the same blue color as the
 stream channels.
 
 TIA,
 
 Rich
 

In the GIS vector world you have points, lines and polygons. Typically
(in most) applications a single layer can only be 1 of the 3. What you
digitized is the outline of an area as a line feature. To make a
fillable polygon you can convert that or redigitize it in it's own
polygon layer.

These instructions are to achieve the visual look you describe, modeling
it as a reservoir for a network is a whole different story.

Enjoy,
Alex

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


Re: [GRASS-user] Filling an Area Added to Vector Map

2012-01-11 Thread Rich Shepard

On Wed, 11 Jan 2012, Alex Mandel wrote:


What you digitized is the outline of an area as a line feature. To make a
fillable polygon you can convert that or redigitize it in it's own polygon
layer.


  I did not realize that I needed a new layer since the last time I
digitized in GRASS was with version 4.0 (whenever that was in the early
1990s).

  I can digitize this in the lakes layer (where it should have already been
visible).

Thanks, Alex,

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


Re: [GRASS-user] Filling an Area Added to Vector Map

2012-01-11 Thread Rich Shepard

On Wed, 11 Jan 2012, Rich Shepard wrote:


 I discovered the problem: some layers obscure others.


  The problem is not that one layer covers another, but that one layer just
will not display. I've no idea why not. There are 4 vector layers but only 3
will display. It seems that the last to be added to the display doesn't.

  Very strange.

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


Re: [GRASS-user] python scripting using eclipse

2012-01-11 Thread Ismael Gómez
Many thanks, Martin!!
Kind regards,

isma
PhD student @ Urban  Land Planning Department @ ETSICCPM UPM
www.caminos.upm.es


2012/1/11 Martin Landa landa.mar...@gmail.com

 Hi,

 2012/1/11 Ismael Gómez gomez.ism...@gmail.com:
  # PURPOSE:  Script generated by wxGUI Graphical Modeler.
 ...
  grass.run_command(v.extract --overwrite,

 seems to be bug in Graphical Modeler, it should be

 grass.run_command(v.extract, overwrite = True,

 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] How to import as vector?

2012-01-11 Thread Markus Neteler
On Wed, Jan 11, 2012 at 1:25 PM, Bulent Arikan bulent.ari...@gmail.com wrote:
 Dear List,

 I found a plan / architectural drawing online. I am not sure about the
 resolution but JPG version is 25 Mb and TIFF version is 410 Kb. I want to
 import the drawing as vector into 'xy location' and then rectify it. I
 already did rectify the image as raster but I will need a vector layer.
 Looking at 'v.in.ogr' I am not sure how to bring images of such formats into
 GRASS as vector. Raster to vector transformation does not work.

Since it is a raster map you have (at least) two options:
- use it as background for a digitizer (likely a lot of work)
- try image processing to get out raster lines, then r.thin and
  subsequently r.to.vect with lines. This much depends on the
  JPG quality.
- (there are some autotracer tools, too)

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


Re: [GRASS-user] How to import as vector?

2012-01-11 Thread Bulent Arikan
Thank you for the suggestions! Yes, it will be a lot of work and time
consuming to digitize it. I was also suggested to use Inkscape to autotrace
it and save it in (svg). However, saving it as (svg) does not help because
'v.in.ogr' does not seem to import that format. I even saved it as (dxf)
but the import failed –nothing showed up after importing it as vector
layer– with 'v.in.ogr' and 'v'in.dxf'.

Is there a separate module for importing (svg) files or should I use a
different file extension?

Thank you,

Bulent

On Thu, Jan 12, 2012 at 1:49 AM, Markus Neteler nete...@osgeo.org wrote:

 On Wed, Jan 11, 2012 at 1:25 PM, Bulent Arikan bulent.ari...@gmail.com
 wrote:
  Dear List,
 
  I found a plan / architectural drawing online. I am not sure about the
  resolution but JPG version is 25 Mb and TIFF version is 410 Kb. I want to
  import the drawing as vector into 'xy location' and then rectify it. I
  already did rectify the image as raster but I will need a vector layer.
  Looking at 'v.in.ogr' I am not sure how to bring images of such formats
 into
  GRASS as vector. Raster to vector transformation does not work.

 Since it is a raster map you have (at least) two options:
 - use it as background for a digitizer (likely a lot of work)
 - try image processing to get out raster lines, then r.thin and
  subsequently r.to.vect with lines. This much depends on the
  JPG quality.
 - (there are some autotracer tools, too)

 Markus




-- 
BÜLENT ARIKAN, PhD
Senior Research Fellow
Research Center for Anatolian Civilizations
Koç University
İstiklal Caddesi No: 181 Merkez Han
Beyoğlu - ISTANBUL
TURKEY
34433
(+ 90) 212-393-6036
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user