Re: [GRASS-user] two questions: snap and close lines

2012-01-27 Thread Paolo Cavallini
Il 26/01/2012 20:41, Markus Metz ha scritto:
 On Mon, Jan 23, 2012 at 8:00 PM, Paolo Cavallini cavall...@faunalia.it 
 wrote:
 Hi all.
 A couple of issues I ran into today:
 - I have a layer with some good and some bad polygons; how do I import it 
 into GRASS
 letting the bad ones snapping onto the good ones, and not vice versa?
 
 You could try v.edit, otherwise it will be hand-editing with a digitizer.
 
 With topological vectors, snapping one set of polygons to another set
 of polygons does not make sense, because there are no polygons in
 topological vectors, only shared boundaries. That is probably the
 reason why this functionality is not available in grass.

Hi Markus M,
thanks for your reply. Let me explain better my use case:
- I have a shapefile, with (almost) adjacent polygons
- if I import them, I can snap the almost adjacent lines, and get common 
boundaries
- the problem is that I cannot control which of the two adjacent lines stay 
fixed,
and which one moves to it
- I know that of the two polygons, one is good (certified), the other is not; 
so I
want the first to remain fixed, and have the other snap to it.
Did I explain myself better?

 For contour lines, you would need to patch the vector with contour
 lines with a vector created with v.in.region type=line, then break
 lines at intersections, convert lines to boundaries, add centroids.
 This assumes that not closed contour lines have endpoints exactly at
 the extents of the vector, e.g. if the western edge of the contour
 vector is 30 and there is an open contour line ending at say
 29., this will not work. If the contour lines were produced
 with r.contour, this should work.

In practice:

#set the region around contour
v.in.region output=region_line type=line
v.patch input=contour,region_line output=patched
v.clean input=patched@paolo type=line tool=snap thresh=1 output=patched_1
v.clean input=patched@paolo type=line tool=break output=patched_break
v.type input=patched_break@paolo output=patched_break_boundaries 
type=line,boundary
v.centroids input=patched_break_boundaries output=polygons

It mostly works, but apparently breaking does not (only closed rings become 
different
polygons).

In the meantime, I spotted a few minor issues in the qgis-grass interface, I'm 
going
to fix them.

Thanks a lot.
-- 
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] v.generalize: strange behaviour on win?

2012-01-27 Thread Paolo Cavallini
Il 26/01/2012 20:53, Markus Metz ha scritto:

 You would need to provide the input, not the output as an example.

https://int.faunalia.it/~paolo/province.zip

 Considering the detail of the output and the threshold used, it is no
 surprise that not all boundaries were generalized because that would
 break topology. If you want to generalize with a threshold of 10,
 I would recommend to first remove all areas with a size up to 10.

This is not the point. The very same input and command work in Linux, leave
ungeneralized boundaries in Windows.
If you consider that also r.to.vect for lines also behaves differently between 
the
two OSs, I suspect an OS-specific bug here.

Any confirmation?
Thanks a lot.
-- 
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] two questions: snap and close lines

2012-01-27 Thread Markus Metz
On Fri, Jan 27, 2012 at 1:02 PM, Paolo Cavallini cavall...@faunalia.it wrote:
 Il 26/01/2012 20:41, Markus Metz ha scritto:
 On Mon, Jan 23, 2012 at 8:00 PM, Paolo Cavallini cavall...@faunalia.it 
 wrote:
 Hi all.
 A couple of issues I ran into today:
 - I have a layer with some good and some bad polygons; how do I import it 
 into GRASS
 letting the bad ones snapping onto the good ones, and not vice versa?

 You could try v.edit, otherwise it will be hand-editing with a digitizer.

 With topological vectors, snapping one set of polygons to another set
 of polygons does not make sense, because there are no polygons in
 topological vectors, only shared boundaries. That is probably the
 reason why this functionality is not available in grass.

 Hi Markus M,
 thanks for your reply. Let me explain better my use case:
 - I have a shapefile, with (almost) adjacent polygons
 - if I import them, I can snap the almost adjacent lines, and get common 
 boundaries
 - the problem is that I cannot control which of the two adjacent lines stay 
 fixed,
 and which one moves to it
 - I know that of the two polygons, one is good (certified), the other is not; 
 so I
 want the first to remain fixed, and have the other snap to it.
 Did I explain myself better?

