Re: [GRASS-user] Cartografia

2011-07-06 Thread Ricardo Filipe Soares Garcia da
Hi Nuno

This list is in english and mostly about GRASS related issues.
Your question is neither.

Since you are posing a very specific question about availability of
geological data charts in a portuguese district, It'd be better to ask
about it at a more appropriate place.

Maybe try the local portuguese OSGEO chapter's mailing-list?

Best regards ;)



2011/7/6 nunosousa84 nuno_sousa_1...@hotmail.com:
 Boa tarde a todos,

 Alguém sabe de alternativas para obter a cartografia digital geológica à
 escala 1:25000 em particular para o distrito de Viseu
 (n.º167,168,157,158,147,148)? O LNEG tem mas os preços são descomunais.

 Abraços,
 Nuno Sousa


 
 View this message in context: Cartografia
 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





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


Re: [GRASS-user] using not so common characters in Python Script

2011-05-18 Thread Ricardo Filipe Soares Garcia da
Hi António

I usually start all my python scripts with the following two lines:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

The first line is nice for linux users. The second line ensures that I
can write non-ASCII characters in my code.
In your case, just add this second line to your script and make sure
it is either the first or second line of the script.
I recommend adding both lines to the top of the file, as a good practice.

If you'd like to know more just check out the link that the grass
error is giving you.

Cheers

2011/5/18 António Rocha antonio.ro...@deimos.com.pt:
 Greetings
 I would like to include some sentences with characters like á ã àó in my
 grass.message strings. It seems it's not possible Because I get this

   grass.fatal(_('á'))
 I get:
  File C:/local/scripts/x.teste, line 41
 SyntaxError: Non-ASCII character '\xe1' in file
 C:/local/scripts/x.teste on line 41, but no encoding
 declared; see http://www.python.org/peps/pep-0263.html for
 details

 Is it possible?
 Thanks
 Antonio Rocha




 __ Information from ESET NOD32 Antivirus, version of virus signature
 database 6132 (20110518) __

 The message was checked by ESET NOD32 Antivirus.

 http://www.eset.com


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




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


Re: [GRASS-user] GRASS'c Python core function to use as g.mlist

2011-03-14 Thread Ricardo Filipe Soares Garcia da
Hi Jenny

 Because I got this error:
 p=grass.mlist_grouped ('rast', pattern=pattern,
 mapset='PERMANENT')

