Re: [GRASS-user] problem with v.db.update and categories
It seems to work better with the sqlite driver... Maybe the command v.db.update does not work with DBF driver? Thanks, Tommaso On Wed, 03 Dec 2014 12:18:13 +0100, tommaso tommas...@googlemail.com wrote: Ok, now can I add the missing categories in dbf table with: v.to.db map='polygons' type='centroid' option='cat' But the update command is still failing: v.db.update map=polygons col=building value=3.0 The new categories in dbf table have still empty 'building' attributes... On Wed, 03 Dec 2014 09:42:28 +0100, tommaso tommas...@googlemail.com wrote: Hello, I'm trying to polygonize a lines layers. I imported the layer in grass with v.in.ogr as boundaries, then I attached the centroids with v.centroid. Probably because of the polygonize, some attribute are lost in in the output map, so I have to update the table to fix the attributes: v.db.update input='polygons' col=building, value='3.0' After the update, the table look fine with v.db.select: all record have the right value. But if I export the layer with ogr, some records do not have attributes at all. My export command looks so. v.out.ogr format='PostgreSQL' input='polygons' type='area' dsn='PG:dbname=test_project host=localhost' olayer='test_table' This warning is raise by v.to.ogr: WARNING: 8 features without attributes were written I guess, the map categories are not synchronized with the database. v.categories returns 1018 results, while the map contains only 298 records: v.category polygons option=print | wc 101810185133 Where are so many categories coming from? How can I synchronize map and database? Thanks, Tomm ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] ps.map and cartographic composer
To answer my own question, to control the resolution of the output image one need to set the region resolution (using g.region) to match the desired image resolution. I guess the cartographic composer does this somehow automatically (?). On Sun, Dec 7, 2014 at 11:35 PM, Paulo van Breugel p.vanbreu...@gmail.com wrote: I have created a .psmap file to create a map in ps format with the cartographic composer. The ps file created is about 35MB. When using the same .psmap file in in the ps.map function, the ps file created is 1GB (basically the size of the raster file used for the map. Any idea what I am doing wrong? The psmap file: # timestamp: 2014-12-07 21:57 # location: latlon # mapset: plantspecies # page orientation: Portrait # g.region rast=bvmeat_kg@CSIRO2005 maploc 0.2 0.2 11.8 4.9 border n paper width 11.2 height 4.5 left 0.1 right 0.1 bottom 0.1 top 0.1 end vareas glbl0@PERMANENT layer 1 masked n color 0:0:0 width 0.2 fcolor none label world_boundaries(PERMANENT) lpos 1 end raster bvmeat_kg@CSIRO2005 ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] Appending a map to another
Hello, I'm trying to simply append a map to other map, without any sort of geometric operations as merge or intersects, just the original geometries with theirs original attributes. I'm using grass 6.4 on ubuntu 14.04, sqlite driver This is what I already tried: # input maps are poly2 and poly3 # First, I change the categories of one of the maps (poly3) to avoid categories conflicts: # see http://grass.osgeo.org/grass64/manuals/v.patch.html v.category in=poly3 option=sum cat=1 out=poly3_category --overwrite g.remove vect=poly3 g.rename vect=poly3_category,poly3 # I update the cat column of the table as well (why this is not done automatically by v.category??) v.db.update poly3 col=cat qcol=cat+1 # now the to maps are patched together db.droptable -f table=polygons v.patch -e input=poly2,poly3 output=polygons --overwrite # export to result as geojson: v.out.ogr in=polygons olayer=polygons format=GeoJSON dsn=/tmp/polygons.json type=area The geometries of the result map polygons.json look good, but the attributes are messy: I can not distinguish which records come from poly2 and which ones from poly3. Many records have only empty attributes. What I'm doing wrong? ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] ps.map and cartographic composer
On Mon, Dec 8, 2014 at 5:55 AM, Paulo van Breugel p.vanbreu...@gmail.com wrote: To answer my own question, to control the resolution of the output image one need to set the region resolution (using g.region) to match the desired image resolution. I guess the cartographic composer does this somehow automatically (?). yes, it does, in Map frame settings you can choose from different options (fit frame to match selected map, selected region, current region, fixed scale and map center). To do so, it sets different region. There is a hint in the header of the created .psmap file, in your file it's the line: # g.region rast=bvmeat_kg@CSIRO2005 Anna On Sun, Dec 7, 2014 at 11:35 PM, Paulo van Breugel p.vanbreu...@gmail.com wrote: I have created a .psmap file to create a map in ps format with the cartographic composer. The ps file created is about 35MB. When using the same .psmap file in in the ps.map function, the ps file created is 1GB (basically the size of the raster file used for the map. Any idea what I am doing wrong? The psmap file: # timestamp: 2014-12-07 21:57 # location: latlon # mapset: plantspecies # page orientation: Portrait # g.region rast=bvmeat_kg@CSIRO2005 maploc 0.2 0.2 11.8 4.9 border n paper width 11.2 height 4.5 left 0.1 right 0.1 bottom 0.1 top 0.1 end vareas glbl0@PERMANENT layer 1 masked n color 0:0:0 width 0.2 fcolor none label world_boundaries(PERMANENT) lpos 1 end raster bvmeat_kg@CSIRO2005 ___ 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
[GRASS-user] randomize the position of a raster map
Hi all, I have a landcover maps, and I need to randomize the position of them, keeping all the pixels on the new raster map. Is there a command that can do this within GRASS? best -- Miltinho - m...@rc.unesp.br Laboratório de Ecologia Espacial e Conservação - LEEC Depto de Ecologia - UNESP - Rio Claro Av. 24A, 1515- Bela Vista 13506-900 Rio Claro, SP, Brasil Fone: +55 19 3526-9647 (office) 19 3526-9680 (lab) Cel: 19 9853-3220 / 19 9853-5430 Depto Ecologia http://ib.rc.unesp.br/#!/departamentos/ecologia/ PG ECO BIODIV http://ib.rc.unesp.br/#!/departamentos/ecologia/pos-graduacao-em-ecologia-e-biodiversidade/ CV http://buscatextual.cnpq.br/buscatextual/visualizacv.do?id=K4792988H6mostrarNroCitacoesISI=truemostrarNroCitacoesScopus=true Google citations http://scholar.google.com/citations?user=OWX_2eAJ ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] problems with r.mapcalc
Hi list, first, i'm new with grass Im trying to do some math calculations with r.mapcalc, but my result allways is nan. When I display the image I can see different values, not only nan. Thanks GRASS 7.1.svn (sequia):/opt/grass_trunk/bin.x86_64-unknown-linux-gnu r.info NDVI_1_h11v11 ++ | Map: NDVI_1_h11v11 Date: Mon Dec 1 05:12:28 2014 | | Mapset: sequia Login of Creator: polzader | | Location: sequia | | DataBase: /home/polzader/Documentos/grassdata_diana_bpr | | Title: ( NDVI_1_h11v11 ) | | Timestamp: none | || | | | Type of Map: raster Number of Categories: 0 | | Data Type:DCELL | | Rows: 4409 | | Columns: 7499 | | Total Cells: 33063091 | |Projection: Latitud - Longitud. | |N: 19:54:02.16SS: 30:01:58.200271S Res: 0:00:08.273087 | |E: 63:35:44.521118WW: 80:49:44.4W Res: 0:00:08.273087 | | Range of data:min = -2000 max = 9090 | | | | Data Description: | |generated by r.series | | | | Comments: | |r.series input=MOD13Q1.A2004001.h11v11.005.2007235231758.250m_16_da\ | | ys_NDVI,MOD13Q1.A2005001.h11v11.005.2007352072715.250m_16_days_NDVI,\ | |MOD13Q1.A2006001.h11v11.005.2008064055525.250m_16_days_NDVI,MOD13Q1.\ | |A2007001.h11v11.005.2007021105928.250m_16_days_NDVI,MOD13Q1.A2008001\ | |.h11v11.005.2008019102106.250m_16_days_NDVI,MOD13Q1.A2009001.h11v11.\ | |005.2009019230008.250m_16_days_NDVI,MOD13Q1.A2010001.h11v11.005.2010\ | |027061330.250m_16_days_NDVI,MOD13Q1.A2011001.h11v11.005.201102405534\ | |0.250m_16_days_NDVI,MOD13Q1.A2012001.h11v11.005.2012019103715.250m_1\ | |6_days_NDVI,MOD13Q1.A2013001.h11v11.005.2013018034332.250m_16_days_N\ | |DVI,MOD13Q1.A2014001.h11v11.005.2014018092301.250m_16_days_NDVI,MOD1\ | |3Q1.A2004017.h11v11.005.2008224113415.250m_16_days_NDVI,MOD13Q1.A200\ | |5017.h11v11.005.2007353093413.250m_16_days_NDVI,MOD13Q1.A2006017.h11\ | |v11.005.2008278011906.250m_16_days_NDVI,MOD13Q1.A2007017.h11v11.005.\ | |2007096165508.250m_16_days_NDVI,MOD13Q1.A2008017.h11v11.005.20080370\ | |54317.250m_16_days_NDVI,MOD13Q1.A2009017.h11v11.005.2009035200807.25\ | |0m_16_days_NDVI,MOD13Q1.A2010017.h11v11.005.2010036002816.250m_16_da\ | |ys_NDVI,MOD13Q1.A2011017.h11v11.005.2011039201212.250m_16_days_NDVI,\ | |MOD13Q1.A2012017.h11v11.005.2012046172118.250m_16_days_NDVI,MOD13Q1.\ | |A2013017.h11v11.005.2013039191638.250m_16_days_NDVI,MOD13Q1.A2014017\ | |.h11v11.005.2014038143732.250m_16_days_NDVI output=NDVI_1_h11v11 \ | |method=average | | | ++ GRASS 7.1.svn (sequia):/opt/grass_trunk/bin.x86_64-unknown-linux-gnu r.info NDWI_1_h11v11 ++ | Map: NDWI_1_h11v11 Date: Mon Dec 1 05:49:38 2014 | | Mapset: sequia Login of Creator: polzader | | Location: sequia | | DataBase: /home/polzader/Documentos/grassdata_diana_bpr | | Title: ( NDWI_1_h11v11 ) | | Timestamp: none | || | | | Type of Map: raster Number of Categories: 0 | | Data Type:DCELL | | Rows: 4409 | | Columns: 7499 | | Total Cells: 33063091 | |Projection: Latitud - Longitud. | |N: 19:54:02.16SS: 30:01:58.200271S Res: 0:00:08.273087 | |E: 63:35:44.521118WW: 80:49:44.4W Res: 0:00:08.273087 | | Range of data:min = -9254.65838509317 max = 9247.07852234276 | | | | Data Description: | |generated by r.mapcalc | | | | Comments: | |(NIR_reflectance_1_h11v11 - MIR_reflectance_1_h11v11) / | |(NIR_reflectance_1_h11v11 + MIR_reflectance_1_h11v11) * 1 | | | ++ r.mapcalc --o expression=bla=NDVI_1_h11v11 - NDWI_1_h11v11 GRASS 7.1.svn (sequia):/opt/grass_trunk/bin.x86_64-unknown-linux-gnu r.info bla ++ | Map: blaDate: Mon Dec 8 18:04:41 2014 | | Mapset: sequia Login of Creator: polzader | | Location: sequia | | DataBase: /home/polzader/Documentos/grassdata_diana_bpr | | Title: ( bla ) | | Timestamp: none | || | | | Type of Map: raster
Re: [GRASS-user] problems with r.mapcalc
Not sure that will give you a solution, but an r.mapcalc expression in grass 7.1 should look like: r.mapcalc --overwrite expression=bla = NDVI_1_h11v11 - NDWI_1_h11v11 In other words 1) the --o flag in grass 6.4 was changed to --overwrite in grass 7 and higher, and 2) there should be a space before the first *=* sign. Check out: http://grass.osgeo.org/grass71/manuals/r.mapcalc.html Paulo On Mon, Dec 8, 2014 at 10:23 PM, Diana Brito dianisbri...@gmail.com wrote: Hi list, first, i'm new with grass Im trying to do some math calculations with r.mapcalc, but my result allways is nan. When I display the image I can see different values, not only nan. Thanks GRASS 7.1.svn (sequia):/opt/grass_trunk/bin.x86_64-unknown-linux-gnu r.info NDVI_1_h11v11 ++ | Map: NDVI_1_h11v11 Date: Mon Dec 1 05:12:28 2014 | | Mapset: sequia Login of Creator: polzader | | Location: sequia | | DataBase: /home/polzader/Documentos/grassdata_diana_bpr | | Title: ( NDVI_1_h11v11 ) | | Timestamp: none | || | | | Type of Map: raster Number of Categories: 0 | | Data Type:DCELL | | Rows: 4409 | | Columns: 7499 | | Total Cells: 33063091 | |Projection: Latitud - Longitud. | |N: 19:54:02.16SS: 30:01:58.200271S Res: 0:00:08.273087 | |E: 63:35:44.521118WW: 80:49:44.4W Res: 0:00:08.273087 | | Range of data:min = -2000 max = 9090 | | | | Data Description: | |generated by r.series | | | | Comments: | |r.series input=MOD13Q1.A2004001.h11v11.005.2007235231758.250m_16_da\ | | ys_NDVI,MOD13Q1.A2005001.h11v11.005.2007352072715.250m_16_days_NDVI,\ | | MOD13Q1.A2006001.h11v11.005.2008064055525.250m_16_days_NDVI,MOD13Q1.\ | | A2007001.h11v11.005.2007021105928.250m_16_days_NDVI,MOD13Q1.A2008001\ | | .h11v11.005.2008019102106.250m_16_days_NDVI,MOD13Q1.A2009001.h11v11.\ | | 005.2009019230008.250m_16_days_NDVI,MOD13Q1.A2010001.h11v11.005.2010\ | | 027061330.250m_16_days_NDVI,MOD13Q1.A2011001.h11v11.005.201102405534\ | | 0.250m_16_days_NDVI,MOD13Q1.A2012001.h11v11.005.2012019103715.250m_1\ | | 6_days_NDVI,MOD13Q1.A2013001.h11v11.005.2013018034332.250m_16_days_N\ | | DVI,MOD13Q1.A2014001.h11v11.005.2014018092301.250m_16_days_NDVI,MOD1\ | | 3Q1.A2004017.h11v11.005.2008224113415.250m_16_days_NDVI,MOD13Q1.A200\ | | 5017.h11v11.005.2007353093413.250m_16_days_NDVI,MOD13Q1.A2006017.h11\ | | v11.005.2008278011906.250m_16_days_NDVI,MOD13Q1.A2007017.h11v11.005.\ | | 2007096165508.250m_16_days_NDVI,MOD13Q1.A2008017.h11v11.005.20080370\ | | 54317.250m_16_days_NDVI,MOD13Q1.A2009017.h11v11.005.2009035200807.25\ | | 0m_16_days_NDVI,MOD13Q1.A2010017.h11v11.005.2010036002816.250m_16_da\ | | ys_NDVI,MOD13Q1.A2011017.h11v11.005.2011039201212.250m_16_days_NDVI,\ | | MOD13Q1.A2012017.h11v11.005.2012046172118.250m_16_days_NDVI,MOD13Q1.\ | | A2013017.h11v11.005.2013039191638.250m_16_days_NDVI,MOD13Q1.A2014017\ | |.h11v11.005.2014038143732.250m_16_days_NDVI output=NDVI_1_h11v11 \ | |method=average | | | ++ GRASS 7.1.svn (sequia):/opt/grass_trunk/bin.x86_64-unknown-linux-gnu r.info NDWI_1_h11v11 ++ | Map: NDWI_1_h11v11 Date: Mon Dec 1 05:49:38 2014 | | Mapset: sequia Login of Creator: polzader | | Location: sequia | | DataBase: /home/polzader/Documentos/grassdata_diana_bpr | | Title: ( NDWI_1_h11v11 ) | | Timestamp: none | || | | | Type of Map: raster Number of Categories: 0 | | Data Type:DCELL | | Rows: 4409 | | Columns: 7499 | | Total Cells: 33063091 | |Projection: Latitud - Longitud. | |N: 19:54:02.16SS: 30:01:58.200271S Res: 0:00:08.273087 | |E: 63:35:44.521118WW: 80:49:44.4W Res: 0:00:08.273087 | | Range of data:min = -9254.65838509317 max = 9247.07852234276 | | | | Data Description: | |generated by r.mapcalc | | | | Comments: | |(NIR_reflectance_1_h11v11 - MIR_reflectance_1_h11v11) / | |(NIR_reflectance_1_h11v11 + MIR_reflectance_1_h11v11) * 1 | | |
Re: [GRASS-user] problems with r.mapcalc
Look closely at the output of r.info: Your current region is not where your data is. First change the region to the extent and resolution of the input map(s): g.region rast=NDVI_1_h11v11 ... then run your r.mapcalc command. Best, Ben On 08/12/14 22:23, Diana Brito wrote: Hi list, first, i'm new with grass Im trying to do some math calculations with r.mapcalc, but my result allways is nan. When I display the image I can see different values, not only nan. Thanks GRASS 7.1.svn (sequia):/opt/grass_trunk/bin.x86_64-unknown-linux-gnu r.info http://r.info grass-user@lists.osgeo.org ++ | Map: NDVI_1_h11v11 Date: Mon Dec 1 05:12:28 2014| | Mapset: sequia Login of Creator: polzader | | Location: sequia | | DataBase: /home/polzader/Documentos/grassdata_diana_bpr | | Title: ( NDVI_1_h11v11 ) | | Timestamp: none | || | | | Type of Map: raster Number of Categories: 0 | | Data Type:DCELL | | Rows: 4409 | | Columns: 7499 | | Total Cells: 33063091 | |Projection: Latitud - Longitud. | |N: 19:54:02.16SS: 30:01:58.200271S Res: 0:00:08.273087| |E: 63:35:44.521118WW: 80:49:44.4W Res: 0:00:08.273087 | | Range of data:min = -2000 max = 9090 | | | | Data Description: | |generated by r.series | | | | Comments: | |r.series input=MOD13Q1.A2004001.h11v11.005.2007235231758.250m_16_da\ | | ys_NDVI,MOD13Q1.A2005001.h11v11.005.2007352072715.250m_16_days_NDVI,\ | | MOD13Q1.A2006001.h11v11.005.2008064055525.250m_16_days_NDVI,MOD13Q1.\ | | A2007001.h11v11.005.2007021105928.250m_16_days_NDVI,MOD13Q1.A2008001\ | | .h11v11.005.2008019102106.250m_16_days_NDVI,MOD13Q1.A2009001.h11v11.\ | | 005.2009019230008.250m_16_days_NDVI,MOD13Q1.A2010001.h11v11.005.2010\ | | 027061330.250m_16_days_NDVI,MOD13Q1.A2011001.h11v11.005.201102405534\ | | 0.250m_16_days_NDVI,MOD13Q1.A2012001.h11v11.005.2012019103715.250m_1\ | | 6_days_NDVI,MOD13Q1.A2013001.h11v11.005.2013018034332.250m_16_days_N\ | | DVI,MOD13Q1.A2014001.h11v11.005.2014018092301.250m_16_days_NDVI,MOD1\ | | 3Q1.A2004017.h11v11.005.2008224113415.250m_16_days_NDVI,MOD13Q1.A200\ | | 5017.h11v11.005.2007353093413.250m_16_days_NDVI,MOD13Q1.A2006017.h11\ | | v11.005.2008278011906.250m_16_days_NDVI,MOD13Q1.A2007017.h11v11.005.\ | | 2007096165508.250m_16_days_NDVI,MOD13Q1.A2008017.h11v11.005.20080370\ | | 54317.250m_16_days_NDVI,MOD13Q1.A2009017.h11v11.005.2009035200807.25\ | | 0m_16_days_NDVI,MOD13Q1.A2010017.h11v11.005.2010036002816.250m_16_da\ | | ys_NDVI,MOD13Q1.A2011017.h11v11.005.2011039201212.250m_16_days_NDVI,\ | | MOD13Q1.A2012017.h11v11.005.2012046172118.250m_16_days_NDVI,MOD13Q1.\ | | A2013017.h11v11.005.2013039191638.250m_16_days_NDVI,MOD13Q1.A2014017\ | |.h11v11.005.2014038143732.250m_16_days_NDVI output=NDVI_1_h11v11 \ | |method=average | | | ++ GRASS 7.1.svn (sequia):/opt/grass_trunk/bin.x86_64-unknown-linux-gnu r.info http://r.info NDWI_1_h11v11 ++ | Map: NDWI_1_h11v11 Date: Mon Dec 1 05:49:38 2014| | Mapset: sequia Login of Creator: polzader | | Location: sequia | | DataBase: /home/polzader/Documentos/grassdata_diana_bpr | | Title: ( NDWI_1_h11v11 ) | |
Re: [GRASS-user] Appending a map to another
On Mon, Dec 8, 2014 at 2:37 PM, tommaso tommas...@googlemail.com wrote: Hello, I'm trying to simply append a map to other map, without any sort of geometric operations as merge or intersects, just the original geometries with theirs original attributes. I'm using grass 6.4 on ubuntu 14.04, sqlite driver This is what I already tried: # input maps are poly2 and poly3 # First, I change the categories of one of the maps (poly3) to avoid categories conflicts: # see http://grass.osgeo.org/grass64/manuals/v.patch.html v.category in=poly3 option=sum cat=1 out=poly3_category --overwrite To be safe, you should specify the feature type: v.category type=centroid. g.remove vect=poly3 g.rename vect=poly3_category,poly3 # I update the cat column of the table as well (why this is not done automatically by v.category??) v.db.update poly3 col=cat qcol=cat+1 # now the to maps are patched together db.droptable -f table=polygons v.patch -e input=poly2,poly3 output=polygons --overwrite # export to result as geojson: v.out.ogr in=polygons olayer=polygons format=GeoJSON dsn=/tmp/polygons.json type=area This exports all features, with and without category. That means holes in areas are converted to true polygons without categories. Use the -c flag to export only true areas with ctegories. The geometries of the result map polygons.json look good, but the attributes are messy: I can not distinguish which records come from poly2 and which ones from poly3. The records with cat = 1 should come from poly3. Is the cat attribute not available in the json export? Many records have only empty attributes. What I'm doing wrong? See above, v.in.ogr -c should help. Markus M ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user