The only two options I can think of is giving v.edit a try, otherwise
hand-editing.

 For contour lines, you would need to patch the vector with contour
 lines with a vector created with v.in.region type=line, then break
 lines at intersections, convert lines to boundaries, add centroids.
 This assumes that not closed contour lines have endpoints exactly at
 the extents of the vector, e.g. if the western edge of the contour
 vector is 30 and there is an open contour line ending at say
 29., this will not work. If the contour lines were produced
 with r.contour, this should work.

 In practice:

 #set the region around contour
 v.in.region output=region_line type=line
 v.patch input=contour,region_line output=patched
 v.clean input=patched@paolo type=line tool=snap thresh=1 output=patched_1
 v.clean input=patched@paolo type=line tool=break output=patched_break
 v.type input=patched_break@paolo output=patched_break_boundaries 
 type=line,boundary
 v.centroids input=patched_break_boundaries output=polygons

 It mostly works, but apparently breaking does not (only closed rings become 
 different
 polygons).

Why does breaking not work? Maybe you need remove duplicates and clean
small angles at nodes. You could try
v.clean input=patched@paolo type=line tool=snap,break,rmdupl,rmsa
thresh=1,0,0,0 output=patched_1
or in grass 7
v.clean input=patched@paolo type=line tool=snap thresh=1 output=patched_1 -c

Markus M
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] v.generalize: strange behaviour on win?

2012-01-27 Thread Markus Metz
On Fri, Jan 27, 2012 at 1:32 PM, Paolo Cavallini cavall...@faunalia.it wrote:
 Il 26/01/2012 20:53, Markus Metz ha scritto:

 You would need to provide the input, not the output as an example.

 https://int.faunalia.it/~paolo/province.zip

 Considering the detail of the output and the threshold used, it is no
 surprise that not all boundaries were generalized because that would
 break topology. If you want to generalize with a threshold of 10,
 I would recommend to first remove all areas with a size up to 10.

 This is not the point. The very same input and command work in Linux, leave
 ungeneralized boundaries in Windows.

I tried v.generalize on the Province_general3 shapefile on Linux with
type=boundary method=douglas threshold=10 and it did not modify
any boundaries. I also tried the input province shapefile and get the
same output. That is, if Province_general3 has been generated on
windows, I do get the same result on Linux, no difference between the
OS's. Are you using an older grass version on Linux?

Markus M
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] v.generalize: strange behaviour on win?

2012-01-27 Thread Paolo Cavallini
Il 27/01/2012 19:02, Markus Metz ha scritto:

 same output. That is, if Province_general3 has been generated on
 windows, I do get the same result on Linux, no difference between the
 OS's. Are you using an older grass version on Linux?

aptitude show grass
Versione: 6.4.1-1
Thanks.

-- 
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] two questions: snap and close lines

2012-01-27 Thread Paolo Cavallini
Il 27/01/2012 18:53, Markus Metz ha scritto:

 The only two options I can think of is giving v.edit a try, otherwise
 hand-editing.

Urgh! Too bad, thanks anyway.

 Why does breaking not work? Maybe you need remove duplicates and clean
 small angles at nodes. You could try
 v.clean input=patched@paolo type=line tool=snap,break,rmdupl,rmsa
 thresh=1,0,0,0 output=patched_1

I'm not quite sure break do not work: new nodes are there, but in subsequent 
steps
they are not treated as closed polygons.

Thanks.
-- 
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] v.generalize: strange behaviour on win?

2012-01-27 Thread Markus Metz
On Fri, Jan 27, 2012 at 7:01 PM, Paolo Cavallini cavall...@faunalia.it wrote:
 Il 27/01/2012 19:02, Markus Metz ha scritto:

 same output. That is, if Province_general3 has been generated on
 windows, I do get the same result on Linux, no difference between the
 OS's. Are you using an older grass version on Linux?

 aptitude show grass
 Versione: 6.4.1-1

v.generalize is broken in 6.4.1

Markus M
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


[GRASS-user] 6.5svn Crash Report

2012-01-27 Thread Rich Shepard

  I just ran 'svn up': 14:00 PST Friday 2012-01-27, configured, built, and
installed the latest code. Didn't record the build number.

  Within the wxPython GUI I opened a point map and tried to query a point
for information about it. GRASS immediately crashed. The virtual console
shows:

