[GRASS-user] Multiple to one question
Adam Dershowitz, Ph.D., P.E.
adershowitz at exponent.com
Thu Apr 16 01:35:59 EDT 2009
--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
More information about the grass-user
mailing list