[GRASS-user] Multiple to one question

I am trying to set up a new project in Grass, and I have a question about the best approach.
I have different vector locations, and at each one there were multiple samples taken. At the moment I have each sample as a row in a data base.
My question is how best to put this data into a set of vector points.
I believe that I can do it in either of two ways (of not others).
1) I can create a vector point at each location, then I think that I can have multiple cats for that object. So I think I can do cat=1,3,6 for a given location.
Will that work OK?
2) I can just create different vector objects, that happen to be at the identical location, and have each one point to a different cat.

If the above is not clear, here is a bit more detailed example.
At location A there was a sample collected on 1/1 with a value of 2.1, on 2/2 with a value of 2.2 and on 3/3 with a value of 3.3

The above data is already 3 rows in a database.

I want to be able to display data about point A (say, average value or things like that). Should I just create a vector point A and then do cat=1,2,3 or should I create 3 different vector points at A, each one having a different cat?

Any guidance about the benefits or limitations each approach (or any other approach to consider) would be greatly appreciated.

Thanks,

--Adam

Hello Adam,

maybe another solution in this case would be a set of 2 tables :
* one linking to the geometry, that is containing nothing but cat
values,
* another one, containing a cat column (related to the "geometric"
table) and different data columns corresponding to your sampling.

Does this help ?
VB

Le lundi 13 avril 2009 à 14:23 -0700, Adam Dershowitz a écrit :

I am trying to set up a new project in Grass, and I have a question
about the best approach.
I have different vector locations, and at each one there were multiple
samples taken. At the moment I have each sample as a row in a data
base.
My question is how best to put this data into a set of vector points.
I believe that I can do it in either of two ways (of not others).
1) I can create a vector point at each location, then I think that I
can have multiple cats for that object. So I think I can do cat=1,3,6
for a given location.
Will that work OK?
2) I can just create different vector objects, that happen to be at
the identical location, and have each one point to a different cat.

If the above is not clear, here is a bit more detailed example.
At location A there was a sample collected on 1/1 with a value of 2.1,
on 2/2 with a value of 2.2 and on 3/3 with a value of 3.3

The above data is already 3 rows in a database.

I want to be able to display data about point A (say, average value or
things like that). Should I just create a vector point A and then do
cat=1,2,3 or should I create 3 different vector points at A, each one
having a different cat?

Any guidance about the benefits or limitations each approach (or any
other approach to consider) would be greatly appreciated.

Thanks,

--Adam

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

On 14/04/09 08:37, Vincent Bain wrote:

Hello Adam,

maybe another solution in this case would be a set of 2 tables :
* one linking to the geometry, that is containing nothing but cat
values,
* another one, containing a cat column (related to the "geometric"
table) and different data columns corresponding to your sampling.

I think that if all you want is calculate some means or similar across dates and then display the results, Vincent's solution is the easiest.

But you could also use layers [1]:

layer 1 = January round of sampling
layer 2 = February round of sampling
etc.

You would have to give each point a category value in each layer (cf v.category) and then either create separate tables for each period linking each to one of the layers or at least create some obvious cat values (i.e. 100s for January, 200s for February, etc) and link on single table to all the layers, but with different cat values in each layer.

Moritz

[1] See "Vector object categories and attribute management" on http://grass.osgeo.org/grass64/manuals/html64_user/vectorintro.html for a quick introduction

Does this help ?
VB

Le lundi 13 avril 2009 à 14:23 -0700, Adam Dershowitz a écrit :

I am trying to set up a new project in Grass, and I have a question about the best approach.
I have different vector locations, and at each one there were multiple samples taken. At the moment I have each sample as a row in a data base.
My question is how best to put this data into a set of vector points.
I believe that I can do it in either of two ways (of not others).
1) I can create a vector point at each location, then I think that I can have multiple cats for that object. So I think I can do cat=1,3,6 for a given location.
Will that work OK?
2) I can just create different vector objects, that happen to be at the identical location, and have each one point to a different cat.

