[GRASS-user] Multiple to one question

Moritz Lennert mlennert at club.worldonline.be
Sat Apr 18 08:15:04 EDT 2009


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


More information about the grass-user mailing list