GRASS 6.5.svn (Washington-SPCS):~/grassdata/Washington-SPCS/Buckhorn  dbmi:
Protocol error

GRASS_INFO_ERROR(1491,1): Unable to open database
/home/rshepard/grassdata/Washington-SPCS/Buckhorn/dbf/
GRASS_INFO_END(1491,1)

GRASS_INFO_ERROR(1494,1): Unable to describe table
Buckhorn_Surface_Water_Stations
GRASS_INFO_END(1494,1)
dbmi: Protocol error

GRASS_INFO_ERROR(1516,1): Unable to open database
/home/rshepard/grassdata/Washington-SPCS/Buckhorn/dbf/
GRASS_INFO_END(1516,1)

GRASS_INFO_ERROR(1519,1): Unable to describe table
Buckhorn_Surface_Water_Stations
GRASS_INFO_END(1519,1)

  I had imported this map from a shapefile a few weeks ago but had not
looked at it before now. Where do I start looking for the problem with
opening the GRASS database?

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


Re: [GRASS-user] 6.5svn Crash Report [UPDATE]

2012-01-27 Thread Rich Shepard

 Just tried to re-import the file. Command window shows:

(Fri Jan 27 14:44:02 2012) 
v.in.ogr dsn=/home/rshepard/projects/washington/buckhorn/spatial/Buckhorn_Surface_Water_Stations.shp layer=Buckhorn_Surface_Water_Stations output=Buckhorn_Surface_Water_Stations --overwrite -e -w

Vector map Buckhorn_Surface_Water_Stations already exists and will be 
overwritten
Projection of input dataset and current location appear to match
Vector map Buckhorn_Surface_Water_Stations already exists and will be 
overwritten
dbmi: Protocol error
Unable to open database /home/rshepard/grassdata/Washington-SPCS/Buckhorn/dbf/ by 
driver dbf
Unable open database /home/rshepard/grassdata/Washington-SPCS/Buckhorn/dbf/ by 
driver dbf
Unable to find table Buckhorn_Surface_Water_Stations linked to vector map 
Buckhorn_Surface_Water_Stations
ERROR: Unable to delete vector map Buckhorn_Surface_Water_Stations
(Fri Jan 27 14:44:03 2012) Command finished (0 sec)

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


Re: [GRASS-user] 6.5svn Crash Report

2012-01-27 Thread Hamish
Rich wrote:
   I just ran 'svn up': 14:00 PST
 Friday 2012-01-27, configured, built, and
 installed the latest code. Didn't record the build number.
 
   Within the wxPython GUI I opened a point map and
 tried to query a point
 for information about it. GRASS immediately crashed. The
 virtual console
 shows:
...
 dbmi: Protocol error

It didn't like a change to db__recv_procnum() in
  lib/db/dbmi_base/xdrprocedure.c
made 2 hours ago.
it's now back to the old (working) way in devbr6,

cd lib/db/
svn up
make


trunk remains broken for now.


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


Re: [GRASS-user] 6.5svn Crash Report

2012-01-27 Thread Rich Shepard

On Fri, 27 Jan 2012, Hamish wrote:


It didn't like a change to db__recv_procnum() in
 lib/db/dbmi_base/xdrprocedure.c
made 2 hours ago.
it's now back to the old (working) way in devbr6,

cd lib/db/
svn up
make


Hamish,

  Did the above (including 'make install') and see no difference. Same error
message when I try to query a point for the attributes:

GRASS 6.5.svn (Washington-SPCS):~/grassdata/Washington-SPCS/Buckhorn  dbmi:
Protocol error

GRASS_INFO_ERROR(5972,1): Unable to open database
/home/rshepard/grassdata/Washington-SPCS/Buckhorn/dbf/
GRASS_INFO_END(5972,1)

GRASS_INFO_ERROR(5974,1): Unable to describe table
Buckhorn_Surface_Water_Stations
GRASS_INFO_END(5974,1)
dbmi: Protocol error

GRASS_INFO_ERROR(5997,1): Unable to open database
/home/rshepard/grassdata/Washington-SPCS/Buckhorn/dbf/
GRASS_INFO_END(5997,1)

GRASS_INFO_ERROR(5999,1): Unable to describe table
Buckhorn_Surface_Water_Stations
GRASS_INFO_END(5999,1)

Thanks,

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