If the above is not clear, here is a bit more detailed example.
At location A there was a sample collected on 1/1 with a value of 2.1, on 2/2 with a value of 2.2 and on 3/3 with a value of 3.3

The above data is already 3 rows in a database.

I want to be able to display data about point A (say, average value or things like that). Should I just create a vector point A and then do cat=1,2,3 or should I create 3 different vector points at A, each one having a different cat?

Any guidance about the benefits or limitations each approach (or any other approach to consider) would be greatly appreciated.

Thanks,

--Adam

_______________________________________________
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

On Apr 14, 2009, at 4:06 AM, Moritz Lennert wrote:

On 14/04/09 08:37, Vincent Bain wrote:

Hello Adam,
maybe another solution in this case would be a set of 2 tables :
* one linking to the geometry, that is containing nothing but cat
values,
* another one, containing a cat column (related to the "geometric"
table) and different data columns corresponding to your sampling.

I think that if all you want is calculate some means or similar across dates and then display the results, Vincent's solution is the easiest.

But you could also use layers [1]:

layer 1 = January round of sampling
layer 2 = February round of sampling
etc.

You would have to give each point a category value in each layer (cf v.category) and then either create separate tables for each period linking each to one of the layers or at least create some obvious cat values (i.e. 100s for January, 200s for February, etc) and link on single table to all the layers, but with different cat values in each layer.

Moritz

[1] See "Vector object categories and attribute management" on http://grass.osgeo.org/grass64/manuals/html64_user/vectorintro.html for a quick introduction

Thanks,

But, the problem with both of these approaches, columns, and layers, (Vincent or Moritz version) is that I don't have consistent times for each site. So, at site A I might have 5 samples, once a month and at site B I have 2 samples, one each year, and site C I have a few spread over a few years.
So both of those approaches essentially need to have a column, or layer, for each possible time of sampling. But that is not really appropriate for the quasi-random times of the samples.

Does this help ?
VB
Le lundi 13 avril 2009 à 14:23 -0700, Adam Dershowitz a écrit :

I am trying to set up a new project in Grass, and I have a question about the best approach.
I have different vector locations, and at each one there were multiple samples taken. At the moment I have each sample as a row in a data base.
My question is how best to put this data into a set of vector points.
I believe that I can do it in either of two ways (of not others).
1) I can create a vector point at each location, then I think that I can have multiple cats for that object. So I think I can do cat=1,3,6 for a given location.
Will that work OK?
2) I can just create different vector objects, that happen to be at the identical location, and have each one point to a different cat.

If the above is not clear, here is a bit more detailed example.
At location A there was a sample collected on 1/1 with a value of 2.1, on 2/2 with a value of 2.2 and on 3/3 with a value of 3.3

The above data is already 3 rows in a database.

I want to be able to display data about point A (say, average value or things like that). Should I just create a vector point A and then do cat=1,2,3 or should I create 3 different vector points at A, each one having a different cat?

Any guidance about the benefits or limitations each approach (or any other approach to consider) would be greatly appreciated.

Thanks,

--Adam

_______________________________________________
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

Hmmm, not sure you understood what I suggested (or maybe I did not catch
your point of view !). Let's consider you add two measures a week for
point A (cat=1), and 1 measure monthly for point B (cat=2), then after
one year you have :
* in table1 (cat integer):
2 recors (cat=1 and cat=2)

* in table2 (cat integer, mes float):
116 records (104 records with cat=1 and 12 records with cat=2).

Where is there a problem for you ?
Hope this helps,

VB

Le mardi 14 avril 2009 à 09:38 -0700, Adam Dershowitz, Ph.D., P.E. a
écrit :

On Apr 14, 2009, at 4:06 AM, Moritz Lennert wrote:

> On 14/04/09 08:37, Vincent Bain wrote:
>> Hello Adam,
>> maybe another solution in this case would be a set of 2 tables :
>> * one linking to the geometry, that is containing nothing but cat
>> values,
>> * another one, containing a cat column (related to the "geometric"
>> table) and different data columns corresponding to your sampling.
>
> I think that if all you want is calculate some means or similar
> across dates and then display the results, Vincent's solution is the
> easiest.
>
> But you could also use layers [1]:
>
> layer 1 = January round of sampling
> layer 2 = February round of sampling
> etc.
>
> You would have to give each point a category value in each layer (cf
> v.category) and then either create separate tables for each period
> linking each to one of the layers or at least create some obvious
> cat values (i.e. 100s for January, 200s for February, etc) and link
> on single table to all the layers, but with different cat values in
> each layer.
>
>
> Moritz
>
> [1] See "Vector object categories and attribute management" on http://grass.osgeo.org/grass64/manuals/html64_user/vectorintro.html
> for a quick introduction

Thanks,

But, the problem with both of these approaches, columns, and layers,
(Vincent or Moritz version) is that I don't have consistent times for
each site. So, at site A I might have 5 samples, once a month and at
site B I have 2 samples, one each year, and site C I have a few spread
over a few years.
So both of those approaches essentially need to have a column, or
layer, for each possible time of sampling. But that is not really
appropriate for the quasi-random times of the samples.

>
>
>> Does this help ?
>> VB
>> Le lundi 13 avril 2009 à 14:23 -0700, Adam Dershowitz a écrit :
>>> I am trying to set up a new project in Grass, and I have a
>>> question about the best approach.
>>> I have different vector locations, and at each one there were
>>> multiple samples taken. At the moment I have each sample as a
>>> row in a data base.
>>> My question is how best to put this data into a set of vector
>>> points.
>>> I believe that I can do it in either of two ways (of not others).
>>> 1) I can create a vector point at each location, then I think
>>> that I can have multiple cats for that object. So I think I can
>>> do cat=1,3,6 for a given location.
>>> Will that work OK?
>>> 2) I can just create different vector objects, that happen to be
>>> at the identical location, and have each one point to a different
>>> cat.
>>>
>>> If the above is not clear, here is a bit more detailed example.
>>> At location A there was a sample collected on 1/1 with a value of
>>> 2.1, on 2/2 with a value of 2.2 and on 3/3 with a value of 3.3
>>>
>>> The above data is already 3 rows in a database.
>>>
>>> I want to be able to display data about point A (say, average
>>> value or things like that). Should I just create a vector point
>>> A and then do cat=1,2,3 or should I create 3 different vector
>>> points at A, each one having a different cat?
>>>
>>> Any guidance about the benefits or limitations each approach (or
>>> any other approach to consider) would be greatly appreciated.
>>>
>>> Thanks,
>>>
>>> --Adam
>>>
>>>
>>>
>>> _______________________________________________
>>> 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
>

On Apr 14, 2009, at 9:51 AM, Vincent Bain wrote:

Hmmm, not sure you understood what I suggested (or maybe I did not catch
your point of view !). Let's consider you add two measures a week for
point A (cat=1), and 1 measure monthly for point B (cat=2), then after
one year you have :
* in table1 (cat integer):
2 recors (cat=1 and cat=2)

* in table2 (cat integer, mes float):
116 records (104 records with cat=1 and 12 records with cat=2).

Thank you. I didn't understand before (I thought that you meant a column for each measurement date). But this does explain it, and it makes a lot of sense.

--Adam

Where is there a problem for you ?
Hope this helps,

VB

Le mardi 14 avril 2009 à 09:38 -0700, Adam Dershowitz, Ph.D., P.E. a
écrit :

On Apr 14, 2009, at 4:06 AM, Moritz Lennert wrote:

On 14/04/09 08:37, Vincent Bain wrote:

Hello Adam,
maybe another solution in this case would be a set of 2 tables :
* one linking to the geometry, that is containing nothing but cat
values,
* another one, containing a cat column (related to the "geometric"
table) and different data columns corresponding to your sampling.

I think that if all you want is calculate some means or similar
across dates and then display the results, Vincent's solution is the
easiest.

But you could also use layers [1]:

layer 1 = January round of sampling
layer 2 = February round of sampling
etc.

You would have to give each point a category value in each layer (cf
v.category) and then either create separate tables for each period
linking each to one of the layers or at least create some obvious
cat values (i.e. 100s for January, 200s for February, etc) and link
on single table to all the layers, but with different cat values in
each layer.

