Re: [GRASS-user] Fwd: How to obtain selected adjacent pixel values?

2013-06-30 Thread Nikos Alexandris
(cc-ing @MarkusMetz)

Yasser Said Lopez de Olmos Reyes wrote:

  How could I obtain the differences between central pixel values and
  cardinal directions pixel values related with a central pixel?
  Or in a different manner, how to do this in grass gis?

  RASTER_OUT= round(abs((RASTER_IN - RASTER_IN_PUSHED_ONE_ROW_UP) +
  (RASTER_IN - RASTER_IN_PUSHED_ONE_ROW_DOWN) + (RASTER_IN -
  RASTER_IN_PUSHED_ONE_COLUMN_LEFT) + (RASTER_IN -
  RASTER_IN_PUSHED_ONE_COLUMN_RIGHT))

Nikos Alexandris wrote:
 This boils down to calculating 
 (RASTER_IN - RASTER_IN_PUSHED_ONE_ROW_UP) +
 (RASTER_IN - RASTER_IN_PUSHED_ONE_ROW_DOWN) +
 (RASTER_IN - RASTER_IN_PUSHED_ONE_COLUMN_LEFT) +
 (RASTER_IN - RASTER_IN_PUSHED_ONE_COLUMN_RIGHT)
 
 Please check the manual of r.mapcalc.  There is
 
 --%---
 THE NEIGHBORHOOD MODIFIER
..
 ---%--

 which I think can be used to obtain what is asked.
 So, for each of the off-current pixel, the modifiers would be like

 RASTER_IN_PUSHED_ONE_ROW_UP:  map[-1,0]
 RASTER_IN_PUSHED_ONE_ROW_DOWN:  map[1,0]
 RASTER_IN_PUSHED_ONE_COLUMN_LEFT:  map[0,-1]
 RASTER_IN_PUSHED_ONE_COLUMN_RIGHT:  map[0,1]
 
 I am not exactly sure about the implementation though.

@Yasser, if you implement this and think it is something that can be justified 
as generically useful, why not ask @MarkusMetz if it is easy to include in 
r.neighbors as yet another method?

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


Re: [GRASS-user] grass prompt default working directory

2013-06-30 Thread Nikos Alexandris
Nikos wrote:
   Luckily, the history functions of bash are very handy (e.g. Ctrl + R
   and more).

Hamish:
   re. and more, fwiw, I find adding this to ~/.inputrc is much
   nicer to use than ^r,

   #  Bind page up/down wih history search -
   \e[5~: history-search-backward
   \e[6~: history-search-forward

   type the first few letters, then PgUp to see earlier matches..

[..]

 still, it does not replace continuous Ctrl+R which will go through _all_
 matches of the typed string, initially earlier lines starting with it, then
 through the entire history, no matter where the given string is located in
 a recorder command.

I think I can't do without the PgUp trick in the terminal. Sometime I still 
use Ctrl+R :-).

And, if I am not wrong, it's by default in openSUSE (12.3?) -- I didn't edit 
anything and it was already working!

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


[GRASS-user] TO BE POST: Extract a smaller image (sample) from a raster map

2013-06-30 Thread Liria Boix
COULD THIS BE POSTED TO THE MAILING LIST, PLEASE? I'M SUBSCRIBED TO IT BUT MY 
POST APPEAR AS  ... NOT been accepted by the mailing list yet. 


Hi everyone: 

Have Modis images MOD13Q1 reprojected into Tiff format imported 
into grass to analize NDVI for different months and seasons. As I just 
need to analize NDVI for a specific crop area of the image imported, I want to 
extract or select that region from the raster map. 

After reading several post explaining that R.region/G.region 
should be use to set the geographic boundaries, I decided to follow the 
instruction and have use r.region setting nort, south, east and 
west values of the smaller area BUT only get the same image narrower in 
width and longer in high. 

Now, when I follow the use of this command again I get the message unable to 
parse command r.region 

I'm new in Grass! and feel confuse. What I am missing? Please help! Many Thanks 
in adavance. ___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] TO BE POST: Extract a smaller image (sample) from a raster map

2013-06-30 Thread Nikos Alexandris
Liria Boix wrote:
 Hi everyone:

Hello Liria,

 Have Modis images MOD13Q1 reprojected into Tiff format imported
 into grass to analize NDVI for different months and seasons. As I just
 need to analize NDVI for a specific crop area of the image imported, I want
 to extract or select that region from the raster map.

You need to use g.region to set the computational region, that is the extent 
to which (almost) all grass raster modules will operate on.

 After reading several post explaining that R.region/G.region
 should be use to set the geographic boundaries,

The r.region module will define/modify the boundaries of the image itself, 
not the extent where the raster operations will take place.  This module is 
useful, for example, in case the extent or the placement of a raster map is 
not the one it should be/the user wants it to be.

 I decided to follow the
 instruction and have use r.region setting nort, south, east and
 west values of the smaller area BUT only get the same image narrower in
 width and longer in high.

You need to use g.region.

 Now, when I follow the use of this command again I get the message unable
 to parse command r.region
 
 I'm new in Grass! and feel confuse. What I am missing? Please help! Many
 Thanks in adavance.

Please have a quick-read through the following useful material:

- http://grass.osgeo.org/grass64/manuals/rasterintro.html
- http://grass.osgeo.org/grass64/manuals/imageryintro.html

There are several references upon r.region and g.region.

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


[GRASS-user] Extract a smaller image (sample) from a raster map

2013-06-30 Thread Lbxa
Many thanks for the explanation! 

I read the links you have posted and others like specific to r.region and
g.region, still a bit confuse with some concepts. HOWEVER, still not able
yet to extract a smaller image from the bigger one!. Have used *g.region*
setting the values of a smaller area, and have set it as computational
region but the image displayed is the same.

I did the same importing a new image and setting r.region but not getting
any difference! Feel a little bit frustrated



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Extract-a-smaller-image-sample-from-a-raster-map-tp5063094p5063102.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


Re: [GRASS-user] Fwd: How to obtain selected adjacent pixel values?

2013-06-30 Thread Markus Metz
On Sun, Jun 30, 2013 at 3:31 PM, Nikos Alexandris
n...@nikosalexandris.net wrote:
 (cc-ing @MarkusMetz)

 Yasser Said Lopez de Olmos Reyes wrote:

  How could I obtain the differences between central pixel values and
  cardinal directions pixel values related with a central pixel?
  Or in a different manner, how to do this in grass gis?

  RASTER_OUT= round(abs((RASTER_IN - RASTER_IN_PUSHED_ONE_ROW_UP) +
  (RASTER_IN - RASTER_IN_PUSHED_ONE_ROW_DOWN) + (RASTER_IN -
  RASTER_IN_PUSHED_ONE_COLUMN_LEFT) + (RASTER_IN -
  RASTER_IN_PUSHED_ONE_COLUMN_RIGHT))

 Nikos Alexandris wrote:
 This boils down to calculating
 (RASTER_IN - RASTER_IN_PUSHED_ONE_ROW_UP) +
 (RASTER_IN - RASTER_IN_PUSHED_ONE_ROW_DOWN) +
 (RASTER_IN - RASTER_IN_PUSHED_ONE_COLUMN_LEFT) +
 (RASTER_IN - RASTER_IN_PUSHED_ONE_COLUMN_RIGHT)

 Please check the manual of r.mapcalc.  There is

 --%---
 THE NEIGHBORHOOD MODIFIER
 ..
 ---%--

 which I think can be used to obtain what is asked.
 So, for each of the off-current pixel, the modifiers would be like

 RASTER_IN_PUSHED_ONE_ROW_UP:  map[-1,0]
 RASTER_IN_PUSHED_ONE_ROW_DOWN:  map[1,0]
 RASTER_IN_PUSHED_ONE_COLUMN_LEFT:  map[0,-1]
 RASTER_IN_PUSHED_ONE_COLUMN_RIGHT:  map[0,1]

 I am not exactly sure about the implementation though.

r.mapcalc RASTER_OUT=round(abs((RASTER_IN - RASTER_IN[0,-1]) + \
   (RASTER_IN -
RASTER_IN[0,1]) + \
   (RASTER_IN -
RASTER_IN[-1,0]) + \
   (RASTER_IN -
RASTER_IN[1,0])))

Note that this is the same like round(abs(4 * RASTER_IN -
(RASTER_IN[0,-1] + RASTER_IN[0,1] + RASTER_IN[-1,0] +
RASTER_IN[1,0])))

If you are interested in the sum of the absolute differences, you will
need to use abs() for each difference.


 @Yasser, if you implement this and think it is something that can be justified
 as generically useful, why not ask @MarkusMetz if it is easy to include in
 r.neighbors as yet another method?

# prepare a weights file with the contents
0 1 0
1 0 1
0 1 0

r.neighbors in=raster_in out=raster_cardinalsum weight=weights method=sum

r.mapcalc RASTER_OUT = round(abs(4 * RASTER_IN - raster_cardinalsum))

HTH,

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


Re: [GRASS-user] Fwd: How to obtain selected adjacent pixel values?

2013-06-30 Thread Yasser Said Lopez de Olmos Reyes
Sorry, I just need to tell you I'm gonna work on this next week, but I
really don't want to discourage you waiting with no news.

Thank you all.


2013/6/30 Markus Metz markus.metz.gisw...@gmail.com

 On Sun, Jun 30, 2013 at 3:31 PM, Nikos Alexandris
 n...@nikosalexandris.net wrote:
  (cc-ing @MarkusMetz)
 
  Yasser Said Lopez de Olmos Reyes wrote:
 
   How could I obtain the differences between central pixel values and
   cardinal directions pixel values related with a central pixel?
   Or in a different manner, how to do this in grass gis?
 
   RASTER_OUT= round(abs((RASTER_IN - RASTER_IN_PUSHED_ONE_ROW_UP) +
   (RASTER_IN - RASTER_IN_PUSHED_ONE_ROW_DOWN) + (RASTER_IN -
   RASTER_IN_PUSHED_ONE_COLUMN_LEFT) + (RASTER_IN -
   RASTER_IN_PUSHED_ONE_COLUMN_RIGHT))
 
  Nikos Alexandris wrote:
  This boils down to calculating
  (RASTER_IN - RASTER_IN_PUSHED_ONE_ROW_UP) +
  (RASTER_IN - RASTER_IN_PUSHED_ONE_ROW_DOWN) +
  (RASTER_IN - RASTER_IN_PUSHED_ONE_COLUMN_LEFT) +
  (RASTER_IN - RASTER_IN_PUSHED_ONE_COLUMN_RIGHT)
 
  Please check the manual of r.mapcalc.  There is
 
  --%---
  THE NEIGHBORHOOD MODIFIER
  ..
  ---%--
 
  which I think can be used to obtain what is asked.
  So, for each of the off-current pixel, the modifiers would be like
 
  RASTER_IN_PUSHED_ONE_ROW_UP:  map[-1,0]
  RASTER_IN_PUSHED_ONE_ROW_DOWN:  map[1,0]
  RASTER_IN_PUSHED_ONE_COLUMN_LEFT:  map[0,-1]
  RASTER_IN_PUSHED_ONE_COLUMN_RIGHT:  map[0,1]
 
  I am not exactly sure about the implementation though.

 r.mapcalc RASTER_OUT=round(abs((RASTER_IN - RASTER_IN[0,-1]) + \
(RASTER_IN -
 RASTER_IN[0,1]) + \
(RASTER_IN -
 RASTER_IN[-1,0]) + \
(RASTER_IN -
 RASTER_IN[1,0])))

 Note that this is the same like round(abs(4 * RASTER_IN -
 (RASTER_IN[0,-1] + RASTER_IN[0,1] + RASTER_IN[-1,0] +
 RASTER_IN[1,0])))

 If you are interested in the sum of the absolute differences, you will
 need to use abs() for each difference.

 
  @Yasser, if you implement this and think it is something that can be
 justified
  as generically useful, why not ask @MarkusMetz if it is easy to include
 in
  r.neighbors as yet another method?

 # prepare a weights file with the contents
 0 1 0
 1 0 1
 0 1 0

 r.neighbors in=raster_in out=raster_cardinalsum weight=weights method=sum

 r.mapcalc RASTER_OUT = round(abs(4 * RASTER_IN - raster_cardinalsum))

 HTH,

 Markus M




-- 
Saludos,

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


Re: [GRASS-user] Extract a smaller image (sample) from a raster map

2013-06-30 Thread Nikos Alexandris
Lbxa wrote:
 Many thanks for the explanation!

(Thanks to the guys spending nights to code all that stuff...)

 I read the links you have posted and others like specific to r.region and
 g.region, still a bit confuse with some concepts. HOWEVER, still not able
 yet to extract a smaller image from the bigger one!. Have used *g.region*
 setting the values of a smaller area, and have set it as computational
 region but the image displayed is the same.
 
 I did the same importing a new image and setting r.region but not getting
 any difference! Feel a little bit frustrated

(No pain, no Gain :-p).

So, one step at a time, and assuming you have created a Location based on the 
Spatial Reference System in which your data are defined/projected:

1. import raster map(s) using r.in.gdal -- nothing else required (no r.region 
required unless something is wrong with the imported data)

2. set the computational region using g.region, e.g.
  - g.region rast=YourRastMap will set the computational region to match the 
extent of your raster map (which is _not_ what you are after, if I got it 
right)
  - g.region w= e= s= n= to set a custom defined computational region

3. r.mapcalc Test = YourRasterMap -- this will simply copy YourRasterMap, 
yet, only for inside the computational region!

Hope this helps a bit,

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


Re: [GRASS-user] Fwd: How to obtain selected adjacent pixel values?

2013-06-30 Thread Nikos Alexandris
[..]

Markus Metz wrote: 
 # prepare a weights file with the contents
 0 1 0
 1 0 1
 0 1 0

 r.neighbors in=raster_in out=raster_cardinalsum weight=weights method=sum

 r.mapcalc RASTER_OUT = round(abs(4 * RASTER_IN - raster_cardinalsum))

...easy, it is, to build a filter in GRASS :D

Thanks Markus,

N

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


[GRASS-user] version 6.4.3 and mysql

2013-06-30 Thread Michael Mavis
Hello,

I have a question about Version 6.4.3 for Windows 7. Is there a way to access 
MySql databases from within the software? I don't see it listed as one of the 
drivers in the GUI, but am hoping there is a means by which to connect and 
retrieve or update data.

Thank you very much for your time and consideration.

Sincerely,

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


Re: [GRASS-user] version 6.4.3 and mysql

2013-06-30 Thread Hamish
Mike wrote:
 I have a question about Version 6.4.3 for Windows 7. Is there a
 way to access MySql databases from within the software? I don't
 see it listed as one of the drivers in the GUI, but am hoping
 there is a means by which to connect and retrieve or update data.


Hi,

looking at 'g.version -b' there it seems that the Windows installer
was not built with MySql support. (Sqlite, PostgreSQL, DBF, and
ODBC are there) I don't think there's any big reason for it not
being there except that the packager didn't add that option
when they were building it. (it's a bit more that just adding
the --with-mysql switch in the configuration, we also have to
build and ship the needed mysql libraries)
I'm not sure how much extra work it would be to add it, but it's
just a matter of rebuilding the package as far as I know. If you
are familiar with that sort of thing all the instructions are on
the wiki and build scripts in the tools directory our addons repo-
sitory and mswindows/ directory in the main source code. It relies
on the osgeo4w build infrastructure,

 http://trac.osgeo.org/osgeo4w/


Otherwise please feel free to file a wish ticket in the trac system,
and hopefully someone with talents in the area can enable it for
you. I think MySql on Windows is a pretty common combination, so
it sounds like a reasonable request to me.


For now you might see if you can communicate with mysql through 

the common ODBC driver?



regards,
Hamish

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


Re: [GRASS-user] Extract a smaller image (sample) from a raster map

2013-06-30 Thread Hamish
Nikos wrote:

 2. set the computational region using g.region, e.g.
   - g.region rast=YourRastMap will set the computational region to 
      match the extent of your raster map (which is _not_ what you are
      after, if I got it right)
   - g.region w= e= s= n= to set a custom defined computational region

just a little side note, at this point in the process it is always
good to check the computational region result with 'g.region -p',
if the bounds and or resolution got messy you can fix it with the
'g.region align=original_map' command, or 'g.region -a res=...' at
the chosen resolution.

also, if you changed anything with r.region it is probably best to
delete the first attempt and re-import the map from the raw file.


Hamish

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