[GRASS-dev] [GRASS GIS] #377: gis.m/Map Display fails to handle vector layers with multiple databse layers

#377: gis.m/Map Display fails to handle vector layers with multiple databse
layers
----------------------------------+-----------------------------------------
Reporter: ploewe | Owner: grass-dev@lists.osgeo.org
     Type: defect | Status: new
Priority: major | Milestone: 6.4.0
Component: Tcl | Version: 6.3.0
Keywords: gis.m database query | Platform: Linux
      Cpu: x86-32 |
----------------------------------+-----------------------------------------
GRASS 6.3 gives strange effects when one is attempting to query or display
data from database layers greater than 1. This can be reproduced.

Example:

A polygon layer has been connected (in postgres) to two tables in layer 1
and layer 2:

GRASS 6.3.0 (meteo):~ > v.db.connect -p map=counties_pie01
Vector map <counties_pie01> is connected by:
layer <1> table <counties_pie01> in database <host=localhost,dbname=meteo>
through driver <pg> with key <cat>
layer <2> table <counties_pie01_a> in database
<host=localhost,dbname=meteo> through driver <pg> with key <cat>

The layer can be displayed in a map display, including its centroids.
While the "Layer for labels"/"Layer for query" is set to 1 (default),
performance is normal.

Hell breaks loose when the "Layer for query" is set to "2": Out of a
sudden all centroids and filled areas disappear from from the map display
(polygon outlines are still displayed).

The phenomena for "Layer for label"=2 are less severe: A "Attribute col
for labels" from the second table is just ignored, while polygon outlines,
area fills and centroids are properly rendered.

The gis.m output window does not provide any error messages or warnings
while these phenomena occur.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/377&gt;
GRASS GIS <http://grass.osgeo.org>

#377: gis.m/Map Display fails to handle vector layers with multiple databse
layers
---------------------+------------------------------------------------------
  Reporter: ploewe | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.4.0
Component: Tcl | Version: 6.3.0
Resolution: | Keywords: gis.m database query
  Platform: Linux | Cpu: x86-32
---------------------+------------------------------------------------------
Comment (by mlennert):

Replying to [ticket:377 ploewe]:
> GRASS 6.3 gives strange effects when one is attempting to query or
display data from database layers greater than 1. This can be reproduced.
>
> Example:
>
> A polygon layer has been connected (in postgres) to two tables in layer
1 and layer 2:
>
> GRASS 6.3.0 (meteo):~ > v.db.connect -p map=counties_pie01
> Vector map <counties_pie01> is connected by:
> layer <1> table <counties_pie01> in database
<host=localhost,dbname=meteo> through driver <pg> with key <cat>
> layer <2> table <counties_pie01_a> in database
<host=localhost,dbname=meteo> through driver <pg> with key <cat>

Could you give us the output of v.category option=report ?

Moritz

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/377#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

-------- Original-Nachricht --------

Datum: Fri, 21 Nov 2008 15:35:45 -0000
Von: "GRASS GIS" <trac@osgeo.org>
An:
Betreff: Re: [GRASS GIS] #377: gis.m/Map Display fails to handle vector layers with multiple databse layers

#377: gis.m/Map Display fails to handle vector layers with multiple
databse
layers
---------------------+------------------------------------------------------
  Reporter: ploewe | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.4.0
Component: Tcl | Version: 6.3.0
Resolution: | Keywords: gis.m database query
  Platform: Linux | Cpu: x86-32
---------------------+------------------------------------------------------
Comment (by mlennert):

Replying to [ticket:377 ploewe]:
> GRASS 6.3 gives strange effects when one is attempting to query or
display data from database layers greater than 1. This can be reproduced.
>
> Example:
>
> A polygon layer has been connected (in postgres) to two tables in layer
1 and layer 2:
>
> GRASS 6.3.0 (meteo):~ > v.db.connect -p map=counties_pie01
> Vector map <counties_pie01> is connected by:
> layer <1> table <counties_pie01> in database
<host=localhost,dbname=meteo> through driver <pg> with key <cat>
> layer <2> table <counties_pie01_a> in database
<host=localhost,dbname=meteo> through driver <pg> with key <cat>

Could you give us the output of v.category option=report ?

v.category input=counties_pie01 option=report layer=1
Layer / table: 1 / counties_pie01
type count min max
point 0 0 0
line 0 0 0
boundary 0 0 0
centroid 558 1 439
area 0 0 0
all 558 1 439