Moritz

[1] See "Vector object categories and attribute management" on http://grass.osgeo.org/grass64/manuals/html64_user/vectorintro.html
for a quick introduction

Thanks,

But, the problem with both of these approaches, columns, and layers,
(Vincent or Moritz version) is that I don't have consistent times for
each site. So, at site A I might have 5 samples, once a month and at
site B I have 2 samples, one each year, and site C I have a few spread
over a few years.
So both of those approaches essentially need to have a column, or
layer, for each possible time of sampling. But that is not really
appropriate for the quasi-random times of the samples.

Does this help ?
VB
Le lundi 13 avril 2009 à 14:23 -0700, Adam Dershowitz a écrit :

I am trying to set up a new project in Grass, and I have a
question about the best approach.
I have different vector locations, and at each one there were
multiple samples taken. At the moment I have each sample as a
row in a data base.
My question is how best to put this data into a set of vector
points.
I believe that I can do it in either of two ways (of not others).
1) I can create a vector point at each location, then I think
that I can have multiple cats for that object. So I think I can
do cat=1,3,6 for a given location.
Will that work OK?
2) I can just create different vector objects, that happen to be
at the identical location, and have each one point to a different
cat.

If the above is not clear, here is a bit more detailed example.
At location A there was a sample collected on 1/1 with a value of
2.1, on 2/2 with a value of 2.2 and on 3/3 with a value of 3.3

The above data is already 3 rows in a database.

I want to be able to display data about point A (say, average
value or things like that). Should I just create a vector point
A and then do cat=1,2,3 or should I create 3 different vector
points at A, each one having a different cat?

Any guidance about the benefits or limitations each approach (or
any other approach to consider) would be greatly appreciated.

Thanks,

--Adam

_______________________________________________
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

This is somewhat a followup to my prior post and somewhat a new, but related problem.

I ended up doing what I had proposed, which is I have a table that has each sample value and location:

Location Value cat
a 3.1 1
b 2.1 2
a 1.1 3
c 4.1 4

etc.

Then I have linked each vector point to multiple categories by using
v.edit map=foo layer=1 where="cat==1" type=point tool=catadd cat=3 (for example) So then I have an vector point that has a cat of both 1 and 3. So far so good.
If I then try to display Label vectors using Value for the attribute, it works fine. Each value is displayed separated by a slash "/".

The problem is if I try to use a SQL query, it is not working as expected. I think that what it is doing is just applying the test to the first value, then showing or hiding the other values based on that first test (although I am not 100% sure that is what it is doing).
So, for example, if I were to do Use SQL query: Value > 2.0 it would draw a label like this: 3.1/1.1 And if I were to use a query of Value < 2.0 it would not display anything. What I want it to do is to show all values that are actually greater than 2. and not to display the others.

Any suggestions of what it is doing, or what I can do about it?

I am using 6.4 RC3 on a Mac, and using sqlite for my db.
If I connect to the db just using the command line to connect to sqlite, then the query works as expected.

As a secondary question, is it possible to change the "/" separator that is used in the labels? Where is that determined? Can I instead make it "/n" and get each value below?

Thanks,

--Adam

On 16/04/09 01:00, Adam Dershowitz, Ph.D., P.E. wrote:

This is somewhat a followup to my prior post and somewhat a new, but related problem.

I ended up doing what I had proposed, which is I have a table that has each sample value and location:

Location Value cat
a 3.1 1
b 2.1 2
a 1.1 3
c 4.1 4

etc.

Then I have linked each vector point to multiple categories by using
v.edit map=foo layer=1 where="cat==1" type=point tool=catadd cat=3 (for example) So then I have an vector point that has a cat of both 1 and 3. So far so good.
If I then try to display Label vectors using Value for the attribute, it works fine. Each value is displayed separated by a slash "/".