This command runs fine on my system (by replacing 'pattern' with a
valid pattern string'). Maybe it is a version problem? I'm running
GRASS 6.4.0 on Ubuntu 10.10, coming from the ubuntugis-unstable
repository.

 If I avoid using mapset I get a dictionary variable in which, each entry is
 the list of rasters for each MAPSET.

Maybe you can solve your problem by discarding the rest of the output.
If you only want the rasters present in the 'PERMANENT' mapset and
since mlist_grouped returns a dictionary with mapset names as keys,
you can keep just the value associated with the 'PERMANENT' key. So,
you can just do:

# returns a list with rasters present in the 'PERMANENT' mapset
p = grass.mlist_grouped('rast', pattern=pattern)['PERMANENT']



On Mon, Mar 14, 2011 at 3:00 PM, Jenny Turner jennyturner1...@gmail.com wrote:
 Hello Ricardo
 Thanks for your feedback but the problem is that mapset cannot be used as
 input.
 Because I got this error:
 p=grass.mlist_grouped ('rast', pattern=pattern,
 mapset='PERMANENT')
 TypeError: mlist_grouped() got an unexpected keyword
 argument 'mapset'.
 If I avoid using mapset I get a dictionary variable in which, each entry is
 the list of rasters for each MAPSET.
 Am I doing something wrong?
 Thanks
 Jenny
 On Fri, Mar 11, 2011 at 2:29 PM, Ricardo Filipe Soares Garcia da
 ricardo.garcia.si...@gmail.com wrote:

 Hi Jenny

 Long story short: use your command like this (note the asterisk on the
 'pattern' variable):

 # python code
 p=grass.mlist_grouped ('rast', pattern='output*', mapset='Mapping')


 I am using the Ipython shell to script grass. It has a cool feature,
 that if you type the name of a function followed by two question
 marks, you can see the source code of the function (as long as it is
 coded in python itself).
 So, in doing:

 grass.mlist_grouped??

 It is possible to see that the mlist_grouped function is internally
 calling the 'g.mlist' command with only the 'm' flag.

 Reading the documentation for the g.mlist command [1], I realize that,
 without using the -r or -e flags, this command accepts wildcards[2] as
 the 'pattern' string. The asterisk (*) is the wildcard character for
 substituting for any zero or more characters. So, in order to get a
 string that starts with 'output' and after that can have anything, you
 just type 'output*'


 [1] - http://grass.fbk.eu/grass64/manuals/html64_user/g.mlist.html
 [2] - http://en.wikipedia.org/wiki/Wildcard_character#Computing


 On Fri, Mar 11, 2011 at 12:10 PM, Jenny Turner
 jennyturner1...@gmail.com wrote:
  Greetings
  I'm doing a GRASS Python Script where I need to list a set of raster
  maps
  but I'm not using its exact name but a basic regular expression (r flag
  in
  g.mlist function).
  So I want to find a list of rasters with output on its name:
  p=grass.mlist_grouped ('rast', pattern='output', mapset='Mapping')
  But I get null entries because no raster map is named output only
  output01
  output02 output03 ...
  I want to list all raster maps with output on itsd name. How can I do
  this
  using grass.mlist_grouped?
  Thanks
  Jenny
  ___
  grass-user mailing list
  grass-user@lists.osgeo.org
  http://lists.osgeo.org/mailman/listinfo/grass-user
 
 



 --
 ___ ___ __
 Ricardo Garcia Silva





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


Re: [GRASS-user] GRASS'c Python core function to use as g.mlist

2011-03-11 Thread Ricardo Filipe Soares Garcia da
Hi Jenny

Long story short: use your command like this (note the asterisk on the
'pattern' variable):

# python code
p=grass.mlist_grouped ('rast', pattern='output*', mapset='Mapping')


I am using the Ipython shell to script grass. It has a cool feature,
that if you type the name of a function followed by two question
marks, you can see the source code of the function (as long as it is
coded in python itself).
So, in doing:

grass.mlist_grouped??

It is possible to see that the mlist_grouped function is internally
calling the 'g.mlist' command with only the 'm' flag.

Reading the documentation for the g.mlist command [1], I realize that,
without using the -r or -e flags, this command accepts wildcards[2] as
the 'pattern' string. The asterisk (*) is the wildcard character for
substituting for any zero or more characters. So, in order to get a
string that starts with 'output' and after that can have anything, you
just type 'output*'


[1] - http://grass.fbk.eu/grass64/manuals/html64_user/g.mlist.html
[2] - http://en.wikipedia.org/wiki/Wildcard_character#Computing


On Fri, Mar 11, 2011 at 12:10 PM, Jenny Turner
jennyturner1...@gmail.com wrote:
 Greetings
 I'm doing a GRASS Python Script where I need to list a set of raster maps
 but I'm not using its exact name but a basic regular expression (r flag in
 g.mlist function).
 So I want to find a list of rasters with output on its name:
 p=grass.mlist_grouped ('rast', pattern='output', mapset='Mapping')
 But I get null entries because no raster map is named output only output01
 output02 output03 ...
 I want to list all raster maps with output on itsd name. How can I do this
 using grass.mlist_grouped?
 Thanks
 Jenny
 ___
 grass-user mailing list
 grass-user@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/grass-user





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


Re: [GRASS-user] Running an external executable file from a Python Script

2011-03-10 Thread Ricardo Filipe Soares Garcia da
Hi (Olá)

in order to figure out what is your current working folder (or active
folder) you can do

# python code

import os
os.getcwd()

# end of code

This will return a string with your current working folder.
As Glyn is stating, if you are going to call this external binary from
within a python script you can use a grass.Popen object (or just a
normal subprocess.Popen).
The grass.Popen object allows you to capture your external binary's
output and (eventual) error messages.

In the following example, I'm running the 'ls -l' external command,
using the /home/Documents directory as a working directory for the
external command. Please adapt to your problem / operating system:

# python code

import grass.script as grass

externalCommand = [ls, -l] # note that it is a list
externalProcess = grass.Popen(externalCommand, stdout=grass.PIPE,
stderr=grass.PIPE, cwd=/home/ricardo/Documents)
sdtout, stderr = externalProcess.communicate()

# to show the output of your external program
print(stdout)


# end of code


Hope it helps ;)

2011/3/10 Glynn Clements gl...@gclements.plus.com:

 António Rocha wrote:

 My question is, when I'm running a GRASS python Script what is my active
 folder in order to place there my Parameter file? Or, is there any way
 to change my active folder while I'm running GRASS python Script?

 By active folder, I presume that you're referring to the current
 directory (aka working directory, current working directory or CWD).
 This is inherited from the calling process; e.g. if you run a script
 from a shell, the script's current directory will be the shell's
 current directory.

 When executing a command via subprocess.Popen(), you can specify its
 current directory via the cwd= parameter. The grass.Popen() and
 grass.call() functions accept this parameter, as do all of the
 grass.*_command() functions for running GRASS modules.

 You can change the current directory for the current process using
 os.chdir(), but that should normally be avoided, as any relative
 filenames will then be interpreted relative to the new current
 directory, whereas the user probably intended them to be relative to
 the initial current directory.

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




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


Re: [GRASS-user] WinGRASS: Error when importing GRIB files

2010-11-29 Thread Ricardo Filipe Soares Garcia da
Olá António

On my windows VM, I have an older osgeo4w install, that hasn't got
GRIB support available. Maybe thats your problem as well? Run the
command

gdalinfo --formats

through the osgeo4w shell. Look for the GRIB format at the output.
If you cannot find a line that says GRIB there, your GDAL doesn't
support it, and GRASS won't be able to read it, as it depends on GDAL.

2010/11/29 António Rocha antonio.ro...@deimos.com.pt:
 Hi

 I'm using WinGRASS (6.4.1) in Osgeo4w and I'm having a problem in the import
 of GRIB files. I'm using r.in.gdal, as I have used in Linux, and I'm
 obtaining the following error:
 ERROR 4: `C:\Data\GISDataBase\GRIB_codes\new03.grib' not
 recognised as a supported file format.

 What might be missing?
 Thanks
 Antonio



 __ Information from ESET NOD32 Antivirus, version of virus signature
 database 5657 (20101129) __

 The message was checked by ESET NOD32 Antivirus.

 http://www.eset.com


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




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


Re: [GRASS-user] elevation profile

2010-07-15 Thread Ricardo Filipe Soares Garcia da
Hi

I think r.profile[1] can probably help you get to the output you want.
In the past I had looked into doing the exact same thing as you. I
ended up using SAGA GIS[2], as it has a predefined module that does
exactly this task, and I was in a hurry ;)

Good luck


[1] - http://grass.itc.it/grass64/manuals/html64_user/r.profile.html
[2] - http://www.saga-gis.org

On Thu, Jul 15, 2010 at 8:41 PM, John C. Tull jct...@gmail.com wrote:
 Hi John,
 You will likely get a more complete answer from others, but you seem to be
 on the right track with v.drape. From there, you can add a column for
 cumulative length with v.db.addcol, then run v.to.db with option=length to
 add a length column to your 3d vector. You might be able to subsample from
 there.
 Another possibility would be to run v.segment to generate points at your
 desired length interval for the original vector. Then you could run v.drape
 on the resulting points file and work from there or somehow pipe the point
 coordinates into r.profile.
 Good luck,
 John
 On Jul 15, 2010, at 12:25 PM, John Callahan wrote:

 Hopefully a quick question that I'm struggling with.  (I'm a long-time GIS
 user but trying to move my work to GRASS and other FOSS4G.)   I'm using
 GRASS 6.4 RC6 on Windows XP.

 I have a raster grid representing elevation at 2meter resolution. I have a
 line shapefile representing roads (about 20 roads total).  I would like to
 get ASCII text files of x,y,z at about 1 or 2 meter intervals along each
 road.  Any ides of what I can try?

 I thought v.drape might work. This converts my 2D road shapefile to 3D, but
 I'm not sure where to go from there.  And this doesn't help getting 1 or 2
 meter intervals.  I also tried r.profile but this requires input as a
 listing of x,y coordinates, not shapefiles.  I know there's a step here I'm
 missing.

 - John

 **
 John Callahan, Geographic Information Scientist
 Delaware Geological Survey, University of Delaware
 URL: http://www.dgs.udel.edu
 **
 ___
 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





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


Re: [GRASS-user] grass 6.4 rc5 and python scripting

2009-07-01 Thread Ricardo Filipe Soares Garcia da
 how/where do you set the variable? it needs to be set before
 GRASS begins.

I have set the GRASS_ADDON_PATH variable in my ~/.bashrc, like this

export GRASS_ADDON_PATH=/home/ricardo/gisProjectos/grassAddons


 in the gnome menu entry prefs do you have start in terminal ticked?


Yep, it actually says Application in Terminal, and it is selected



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


[GRASS-user] network analysis: cost columns and v.net.alloc problem

2009-07-01 Thread Ricardo Filipe Soares Garcia da
Hello list
I have a problem with the setting up of a vector map for network analysis:

- I have two cost columns associated with the cost of traveling on
each direction of arcs (so the afcol and abcol).
- It happens that on some arcs (representing streets) sometimes it is
not allowed to travel in one direction, and in that case the cost is
set to -1
- Now I have a set of points that I can connect to the network and
then I want to calculate sub-nets for each point (using v.net.alloc)
- When I connect the points to the network (using v.net), new lines
get created to expand the network and link it with the points
- These new lines get created and are assigned the cat of the main
line from which they got extruded
- The problem is: it happens that the cost associated with the main
arc gets assigned also to this new line that connects the point to the
network. This is due to the fact that both lines share the same cat
(the key to the attribute table)
- So if the main line had a cost of -1 assigned to one of the travel
directions it means the new line will also have this same cost. This
will make it impossible to travel (to or from, according to the
affected column) to the point in the end of this line. This fact will
cause the v.net.alloc algorithm to not assign a subnet to this point,
since it is in fact inaccessible.

- Since both the main arc (the one belonging to the actual street) and
the sub-arc (the one that just connects the point to the network)
share the same cat, and thus the same entry in the attributes table,
how can I fix the costs on the sub-arc without affecting the main one?
- The only way I managed to uniquely reference these sub-arcs was with
their internal ID (which I can see when I interactively query the
vector's properties), but I can't seem to do much with it


So, if I'm still making sense, can someone please offer some advice on
how to solve this?

- Will I have to manually delete the sub-arcs and then digitize them
myself? It could work on this case, where I have only 9 points to
connect, but if I had more...
Thanks for your help

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


[GRASS-user] grass 6.4 rc5 and python scripting

2009-06-30 Thread Ricardo Filipe Soares Garcia da
Hello list

I compiled grass-6.4.0RC5 (downloaded a tarball from the main site).
I'd like to learn about scripting grass with python.

Following the first sample script at the GRASS Python scripting
library (http://download.osgeo.org/grass/grass6_progman/pythonlib.html)
I created a test file called teste.py, and placed it on the Desktop.
When I try to run it inside a GRASS session I am geting the following
error:

GRASS 6.4.0RC5 (aeigT3):~/Desktop  ./teste.py
sh: teste.py: not found
Traceback (most recent call last):
  File /usr/local/grass-6.4.0RC5/etc/wxpython/gui_modules/menuform.py,
line 1931, in module
GrassGUIApp( grassTask( sys.argv[1] ) ).MainLoop()
  File /usr/local/grass-6.4.0RC5/etc/wxpython/gui_modules/menuform.py,
line 335, in __init__
xml.sax.parseString( getInterfaceDescription( grassModule ) ,
processTask( self ) )
  File /usr/local/grass-6.4.0RC5/etc/wxpython/gui_modules/menuform.py,
line 1748, in getInterfaceDescription
raise IOError, _(Unable to fetch interface description for
command '%s'.) % cmd
IOError: Unable to fetch interface description for command 'teste.py'.

The file contents are just a copy+paste from the online example. Can
someone point me to the cause of the error?

Thanks in advance



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


Re: [GRASS-user] grass 6.4 rc5 and python scripting

2009-06-30 Thread Ricardo Filipe Soares Garcia da
Thanks for your help

Now I'll get on with the program!
Hopefully I'll be able to build a script that can find the nearest
hospital to an accident site on a vector network working ;)

Cheers


On Tue, Jun 30, 2009 at 2:51 PM, Martin Landalanda.mar...@gmail.com wrote:
 Hi,

 2009/6/30 Ricardo Filipe Soares Garcia da ricardo.garcia.si...@gmail.com:
 Following the first sample script at the GRASS Python scripting
 library (http://download.osgeo.org/grass/grass6_progman/pythonlib.html)
 I created a test file called teste.py, and placed it on the Desktop.
 When I try to run it inside a GRASS session I am geting the following
 error:

 to launch wxGUI interface you need to copy teste.py to
 $GISBASE/scripts. Anyway CLI works in every case

 ./teste.py --help

 Martin

 --
 Martin Landa landa.martin gmail.com * http://gama.fsv.cvut.cz/~landa




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


Re: [GRASS-user] grass 6.4 rc5 and python scripting

2009-06-30 Thread Ricardo Filipe Soares Garcia da
Hello all
Thanks for your good advice. I decided to go with the option of
EXPORTing the grass addon path and put my scripts there, which works
ok, well... kind of.

It happens that when I launch GRASS from the terminal, the
GRASS_ADDON_PATH gets correctly added to the PATH and I can load my
test script. However, if I start GRASS from the gnome menu (or
gnome-do) the GRASS_ADDON_PATH gets ignored. Maybe theres some config
file that I have to tweak?

On Tue, Jun 30, 2009 at 5:54 PM, Michael Bartonmichael.bar...@asu.edu wrote:
 It really does work. It's pretty nice. I don't know how .grassrc6 handles
 separators--GRASS specific or OS specific.

 Michael
 __
 C. Michael Barton, Professor of Anthropology
 Director of Graduate Studies, School of Human Evolution  Social Change
 Director, Center for Social Dynamics  Complexity
 Arizona State University
 Tempe, AZ  85287-2402
 USA

 voice: 480-965-6262; fax: 480-965-7671
 www: http://www.public.asu.edu/~cmbarton

 On Jun 30, 2009, at 9:31 AM, Hamish wrote:


 Michael Barton wrote:

 3. Set the GRASS_ADDON_PATH variable in the .grassrc6 file
 (or its equivalent in GRASS 7). For example, I could add...

 GRASS_ADDON_PATH: /Users/Michael/Desktop;/Users/Michael/Documents

 ...and any script on my desktop or in my documents folder
 would be accessible to g.parser and GRASS. (Note: I'm not
 sure if ; or something else should be the separator
 between paths). This is very convenient for having a
 permanent folder outside the main GRASS distribution
 location where you can put any custom scripts.


 does that really work??
 it should be an environment variable, not a g.gisenv GRASS variable.


 the path separator on UNIXes is ':', the path sep on MS Win is ';'.
 but those shouldn't be needed here (unless you want to define
 multiple addon dirs).


 Hamish






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




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