[GRASS-user] v.generalize and where clause

Markus Metz markus.metz.giswork at gmail.com
Sat Apr 20 14:42:03 PDT 2019


On Sat, Apr 20, 2019 at 8:27 PM Micha Silver <tsvibar at gmail.com> wrote:
>
> Trying to address this SE question:
>
>
>
https://gis.stackexchange.com/questions/319319/how-to-apply-smoothing-filter-only-to-way-bigger-than-specified-number-of-nodes
>
>
> I tried to apply v.generalize to a subset of area features, using a where
clause, but it doesn't seem to be working. All features are generlized, as
if the where clause is being ignored. Here's an example from the
nc_basic_sm MAPSET:
>
>
> micha at TP480:~$ v.extract geology output=my_geology --o
where="GEO_NAME='Qp'"
> WARNING: Vector map <my_geology> already exists and will be overwritten
>
> .....
>
>
> micha at TP480:~$ v.db.addcolumn my_geology column="area_sqkm DOUBLE"
>
> micha at TP480:~$ v.to.db my_geology option=area column=area_sqkm
unit=kilometer
> WARNING: Values in column <area_sqkm> will be overwritten
> .....
> 326 records updated/inserted (layer 1)
>
>
> # Only 21 features are larger than 10 sq.km.:
>
> micha at TP480:~$  v.db.select -c my_geology column=area_sqkm
where="area_sqkm>10" | wc -l
> 21
>
>
> micha at TP480:~$ v.generalize my_geology output=my_geology_smooth type=area
method=douglas thresh=100 where="area_sqkm>10" --o
>
> ....
>
> v.generalize complete. Number of vertices for selected features reduced
> from 44238 to 7540 (17% remaining)
>
>
> Now viewing both my_geology and my_geology_smooth shows that *all*
features were smoothed. Including those island polygons that were much
smaller than 10 sq.km.
>
>
> Am I missing something?

Yes, the option layer defaults to -1 = all layers. If you use the cats or
where option, you need to specify a layer, otherwise the warning
WARNING: No layer selected, 'where' and 'cats' options are ignored

is issued in trunk. I have backported this warning to relbr76 in r74409.

HTH,

Markus M
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20190420/09816d0e/attachment.html>


More information about the grass-user mailing list