[GRASS-dev] Select vector feature - Error

Hi,

when i try to select a feature with the “select vector feature” button from map display, I get an Error pop up that reads:

Error occured during calling of handler: _onMapClickHandler
Handler was unregistered.

Reason: VectorSelectBase instance has no attribute ‘map’

Traceback (most recent call last):
File “/usr/local/grass-7.1.svn/gui/wxpython/mapwin/base.py”, line 191, in HandlersCaller
handler(event)
File “/usr/local/grass-7.1.svn/gui/wxpython/gui_core/vselect.py”, line 187, in onMapClickHandler
vWhatDic = self.QuerySelectedMap()
File “/usr/local/grass-7.1.svn/gui/wxpython/gui_core/vselect.py”, line 272, in QuerySelectedMap
message=
(“Failed to query vector map(s) <%s>.”) % self.map)
AttributeError: VectorSelectBase instance has no attribute ‘map’

Thanks

···

Best regards,

Dr. Margherita DI LEO
Scientific / technical project officer

European Commission - DG JRC
Institute for Environment and Sustainability (IES)
Via Fermi, 2749
I-21027 Ispra (VA) - Italy - TP 261

Tel. +39 0332 78 3600
margherita.di-leo@jrc.ec.europa.eu

Disclaimer: The views expressed are purely those of the writer and may not in any circumstance be regarded as stating an official position of the European Commission.

On 02/03/15 11:28, Margherita Di Leo wrote:

Hi,

when i try to select a feature with the "select vector feature" button
from map display, I get an Error pop up that reads:

Error occured during calling of handler: _onMapClickHandler
Handler was unregistered.

Reason: VectorSelectBase instance has no attribute 'map'

Traceback (most recent call last):
   File "/usr/local/grass-7.1.svn/gui/wxpython/mapwin/base.py", line
191, in HandlersCaller
     handler(event)
   File "/usr/local/grass-7.1.svn/gui/wxpython/gui_core/vselect.py",
line 187, in _onMapClickHandler
     vWhatDic = self.QuerySelectedMap()
   File "/usr/local/grass-7.1.svn/gui/wxpython/gui_core/vselect.py",
line 272, in QuerySelectedMap
     message=_("Failed to query vector map(s) <%s>.") % self.map)
AttributeError: VectorSelectBase instance has no attribute 'map'

I cannot reproduce using freshly checked out trunk and the NC dataset.

BTW, two remarks for enhancement:

- It would be nice if the tool allowed to select also by drawing a polygon, not only by clicking.
- There is no close button on the little window listing the selected features.

Moritz

Hi,

2015-03-03 9:45 GMT+01:00 Moritz Lennert <mlennert@club.worldonline.be>:

[...]

BTW, two remarks for enhancement:

- It would be nice if the tool allowed to select also by drawing a polygon,
not only by clicking.

right, it's in TODO.

- There is no close button on the little window listing the selected
features.

Sending in copy to the author (Matej Krejci), thanks for testing. Martin

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

Hi,

i’m trying to generate a png from python using the the d.mon / d. last / d.vect commands

in the past (grass70) this code worked fine :

GRASS_TRANSPARENT=TRUE
GRASS_TRUECOLOR=TRUE
GRASS_PNG_COMPRESSION=9
GRASS_PNG_AUTO_WRITE=TRUE
export GRASS_TRANSPARENT GRASS_TRUECOLOR GRASS_PNG_COMPRESSION GRASS_PNG_AUTO_WRITE

d.mon start=cairo --q output={mapname}.png
g.region rast={mapname} n={n} s={s} w={w} e={e} -a --q
d.rast map={mapname} --q
d.vect map={mapname} color={vcolor} size={vsize} icon={icon} --q
d.mon stop=cairo --q

but now is not generating any png :frowning:

browsing the add ons i saw v.out.png is no more in trunk and i gave it a try :

###
import os
import sys
from grass.script import core as grass
from grass.script import gisenv
from grass.pygrass.modules.shortcuts import display as d
from grass.pygrass.modules.shortcuts import general as g

os.environ['GRASS_RENDER_IMMEDIATE'] = 'png'
os.environ['GRASS_RENDER_FILE'] = 'pfile3.png'
os.environ['GRASS_RENDER_FILE_COMPRESSION'] = '9'
os.environ['GRASS_RENDER_WIDTH'] = '640'
os.environ['GRASS_RENDER_HEIGHT'] = '480'
os.environ['GRASS_RENDER_TRANSPARENT']='TRUE'

monitor_old = None
genv = gisenv()
if 'MONITOR' in genv:
    monitor_old = genv['MONITOR']
    g.gisenv(unset='MONITOR')

d.vect(map='p')
d.rast(map='basemap')
###

this time the png is generated, but i’m no more able to overlay 2 different layers to compose my map …

Have you any thoughts on what’s wrong in those procedures ?

I tried on the osgeolive, the first approach works for grass70.
building grass71 and try it again … no png is generated.

Thanks for any advice.

Massimo.

Hi,

2015-03-03 16:23 GMT+01:00 epi <massimodisasha@gmail.com>:

GRASS_TRANSPARENT=TRUE
GRASS_TRUECOLOR=TRUE
GRASS_PNG_COMPRESSION=9
GRASS_PNG_AUTO_WRITE=TRUE
export GRASS_TRANSPARENT GRASS_TRUECOLOR GRASS_PNG_COMPRESSION GRASS_PNG_AUTO_WRITE

render-related variables has been renamed to GRASS_RENDER_, see [1].

