[GRASS-user] map display query and layers

Helmut Kudrnovsky hellik at web.de
Sun Oct 2 01:53:49 PDT 2016


Dave Roberts wrote
> Hi Vincent,
> 
>     I have studied the GRASS_GIS_vector_management_model page (and all 
> the discussion leading up to that), and I think I understand the data 
> model.  What I don't understand is how the map display interacts with 
> the data tables.  So in my example case, yes, there are two tables, both 
> with key=cat, but that's pretty typical for data imported into GRASS 
> with v.in.ogr or v.in.e00.  I have another case where I imported an ESRI 
> GDB, and GRASS created 25 layers all with key=cat.  When I do
> 
> d.vect bryceveg
> 
> it seems to draw correctly, but when I use the map query icon and mouse 
> click it gives me results for layers 22, 23, 25, and 26 (which is not 
> connected to a table).  Even if I specify
> 
> d.vect bryceveg layer=1
> 
> when I query I still get 22, 23, 25, and 26, none of which I want.
> 
>     So undoubtedly it's possible (with significant effort) to convert 
> this to 25 different vector features each with only one table, but that 
> seems like a lot of work, and I would expect when I specify the layer to 
> draw that's the layer that gets queried.  If I have time, I'll dig into 
> the code (hopefully python) driving the map query.
> 
> Thanks, Dave

tested here with the NC sample data set

<--------------
g.copy vector=firestations at PERMANENT,myfire
--------------
v.category input=myfire at user1
layer=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25
output=myfire_manylayers option=transfer
--------------
v.db.addtable map=myfire_manylayers at user1 layer=2
[...]
v.db.addtable map=myfire_manylayers at user1 layer=25
--------------
map query:
east, north: 634259.762762, 238301.919626
myfire_manylayers at user1: 
  Type: Point
  Id: 16
  Layer: 1
  Category: 16
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers
  Key_column: cat
  Attributes: 
    cat: 16
    ID: 17
    LABEL: RFD #23
    LOCATION: 8312 Pinecrest Rd
    CITY: Raleigh
    MUN_COUNT: M
    PUMPERS: 1
    PUMPER_TAN: 0
    TANKER: 0
    MINI_PUMPE: 0
    RESCUE_SER: 0
    AERIAL: 0
    BRUSH: 0
    OTHERS: 0
    WATER_RESC: 0
    MUNCOID: 1
    BLDGCODE: 256
    AGENCY: RF
    STATIONID: RF23
    RECNO: 18
    CV_SID2: RF23
    CVLAG: 0
myfire_manylayers at user1: 
  Type: Point
  Id: 16
  Layer: 2
  Category: 16
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_2
  Key_column: cat
  Attributes: 
    cat: 16
myfire_manylayers at user1: 
  Type: Point
  Id: 16
  Layer: 3
  Category: 16
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_3
  Key_column: cat
  Attributes: 
    cat: 16
myfire_manylayers at user1: 
  Type: Point
  Id: 16
  Layer: 4
  Category: 16
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_4
  Key_column: cat
  Attributes: 
    cat: 16
myfire_manylayers at user1: 
  Type: Point
  Id: 16
  Layer: 5
  Category: 16
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_5
  Key_column: cat
  Attributes: 
    cat: 16
myfire_manylayers at user1: 
  Type: Point
  Id: 16
  Layer: 6
  Category: 16
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_6
  Key_column: cat
  Attributes: 
    cat: 16
myfire_manylayers at user1: 
  Type: Point
  Id: 16
  Layer: 7
  Category: 16
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_7
  Key_column: cat
  Attributes: 
    cat: 16
myfire_manylayers at user1: 
  Type: Point
  Id: 16
  Layer: 8
  Category: 16
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_8
  Key_column: cat
  Attributes: 
    cat: 16
myfire_manylayers at user1: 
  Type: Point
  Id: 16
  Layer: 9
  Category: 16
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_9
  Key_column: cat
  Attributes: 
    cat: 16
myfire_manylayers at user1: 
  Type: Point
  Id: 16
  Layer: 10
  Category: 16
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_10
  Key_column: cat
  Attributes: 
    cat: 16
myfire_manylayers at user1: 
  Type: Point
  Id: 16
  Layer: 11
  Category: 16
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_11
  Key_column: cat
  Attributes: 
    cat: 16
myfire_manylayers at user1: 
  Type: Point
  Id: 16
  Layer: 12
  Category: 16
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_12
  Key_column: cat
  Attributes: 
    cat: 16
myfire_manylayers at user1: 
  Type: Point
  Id: 16
  Layer: 13
  Category: 16
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_13
  Key_column: cat
  Attributes: 
    cat: 16
myfire_manylayers at user1: 
  Type: Point
  Id: 16
  Layer: 14
  Category: 16
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_14
  Key_column: cat
  Attributes: 
    cat: 16
myfire_manylayers at user1: 
  Type: Point
  Id: 16
  Layer: 15
  Category: 16
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_15
  Key_column: cat
  Attributes: 
    cat: 16
myfire_manylayers at user1: 
  Type: Point
  Id: 16
  Layer: 16
  Category: 16
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_16
  Key_column: cat
  Attributes: 
    cat: 16
myfire_manylayers at user1: 
  Type: Point
  Id: 16
  Layer: 17
  Category: 16
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_17
  Key_column: cat
  Attributes: 
    cat: 16
myfire_manylayers at user1: 
  Type: Point
  Id: 16
  Layer: 18
  Category: 16
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_18
  Key_column: cat
  Attributes: 
    cat: 16
myfire_manylayers at user1: 
  Type: Point
  Id: 16
  Layer: 19
  Category: 16
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_19
  Key_column: cat
  Attributes: 
    cat: 16
myfire_manylayers at user1: 
  Type: Point
  Id: 16
  Layer: 20
  Category: 16
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_20
  Key_column: cat
  Attributes: 
    cat: 16
myfire_manylayers at user1: 
  Type: Point
  Id: 16
  Layer: 21
  Category: 16
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_21
  Key_column: cat
  Attributes: 
    cat: 16
myfire_manylayers at user1: 
  Type: Point
  Id: 16
  Layer: 22
  Category: 16
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_22
  Key_column: cat
  Attributes: 
    cat: 16
myfire_manylayers at user1: 
  Type: Point
  Id: 16
  Layer: 23
  Category: 16
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_23
  Key_column: cat
  Attributes: 
    cat: 16
myfire_manylayers at user1: 
  Type: Point
  Id: 16
  Layer: 24
  Category: 16
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_24
  Key_column: cat
  Attributes: 
    cat: 16
myfire_manylayers at user1: 
  Type: Point
  Id: 16
  Layer: 25
  Category: 16
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_25
  Key_column: cat
  Attributes: 
    cat: 16
	
-------------------
v.db.addcolumn map=myfire_manylayers at user1 layer=25 columns="xcoor double,
ycoor double"
-------------------
v.to.db map=myfire_manylayers at user1 layer=25 option=coor columns=xcoor,ycoor
query_layer=25
-------------------
d.vect map=myfire_manylayers at user1 layer=25
type=point,line,boundary,area,face color=255:128:128 fill_color=yellow
width=1 icon=basic/point
-------------------
map query:

east, north: 635640.025007, 234049.31523
myfire_manylayers at user1: 
  Type: Point
  Id: 17
  Layer: 1
  Category: 17
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers
  Key_column: cat
  Attributes: 
    cat: 17
    ID: 0
    LABEL: RFD #17
    LOCATION: 4601 Pleasant Valley Rd
    CITY: Raleigh
    MUN_COUNT: M
    PUMPERS: 1
    PUMPER_TAN: 0
    TANKER: 0
    MINI_PUMPE: 0
    RESCUE_SER: 0
    AERIAL: 0
    BRUSH: 0
    OTHERS: 0
    WATER_RESC: 0
    MUNCOID: 1
    BLDGCODE: 257
    AGENCY: RF
    STATIONID: RF17
    RECNO: 19
    CV_SID2: RF17
    CVLAG: 0
myfire_manylayers at user1: 
  Type: Point
  Id: 17
  Layer: 2
  Category: 17
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_2
  Key_column: cat
  Attributes: 
    cat: 17
[...]
myfire_manylayers at user1: 
  Type: Point
  Id: 17
  Layer: 25
  Category: 17
  Driver: sqlite
  Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
  Table: myfire_manylayers_25
  Key_column: cat
  Attributes: 
    cat: 17
    xcoor: 635640.313379964
    ycoor: 234048.036434468
-------------------
v.what -a map=myfire_manylayers at user1 layer=25 coordinates=635642.103403,
234048.276032 distance=10
East: 635642.103403
North: 234048.276032
------------------------------------------------------------------
Map: myfire_manylayers 
Mapset: user1
Type: Point
Id: 17
Layer: 1
Category: 17
Driver: sqlite
Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
Table: myfire_manylayers
Key column: cat
cat : 17
ID : 0
LABEL : RFD #17
LOCATION : 4601 Pleasant Valley Rd
CITY : Raleigh
MUN_COUNT : M
PUMPERS : 1
PUMPER_TAN : 0
TANKER : 0
MINI_PUMPE : 0
RESCUE_SER : 0
AERIAL : 0
BRUSH : 0
OTHERS : 0
WATER_RESC : 0
MUNCOID : 1
BLDGCODE : 257
AGENCY : RF
STATIONID : RF17
RECNO : 19
CV_SID2 : RF17
CVLAG : 0
Layer: 2
Category: 17
Driver: sqlite
Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
Table: myfire_manylayers_2
Key column: cat
cat : 17
Layer: 3
Category: 17
Driver: sqlite
Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
Table: myfire_manylayers_3
Key column: cat
cat : 17
Layer: 4
Category: 17
Driver: sqlite
Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
Table: myfire_manylayers_4
Key column: cat
cat : 17
Layer: 5
Category: 17
Driver: sqlite
Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
Table: myfire_manylayers_5
Key column: cat
cat : 17
Layer: 6
Category: 17
Driver: sqlite
Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
Table: myfire_manylayers_6
Key column: cat
cat : 17
Layer: 7
Category: 17
Driver: sqlite
Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
Table: myfire_manylayers_7
Key column: cat
cat : 17
Layer: 8
Category: 17
Driver: sqlite
Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
Table: myfire_manylayers_8
Key column: cat
cat : 17
Layer: 9
Category: 17
Driver: sqlite
Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
Table: myfire_manylayers_9
Key column: cat
cat : 17
Layer: 10
Category: 17
Driver: sqlite
Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
Table: myfire_manylayers_10
Key column: cat
cat : 17
Layer: 11
Category: 17
Driver: sqlite
Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
Table: myfire_manylayers_11
Key column: cat
cat : 17
Layer: 12
Category: 17
Driver: sqlite
Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
Table: myfire_manylayers_12
Key column: cat
cat : 17
Layer: 13
Category: 17
Driver: sqlite
Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
Table: myfire_manylayers_13
Key column: cat
cat : 17
Layer: 14
Category: 17
Driver: sqlite
Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
Table: myfire_manylayers_14
Key column: cat
cat : 17
Layer: 15
Category: 17
Driver: sqlite
Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
Table: myfire_manylayers_15
Key column: cat
cat : 17
Layer: 16
Category: 17
Driver: sqlite
Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
Table: myfire_manylayers_16
Key column: cat
cat : 17
Layer: 17
Category: 17
Driver: sqlite
Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
Table: myfire_manylayers_17
Key column: cat
cat : 17
Layer: 18
Category: 17
Driver: sqlite
Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
Table: myfire_manylayers_18
Key column: cat
cat : 17
Layer: 19
Category: 17
Driver: sqlite
Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
Table: myfire_manylayers_19
Key column: cat
cat : 17
Layer: 20
Category: 17
Driver: sqlite
Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
Table: myfire_manylayers_20
Key column: cat
cat : 17
Layer: 21
Category: 17
Driver: sqlite
Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
Table: myfire_manylayers_21
Key column: cat
cat : 17
Layer: 22
Category: 17
Driver: sqlite
Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
Table: myfire_manylayers_22
Key column: cat
cat : 17
Layer: 23
Category: 17
Driver: sqlite
Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
Table: myfire_manylayers_23
Key column: cat
cat : 17
Layer: 24
Category: 17
Driver: sqlite
Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
Table: myfire_manylayers_24
Key column
: cat
cat : 17
Layer: 25
Category: 17
Driver: sqlite
Database: J:\gisdata\nc_spm_08_grass7\user1\sqlite\sqlite.db
Table: myfire_manylayers_25
Key column: cat
cat : 17
xcoor : 635640.313379964
ycoor : 234048.036434468
-------------->

it seems that d.what.vect [1] reports always all data of all layers.

the same with v.what although the queried layer is specified.

so maybe a bug/enhancement ticket is needed.

[1] https://grass.osgeo.org/grass73/manuals/d.what.vect.html
[2] https://grass.osgeo.org/grass73/manuals/v.what.html



-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/map-display-query-and-layers-tp5288830p5288923.html
Sent from the Grass - Users mailing list archive at Nabble.com.


More information about the grass-user mailing list