v.category input=counties_pie01 option=report layer=2
type count min max
point 0 0 0
line 0 0 0
boundary 0 0 0
centroid 558 1 439
area 0 0 0
all 558 1 439

HTH,
Peter

Moritz

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/377#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

--
Dr. Peter Löwe
<peter.loewe@gmx.de>

Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger

Hi,

2008/11/24 "Peter Löwe" <peter.loewe@gmx.de>:

Could you give us the output of v.category option=report ?

v.category input=counties_pie01 option=report layer=1
Layer / table: 1 / counties_pie01
type count min max
point 0 0 0
line 0 0 0
boundary 0 0 0
centroid 558 1 439
area 0 0 0
all 558 1 439

v.category input=counties_pie01 option=report layer=2
type count min max
point 0 0 0
line 0 0 0
boundary 0 0 0
centroid 558 1 439
area 0 0 0
all 558 1 439

'report' mode of v.category ignores 'layer' parameter. By default all
available layers are reported, in your case the map contains only one
layer.

Martin

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

#377: gis.m/Map Display fails to handle vector layers with multiple databse
layers
---------------------+------------------------------------------------------
  Reporter: ploewe | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.4.0
Component: Vector | Version: svn-develbranch6
Resolution: | Keywords: gis.m database query
  Platform: All | Cpu: OSX/Intel
---------------------+------------------------------------------------------
Changes (by cmbarton):

  * platform: Linux => All
  * version: 6.3.0 => svn-develbranch6
  * component: Tcl => Vector
  * cpu: x86-32 => OSX/Intel

Comment:

This appears to be a bug in d.vect, not in the TclTk gui. I just tried
this out in the GRASS 6.4 development version from the SVN.

From the command line in an xmon...

GRASS 6.4.svn (Spearfish60_test):~ > d.vect map=archsites@PERMANENT
color=0:0:0 lcolor=0:0:0 fcolor=170:170:170 display=shape
type=point,line,boundary,area icon=basic/circle size=5 layer=1 lsize=8
xref=left yref=center llayer=2 cat=1-10

This displays sites with cats 1-10

GRASS 6.4.svn (Spearfish60_test):~ > d.erase
GRASS 6.4.svn (Spearfish60_test):~ > d.vect map=archsites@PERMANENT
color=0:0:0 lcolor=0:0:0 fcolor=170:170:170 display=shape
type=point,line,boundary,area icon=basic/circle size=5 layer=2 lsize=8
xref=left yref=center llayer=2 cat=1-10

This displays nothing

The labeling is worse. I can get labels from layer 1 in the GUI, but from
the command line to an xmon, I get...

The process has forked and you cannot use this CoreFoundation
functionality safely. You MUST exec().
Break on
__THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__()
to debug.
ERROR eof from graphics driver.

Trying to get labels from layer 2 gives me nothing.

I'm trying this with Spearfish, archsites (I've added columns), and the
dbf driver. I'm using a Mac OSX 10.5.5. But this seems to be a cross-
platform problem.

Michael

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/377#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#377: gis.m/Map Display fails to handle vector layers with multiple databse
layers
---------------------+------------------------------------------------------
  Reporter: ploewe | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.4.0
Component: Vector | Version: svn-develbranch6
Resolution: | Keywords: gis.m database query
  Platform: All | Cpu: OSX/Intel
---------------------+------------------------------------------------------
Comment (by martinl):

Replying to [comment:2 cmbarton]:
{{{
> GRASS 6.4.svn (Spearfish60_test):~ > d.vect map=archsites@PERMANENT
color=0:0:0 lcolor=0:0:0 fcolor=170:170:170 display=shape
type=point,line,boundary,area icon=basic/circle size=5 layer=1 lsize=8
xref=left yref=center llayer=2 cat=1-10
}}}
> This displays sites with cats 1-10

{{{
> GRASS 6.4.svn (Spearfish60_test):~ > d.erase
> GRASS 6.4.svn (Spearfish60_test):~ > d.vect map=archsites@PERMANENT
color=0:0:0 lcolor=0:0:0 fcolor=170:170:170 display=shape
type=point,line,boundary,area icon=basic/circle size=5 layer=2 lsize=8
xref=left yref=center llayer=2 cat=1-10
}}}

> This displays nothing

well, and archsites@PERMANENT contains some elements in layer 2?

{{{
v.category archsites@PERMANENT opt=report
}}}

?

Martin

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/377#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

On Dec 26, 2008, at 9:59 AM, GRASS GIS wrote:

#377: gis.m/Map Display fails to handle vector layers with multiple databse
layers
---------------------+------------------------------------------------------
Reporter: ploewe | Owner: grass-dev@lists.osgeo.org
     Type: defect | Status: new
Priority: major | Milestone: 6.4.0
Component: Vector | Version: svn-develbranch6
Resolution: | Keywords: gis.m database query
Platform: All | Cpu: OSX/Intel
---------------------+------------------------------------------------------
Comment (by martinl):

Replying to [comment:2 cmbarton]:
{{{

GRASS 6.4.svn (Spearfish60_test):~ > d.vect map=archsites@PERMANENT

color=0:0:0 lcolor=0:0:0 fcolor=170:170:170 display=shape
type=point,line,boundary,area icon=basic/circle size=5 layer=1 lsize=8
xref=left yref=center llayer=2 cat=1-10
}}}

This displays sites with cats 1-10

{{{

GRASS 6.4.svn (Spearfish60_test):~ > d.erase
GRASS 6.4.svn (Spearfish60_test):~ > d.vect map=archsites@PERMANENT

color=0:0:0 lcolor=0:0:0 fcolor=170:170:170 display=shape
type=point,line,boundary,area icon=basic/circle size=5 layer=2 lsize=8
xref=left yref=center llayer=2 cat=1-10
}}}

This displays nothing

well, and archsites@PERMANENT contains some elements in layer 2?

{{{
v.category archsites@PERMANENT opt=report
}}}

?

Yes. I essentially duplicated the dbf for layer 1 and connected the new dbf as layer 2, so I know it should be OK.

Michael

On Fri, December 26, 2008 18:17, Michael Barton wrote:

On Dec 26, 2008, at 9:59 AM, GRASS GIS wrote:

[...]

well, and archsites@PERMANENT contains some elements in layer 2?

{{{
v.category archsites@PERMANENT opt=report
}}}

?

Yes. I essentially duplicated the dbf for layer 1 and connected the
new dbf as layer 2, so I know it should be OK.

Duplicating the dbf and connecting it (with v.db.connect) to another
layer, does not create any features on that layer. To do that, you have to
assign category values to features in that layer, with either v.category
or v.digit.

I think there is still a need to a much clearer and more detailed tutorial
on layer handling, as this keeps popping up...

Moritz

On Dec 28, 2008, at 7:14 AM, Moritz Lennert wrote:

On Fri, December 26, 2008 18:17, Michael Barton wrote:

On Dec 26, 2008, at 9:59 AM, GRASS GIS wrote:

[...]

well, and archsites@PERMANENT contains some elements in layer 2?

{{{
v.category archsites@PERMANENT opt=report
}}}

?

Yes. I essentially duplicated the dbf for layer 1 and connected the
new dbf as layer 2, so I know it should be OK.

Duplicating the dbf and connecting it (with v.db.connect) to another
layer, does not create any features on that layer. To do that, you have to
assign category values to features in that layer, with either v.category
or v.digit.

I think there is still a need to a much clearer and more detailed tutorial
on layer handling, as this keeps popping up...

Moritz

You're right. I forgot to do this step.

Michael

#377: gis.m/Map Display fails to handle vector layers with multiple databse
layers
---------------------+------------------------------------------------------
  Reporter: ploewe | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.4.0
Component: Vector | Version: svn-develbranch6
Resolution: | Keywords: gis.m database query
  Platform: All | Cpu: OSX/Intel
---------------------+------------------------------------------------------
Comment (by neteler):

Replying to [comment:2 cmbarton]:
> The labeling is worse. I can get labels from layer 1 in the GUI, but
from the command line to an xmon, I get...
>
> The process has forked and you cannot use this CoreFoundation
functionality safely. You MUST exec().
> Break on
__THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__()
to debug.
> ERROR eof from graphics driver.

See
http://lists.osgeo.org/pipermail/grass-user/2009-April/050038.html

and

http://developer.apple.com/mac/library/technotes/tn2005/tn2083.html#SECDAEMONVSFRAMEWORKS

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/377#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#377: gis.m/Map Display fails to handle vector layers with multiple databse
layers
----------------------------------+-----------------------------------------
Reporter: ploewe | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.0
Component: Vector | Version: svn-develbranch6
Keywords: gis.m database query | Platform: All
      Cpu: OSX/Intel |
----------------------------------+-----------------------------------------

Comment(by kyngchaos):

I think the database problem ultimately boils down to displaying text with
FreeType, as Michael found.

The error means what it says. It comes from FreeType when the old-mac-
fonts options is enabled, and there is nothing that FreeType can do to
"fix" it, because old-mac-fonts means it needs to use Core Foundation.
The real solution is that programmers using FreeType on OS X 10.5 need to
do as the error suggests, exec() after fork(). This forum topic at Apple
describes it concisely:

http://discussions.apple.com/message.jspa?messageID=7875639

The quick solution is to build FreeType without old-mac-fonts. But there
are many with an investment in old Resource-fork based fonts (mainly
PostScript) and this is not a good solution ($$ to upgrade to OTF).

The problem doesn't seem to occur in OS X 10.6. I don't know why. Maybe
Apple saw that so many had problems with this and reverted, or at least
dropped the error (they probably still recommend fork + exec).

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/377#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

#377: gis.m/Map Display fails to handle vector layers with multiple databse
layers
----------------------------------+-----------------------------------------
Reporter: ploewe | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.0
Component: Vector | Version: svn-develbranch6
Keywords: gis.m database query | Platform: All
      Cpu: OSX/Intel |
----------------------------------+-----------------------------------------

Comment(by mlennert):

I think the FreeType issue is a different issue than that reported by the
OP.

Concerning this original problem, we still do not have any information of
whether the maps displayed actually had any category values in layer 2 (as
Martin pointed out: archsites in spearfish does not have any info on layer
2). And in the case of the OP, just because one connects a map with
v.db.connect on another layer, this does not mean that the map actually
has any info on that layer.

The following works for me

{{{
v.category archsites option=add layer=2 output=myarchsites
d.vect map=myarchsites@user1 color=0:0:0 lcolor=0:0:0 fcolor=170:170:170
display=shape type=point,line,boundary,area icon=basic/circle size=5
layer=2 lsize=8 xref=left yref=center llayer=1
d.vect map=myarchsites@user1 color=0:0:0 lcolor=0:0:0 fcolor=170:170:170
display=shape type=point,line,boundary,area icon=basic/circle size=5
layer=2 lsize=8 xref=left yref=center llayer=1 cat=1-10
}}}

In my eyes this bug can be closed as worksforme, and if there is an issue
with FreeType on Mac, please open another bug.

Moritz

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/377#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>

#377: gis.m/Map Display fails to handle vector layers with multiple databse
layers
----------------------------------+-----------------------------------------
Reporter: ploewe | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.0
Component: Vector | Version: svn-develbranch6
Keywords: gis.m database query | Platform: All
      Cpu: OSX/Intel |
----------------------------------+-----------------------------------------

Comment(by cmbarton):

Hi,

For the record, when I verified the layer problem, I used a special
version of archsites that I'd modified for testing and teaching. It does
have information in layer 2.

Michael

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/377#comment:7&gt;
GRASS GIS <http://grass.osgeo.org>

#377: gis.m/Map Display fails to handle vector layers with multiple databse
layers
----------------------------------+-----------------------------------------
Reporter: ploewe | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.0
Component: Vector | Version: svn-develbranch6
Keywords: gis.m database query | Platform: All
      Cpu: OSX/Intel |
----------------------------------+-----------------------------------------

Comment(by mlennert):

Replying to [comment:7 cmbarton]:
> Hi,
>
> For the record, when I verified the layer problem, I used a special
version of archsites that I'd modified for testing and teaching. It does
have information in layer 2.
>

Ok. Can you still reproduce the issue, i.e. by following my steps above ?

When you said
>d.vect map=archsites@PERMANENT color=0:0:0 lcolor=0:0:0
fcolor=170:170:170 display=shape >type=point,line,boundary,area
icon=basic/circle size=5 layer=2 lsize=8 xref=left yref=center >llayer=2
cat=1-10
>
>This displays nothing

the first thing I would test is v.category archsites@PERMANENT
option=report, just to make sure that there are cat values 1-10 on that
layer. Just to be sure we agree: the above line should only show the
circles, nothing else, or ?

Moritz

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/377#comment:8&gt;
GRASS GIS <http://grass.osgeo.org>

#377: gis.m/Map Display fails to handle vector layers with multiple databse
layers
-------------------------+--------------------------------------------------
  Reporter: ploewe | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: major | Milestone: 6.4.0
Component: Vector | Version: svn-develbranch6
Resolution: worksforme | Keywords: gis.m database query
  Platform: All | Cpu: OSX/Intel
-------------------------+--------------------------------------------------
Changes (by marisn):

  * status: new => closed
  * resolution: => worksforme

Comment:

Tested with current 6.4.3 SVN. All features are rendered correctly
according to their levels.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/377#comment:9&gt;
GRASS GIS <http://grass.osgeo.org>