The problem is if I try to use a SQL query, it is not working as expected. I think that what it is doing is just applying the test to the first value, then showing or hiding the other values based on that first test (although I am not 100% sure that is what it is doing).
So, for example, if I were to do Use SQL query: Value > 2.0 it would draw a label like this: 3.1/1.1 And if I were to use a query of Value < 2.0 it would not display anything. What I want it to do is to show all values that are actually greater than 2. and not to display the others.

Any suggestions of what it is doing, or what I can do about it?

Create a view in your database containing the results of your query, including cat values, and link your map to that view, instead of the table. If you want to change the content, just drop the view and recreate it with a different query. You can do all this either directly in sqlite, or via the db.execute GRASS module.

Moritz

On Apr 15, 2009, at 4:29 PM, Moritz Lennert wrote:

On 16/04/09 01:00, Adam Dershowitz, Ph.D., P.E. wrote:

This is somewhat a followup to my prior post and somewhat a new, but related problem.
I ended up doing what I had proposed, which is I have a table that has each sample value and location:
Location Value cat
a 3.1 1
b 2.1 2
a 1.1 3
c 4.1 4
etc.
Then I have linked each vector point to multiple categories by using
v.edit map=foo layer=1 where="cat==1" type=point tool=catadd cat=3 (for example) So then I have an vector point that has a cat of both 1 and 3. So far so good.
If I then try to display Label vectors using Value for the attribute, it works fine. Each value is displayed separated by a slash "/".
The problem is if I try to use a SQL query, it is not working as expected. I think that what it is doing is just applying the test to the first value, then showing or hiding the other values based on that first test (although I am not 100% sure that is what it is doing).
So, for example, if I were to do Use SQL query: Value > 2.0 it would draw a label like this: 3.1/1.1 And if I were to use a query of Value < 2.0 it would not display anything. What I want it to do is to show all values that are actually greater than 2. and not to display the others.
Any suggestions of what it is doing, or what I can do about it?

Create a view in your database containing the results of your query, including cat values, and link your map to that view, instead of the table. If you want to change the content, just drop the view and recreate it with a different query. You can do all this either directly in sqlite, or via the db.execute GRASS module.

Moritz

I really liked the suggestion, so I tried it....but it doesn't work.
To continue my simple example, I did create view less2 cat,Value from data where Value < 2;
So I end up with a view, as expected.
The problem is that if I now link my map to that view, I get an error: No attribute found for cat 1 (since the object still tries to link to 1). And, the same for 2 and 4. And, I still see the points and slashes (ie it still draws point a and puts a null value then a slash then 1.1.
So is there a way to have it not draw a symbol and not draw "null text" when it can't find an attribute? Since, the whole point of what I am trying to do in this case is to eliminate certain data with a query?

Thanks,

--Adam

--Adam

On Apr 15, 2009, at 9:29 PM, Adam Dershowitz, Ph.D., P.E. wrote:

On Apr 15, 2009, at 4:29 PM, Moritz Lennert wrote:

On 16/04/09 01:00, Adam Dershowitz, Ph.D., P.E. wrote:

This is somewhat a followup to my prior post and somewhat a new, but related problem.
I ended up doing what I had proposed, which is I have a table that has each sample value and location:
Location Value cat
a 3.1 1
b 2.1 2
a 1.1 3
c 4.1 4
etc.
Then I have linked each vector point to multiple categories by using
v.edit map=foo layer=1 where="cat==1" type=point tool=catadd cat=3 (for example) So then I have an vector point that has a cat of both 1 and 3. So far so good.
If I then try to display Label vectors using Value for the attribute, it works fine. Each value is displayed separated by a slash "/".
The problem is if I try to use a SQL query, it is not working as expected. I think that what it is doing is just applying the test to the first value, then showing or hiding the other values based on that first test (although I am not 100% sure that is what it is doing).
So, for example, if I were to do Use SQL query: Value > 2.0 it would draw a label like this: 3.1/1.1 And if I were to use a query of Value < 2.0 it would not display anything. What I want it to do is to show all values that are actually greater than 2. and not to display the others.
Any suggestions of what it is doing, or what I can do about it?

Create a view in your database containing the results of your query, including cat values, and link your map to that view, instead of the table. If you want to change the content, just drop the view and recreate it with a different query. You can do all this either directly in sqlite, or via the db.execute GRASS module.

Moritz

I really liked the suggestion, so I tried it....but it doesn't work.
To continue my simple example, I did create view less2 cat,Value from data where Value < 2;
So I end up with a view, as expected.
The problem is that if I now link my map to that view, I get an error: No attribute found for cat 1 (since the object still tries to link to 1). And, the same for 2 and 4. And, I still see the points and slashes (ie it still draws point a and puts a null value then a slash then 1.1.
So is there a way to have it not draw a symbol and not draw "null text" when it can't find an attribute? Since, the whole point of what I am trying to do in this case is to eliminate certain data with a query?

It seems like I should be able to edit the cats, and I tried a few different things with v.edit, but I have not had any luck. I tried some things like this:
v.edit map=foo tool=catdel -r where="cat > 0"
but it gives me:
ERROR: Tool catdel requires option cats
Although the above seems to work with tool=select, which I was using to test things about before doing the delete.

I copied my original vectors, and created the view. Now what I want to do is to delete all the categories in this vector that point to null. Is there a way to do that?

Thanks,

--Adam

On 16/04/09 06:29, Adam Dershowitz, Ph.D., P.E. wrote:

I really liked the suggestion, so I tried it....but it doesn't work. To continue my simple example, I did create view less2 cat,Value
from data where Value < 2; So I end up with a view, as expected. The
problem is that if I now link my map to that view, I get an error: No
attribute found for cat 1 (since the object still tries to link to 1). And, the same for 2 and 4. And, I still see the points and
slashes (ie it still draws point a and puts a null value then a slash
then 1.1. So is there a way to have it not draw a symbol and not draw
"null text" when it can't find an attribute? Since, the whole point
of what I am trying to do in this case is to eliminate certain data
with a query?

What do you mean by "eliminate" ?

Maybe you should be more precise about your objectives. Are you trying to display something on a map, or not ? If all your looking for is tables, than you don't need GRASS at all.

On 16/04/09 07:35, Adam Dershowitz, Ph.D., P.E. wrote:
  > It seems like I should be able to edit the cats, and I tried a few

different things with v.edit, but I have not had any luck. I tried
some things like this: v.edit map=foo tool=catdel -r where="cat > 0" but it gives me: ERROR: Tool catdel requires option cats Although the
above seems to work with tool=select, which I was using to test
things about before doing the delete.

As the message says, tool catdel does not work with a select, but you have to give it a list of cats. You can do that with something like this:

v.edit map=foo tool=catdel cats=`v.db.select -c foo col=cat where=XYZ | awk '{printf"%i,",$1} END{print}'`
(note the back ticks)

I copied my original vectors, and created the view. Now what I want
to do is to delete all the categories in this vector that point to
null. Is there a way to do that?

Why do you want to do that ? If I understood you correctly, all of these cats have a meaning. Maybe not in the currently linked view, but in the original table. So if you delete these cats, you will lose the link to the values in the original table.

Again, I think we need a better explanation of what it is you are trying to get at.

Moritz

On Apr 16, 2009, at 3:02 AM, Moritz Lennert wrote:

On 16/04/09 06:29, Adam Dershowitz, Ph.D., P.E. wrote:

I really liked the suggestion, so I tried it....but it doesn't work. To continue my simple example, I did create view less2 cat,Value
from data where Value < 2; So I end up with a view, as expected. The
problem is that if I now link my map to that view, I get an error: No
attribute found for cat 1 (since the object still tries to link to 1). And, the same for 2 and 4. And, I still see the points and
slashes (ie it still draws point a and puts a null value then a slash
then 1.1. So is there a way to have it not draw a symbol and not draw
"null text" when it can't find an attribute? Since, the whole point
of what I am trying to do in this case is to eliminate certain data
with a query?

What do you mean by "eliminate" ?

Maybe you should be more precise about your objectives. Are you trying to display something on a map, or not ? If all your looking for is tables, than you don't need GRASS at all.

Hmmm, I guess I was not that clear. Sorry, and thanks for your help and patients.

What I mean is that I have a map that has a bunch of sites on it, and values shown next to each site as a label. In many cases there are multiple values shown.

What I want to do is draw a second map, where I only show sites where the value is greater then a certain threshold. In other words, my first map has all values shown. My second map should just show sites where value is, for example, greater than 2.0 (or whatever).

So what I ended up doing was copying my original map, and then linking my new map to a view of the original data. But that didn't work because then all the sites that are below the threshold (and therefor are not in the view) don't have a correct value or cat, but the icons are still shown, and when there were multiple values in the original a slash is still drawn, since it seems that it is using a "null" value for the labels.

On 16/04/09 07:35, Adam Dershowitz, Ph.D., P.E. wrote:
> It seems like I should be able to edit the cats, and I tried a few

different things with v.edit, but I have not had any luck. I tried
some things like this: v.edit map=foo tool=catdel -r where="cat > 0" but it gives me: ERROR: Tool catdel requires option cats Although the
above seems to work with tool=select, which I was using to test
things about before doing the delete.

As the message says, tool catdel does not work with a select, but you have to give it a list of cats. You can do that with something like this:

v.edit map=foo tool=catdel cats=`v.db.select -c foo col=cat where=XYZ | awk '{printf"%i,",$1} END{print}'`
(note the back ticks)

I ended up doing something pretty similar to this last night, although I ended up using environmental variables to store the select results. And it accomplished half of what I need. The problem is that all sites are still shown, even if they no no longer have any values, in the cases where the edit has eliminated all of them. So if a vector point had a value of 1.0, it is still drawn.

If I follow the above with:
v.edit map=foo tool=delete -r where="cat > 0" then it also eliminates the sites that no longer have any categories. So I guess I have things working, but it feels like a kluge, and there should be a cleaner solution.

I copied my original vectors, and created the view. Now what I want
to do is to delete all the categories in this vector that point to
null. Is there a way to do that?

Why do you want to do that ? If I understood you correctly, all of these cats have a meaning. Maybe not in the currently linked view, but in the original table. So if you delete these cats, you will lose the link to the values in the original table.

Again, I think we need a better explanation of what it is you are trying to get at.

Moritz

Here is a bigger picture explanation.

A bunch of samples were taken at different locations and different times. I want to be able to generate a few different maps:
1) Show all sampling locations (that one is easy and already done).
2) Show all sample locations, and values, where value is > 2.0, for example. In other words, if the value at a location is below 2.0 then don't display the value, and if all the values at that location are below 2.0 don't even display the icon for the location.
Essentially what I am trying to do is to put a red dot where ever the I had a measurement above 2.0, and also list those values by the red dot.

So far I have not been able to get the above using views and linking to those views, because GRASS still "knows" about the points that are below 2.0 and tries to display them even if they are not in the view and treats them as null values, rather then as values to be ignored.

So far the solution that seems to work is:
1) Create my master map showing all locations and values.
2) Make a copy map that I will then edit.
3) In my copy map use what you had above, v.edit tool=catdel etc., to delete the categories that don't meet a query.
4) Delete any points from my copy that now don't have any cat remaining using v.edit map=foo tool=delete -r where="cat > 0"

So, I think that the above does accomplish what I need. But it was pretty round-about to get it figured out and working. I figured that there would be an easier way to do a query and just show sites and values that are returned by the query.

--Adam

On 16/04/09 18:57, Adam Dershowitz, Ph.D., P.E. wrote:

On Apr 16, 2009, at 3:02 AM, Moritz Lennert wrote:

On 16/04/09 06:29, Adam Dershowitz, Ph.D., P.E. wrote:

I really liked the suggestion, so I tried it....but it doesn't work. To continue my simple example, I did create view less2 cat,Value
from data where Value < 2; So I end up with a view, as expected. The
problem is that if I now link my map to that view, I get an error: No
attribute found for cat 1 (since the object still tries to link to 1). And, the same for 2 and 4. And, I still see the points and
slashes (ie it still draws point a and puts a null value then a slash
then 1.1. So is there a way to have it not draw a symbol and not draw
"null text" when it can't find an attribute? Since, the whole point
of what I am trying to do in this case is to eliminate certain data
with a query?

What do you mean by "eliminate" ?

Maybe you should be more precise about your objectives. Are you trying to display something on a map, or not ? If all your looking for is tables, than you don't need GRASS at all.

Hmmm, I guess I was not that clear. Sorry, and thanks for your help and patients.

What I mean is that I have a map that has a bunch of sites on it, and values shown next to each site as a label. In many cases there are multiple values shown.

What I want to do is draw a second map, where I only show sites where the value is greater then a certain threshold. In other words, my first map has all values shown. My second map should just show sites where value is, for example, greater than 2.0 (or whatever).

So what I ended up doing was copying my original map, and then linking my new map to a view of the original data. But that didn't work because then all the sites that are below the threshold (and therefor are not in the view) don't have a correct value or cat, but the icons are still shown, and when there were multiple values in the original a slash is still drawn, since it seems that it is using a "null" value for the labels.

On 16/04/09 07:35, Adam Dershowitz, Ph.D., P.E. wrote:
> It seems like I should be able to edit the cats, and I tried a few

different things with v.edit, but I have not had any luck. I tried
some things like this: v.edit map=foo tool=catdel -r where="cat > 0" but it gives me: ERROR: Tool catdel requires option cats Although the
above seems to work with tool=select, which I was using to test
things about before doing the delete.

As the message says, tool catdel does not work with a select, but you have to give it a list of cats. You can do that with something like this:

v.edit map=foo tool=catdel cats=`v.db.select -c foo col=cat where=XYZ | awk '{printf"%i,",$1} END{print}'`
(note the back ticks)

I ended up doing something pretty similar to this last night, although I ended up using environmental variables to store the select results. And it accomplished half of what I need. The problem is that all sites are still shown, even if they no no longer have any values, in the cases where the edit has eliminated all of them. So if a vector point had a value of 1.0, it is still drawn.

If I follow the above with:
v.edit map=foo tool=delete -r where="cat > 0" then it also eliminates the sites that no longer have any categories. So I guess I have things working, but it feels like a kluge, and there should be a cleaner solution.

I copied my original vectors, and created the view. Now what I want
to do is to delete all the categories in this vector that point to
null. Is there a way to do that?

Why do you want to do that ? If I understood you correctly, all of these cats have a meaning. Maybe not in the currently linked view, but in the original table. So if you delete these cats, you will lose the link to the values in the original table.

Again, I think we need a better explanation of what it is you are trying to get at.

Moritz

Here is a bigger picture explanation.

A bunch of samples were taken at different locations and different times. I want to be able to generate a few different maps:
1) Show all sampling locations (that one is easy and already done).
2) Show all sample locations, and values, where value is > 2.0, for example. In other words, if the value at a location is below 2.0 then don't display the value, and if all the values at that location are below 2.0 don't even display the icon for the location.
Essentially what I am trying to do is to put a red dot where ever the I had a measurement above 2.0, and also list those values by the red dot.

So far I have not been able to get the above using views and linking to those views, because GRASS still "knows" about the points that are below 2.0 and tries to display them even if they are not in the view and treats them as null values, rather then as values to be ignored.

So far the solution that seems to work is:
1) Create my master map showing all locations and values.
2) Make a copy map that I will then edit.
3) In my copy map use what you had above, v.edit tool=catdel etc., to delete the categories that don't meet a query.
4) Delete any points from my copy that now don't have any cat remaining using v.edit map=foo tool=delete -r where="cat > 0"

So, I think that the above does accomplish what I need. But it was pretty round-about to get it figured out and working. I figured that there would be an easier way to do a query and just show sites and values that are returned by the query.

I think your only other way around this problem is to use Vincent's suggestion of one master map with only one category value per point and your data in a table with as many lines per id (or per cat) as you want.

Then you create views summarising the information by cat, making sure that in these view you only have one line per cat, then you link that view to your map.

Moritz