os.environ['GRASS_RENDER_IMMEDIATE'] = 'png'
os.environ['GRASS_RENDER_FILE'] = 'pfile3.png'
os.environ['GRASS_RENDER_FILE_COMPRESSION'] = '9'
os.environ['GRASS_RENDER_WIDTH'] = '640'
os.environ['GRASS_RENDER_HEIGHT'] = '480'
os.environ['GRASS_RENDER_TRANSPARENT']='TRUE'

monitor_old = None
genv = gisenv()
if 'MONITOR' in genv:
    monitor_old = genv['MONITOR']
    g.gisenv(unset='MONITOR')

d.vect(map='p')
d.rast(map='basemap')
###

this time the png is generated, but i'm no more able to overlay 2 different layers to compose my map ...

You need to define GRASS_RENDER_READ_FILE='TRUE'. Martin

[1] http://grass.osgeo.org/grass70/manuals/variables.html#list-of-selected-grass-environment-variables-for-rendering

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

Thank Martin,

I tried with this :

http://nbviewer.ipython.org/gist/anonymous/e72c4a3b311370ade0db

but I still have the same behavior

Thanks a lot to for looking into this!

Massimo.

On Mar 3, 2015, at 10:30 AM, Martin Landa <landa.martin@gmail.com> wrote:

Hi,

2015-03-03 16:23 GMT+01:00 epi <massimodisasha@gmail.com>:

GRASS_TRANSPARENT=TRUE
GRASS_TRUECOLOR=TRUE
GRASS_PNG_COMPRESSION=9
GRASS_PNG_AUTO_WRITE=TRUE
export GRASS_TRANSPARENT GRASS_TRUECOLOR GRASS_PNG_COMPRESSION GRASS_PNG_AUTO_WRITE

render-related variables has been renamed to GRASS_RENDER_, see [1].

os.environ[‘GRASS_RENDER_IMMEDIATE’] = ‘png’
os.environ[‘GRASS_RENDER_FILE’] = ‘pfile3.png’
os.environ[‘GRASS_RENDER_FILE_COMPRESSION’] = ‘9’
os.environ[‘GRASS_RENDER_WIDTH’] = ‘640’
os.environ[‘GRASS_RENDER_HEIGHT’] = ‘480’
os.environ[‘GRASS_RENDER_TRANSPARENT’]=‘TRUE’

monitor_old = None
genv = gisenv()
if ‘MONITOR’ in genv:
monitor_old = genv[‘MONITOR’]
g.gisenv(unset=‘MONITOR’)

d.vect(map=‘p’)
d.rast(map=‘basemap’)

this time the png is generated, but i’m no more able to overlay 2 different layers to compose my map …

You need to define GRASS_RENDER_READ_FILE=‘TRUE’. Martin

[1] http://grass.osgeo.org/grass70/manuals/variables.html#list-of-selected-grass-environment-variables-for-rendering


Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

On Tue, Mar 3, 2015 at 11:13 AM, epi <massimodisasha@gmail.com> wrote:

Thank Martin,

I tried with this :

http://nbviewer.ipython.org/gist/anonymous/e72c4a3b311370ade0db

but I still have the same behavior

I think it's GRASS_RENDER_FILE_READ, not GRASS_RENDER_READ_FILE.
http://grass.osgeo.org/grass71/manuals/cairodriver.html

Anna

Thanks a lot to for looking into this!

Massimo.

On Mar 3, 2015, at 10:30 AM, Martin Landa <landa.martin@gmail.com> wrote:

Hi,

2015-03-03 16:23 GMT+01:00 epi <massimodisasha@gmail.com>:

GRASS_TRANSPARENT=TRUE
GRASS_TRUECOLOR=TRUE
GRASS_PNG_COMPRESSION=9
GRASS_PNG_AUTO_WRITE=TRUE
export GRASS_TRANSPARENT GRASS_TRUECOLOR GRASS_PNG_COMPRESSION
GRASS_PNG_AUTO_WRITE

render-related variables has been renamed to GRASS_RENDER_, see [1].

os.environ['GRASS_RENDER_IMMEDIATE'] = 'png'
os.environ['GRASS_RENDER_FILE'] = 'pfile3.png'
os.environ['GRASS_RENDER_FILE_COMPRESSION'] = '9'
os.environ['GRASS_RENDER_WIDTH'] = '640'
os.environ['GRASS_RENDER_HEIGHT'] = '480'
os.environ['GRASS_RENDER_TRANSPARENT']='TRUE'

monitor_old = None
genv = gisenv()
if 'MONITOR' in genv:
   monitor_old = genv['MONITOR']
   g.gisenv(unset='MONITOR')

d.vect(map='p')
d.rast(map='basemap')
###

this time the png is generated, but i'm no more able to overlay 2
different layers to compose my map ...

You need to define GRASS_RENDER_READ_FILE='TRUE'. Martin

[1]
http://grass.osgeo.org/grass70/manuals/variables.html#list-of-selected-grass-environment-variables-for-rendering

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

2015-03-03 19:48 GMT+01:00 Anna Petrášová <kratochanna@gmail.com>:

I think it's GRASS_RENDER_FILE_READ, not GRASS_RENDER_READ_FILE.
http://grass.osgeo.org/grass71/manuals/cairodriver.html

you are right, Martin

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

Martin, Anna,
Thank you so much, it works great.

Massimo.

On Mar 3, 2015, at 1:53 PM, Martin Landa <landa.martin@gmail.com> wrote:

2015-03-03 19:48 GMT+01:00 Anna Petrášová <kratochanna@gmail.com>:

I think it's GRASS_RENDER_FILE_READ, not GRASS_RENDER_READ_FILE.
http://grass.osgeo.org/grass71/manuals/cairodriver.html

you are right, Martin

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa