Re: [Qgis-developer] Labels on topologically wrong polygons

2013-07-25 Thread William Kyngesburye
On Jul 25, 2013, at 12:18 AM, Paolo Cavallini wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Il 25/07/2013 01:57, William Kyngesburye ha scritto:
 
 If liblwgeom becomes a requirement for QGIS, I'll certainly be packaging it 
 with
 QGIS, and adding instructions to INSTALL.
 
 it is not a requirement, but it wouold be good if you could include it 
 anyway, to let
 osx users enjoy our plugin.
 
Is it a compiled plugin?  Wouldn't that have to be included in the QGIS source, 
thus making a liblwgeom requirement?  Or are you using ctypes to access 
liblwgeom functions from python?

 It probably requires a full install of Postgres.
 
 it should not; at least, o win and deb this is not the case.
 
I mean configuration probably requires postgres.  Compilation of only liblwgeom 
after configuration does not.

-
William Kyngesburye kyngchaos*at*kyngchaos*dot*com
http://www.kyngchaos.com/

Oh, look, I seem to have fallen down a deep, dark hole.  Now what does that 
remind me of?  Ah, yes - life.

- Marvin


___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Labels on topologically wrong polygons

2013-07-25 Thread Paolo Cavallini
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Il 25/07/2013 15:20, William Kyngesburye ha scritto:

 Is it a compiled plugin?  Wouldn't that have to be included in the QGIS 
 source, thus making a liblwgeom requirement?  Or are you using ctypes to 
 access liblwgeom functions from python?

It's a Python one. lwgeom is not a requirement, but it would be good to include 
it
anyway; probably more and more of its functions will be used (easy to add them 
to the
plugin).
All the best.
- -- 
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iEYEARECAAYFAlHxJv8ACgkQ/NedwLUzIr4kawCeNYLK95OcwgFKzkNK1+GCiF99
s74AnRewHwjfZ1cVMZPnq0wFvd6zbaeq
=+Ny2
-END PGP SIGNATURE-
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Labels on topologically wrong polygons

2013-07-25 Thread William Kyngesburye
On Jul 25, 2013, at 8:24 AM, Paolo Cavallini wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Il 25/07/2013 15:20, William Kyngesburye ha scritto:
 
 Is it a compiled plugin?  Wouldn't that have to be included in the QGIS 
 source, thus making a liblwgeom requirement?  Or are you using ctypes to 
 access liblwgeom functions from python?
 
 It's a Python one. lwgeom is not a requirement, but it would be good to 
 include it
 anyway; probably more and more of its functions will be used (easy to add 
 them to the
 plugin).

Hmm, unless QGIS itself starts using lwgeom, I don't think bundling tools for 
use by 3rd party plugins is the way to go.  Maybe OK since it's an extension of 
Sextante (just refreshed what you said on this thread).  Or could the plugin 
just be added to core Sextante?

I'll think about options.

-
William Kyngesburye kyngchaos*at*kyngchaos*dot*com
http://www.kyngchaos.com/

History is an illusion caused by the passage of time, and time is an illusion 
caused by the passage of history.

- Hitchhiker's Guide to the Galaxy


___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Labels on topologically wrong polygons

2013-07-25 Thread Paolo Cavallini
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Il 25/07/2013 15:38, William Kyngesburye ha scritto:

 Hmm, unless QGIS itself starts using lwgeom, I don't think bundling tools for 
 use
 by 3rd party plugins is the way to go.  Maybe OK since it's an extension of
 Sextante (just refreshed what you said on this thread).  Or could the plugin 
 just
 be added to core Sextante?

that's the plan; of course it is only feasible if lwgeom is available for all 
major
OS, so it's a chicken-egg problem.
All the best.

- -- 
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iEYEARECAAYFAlHxK0wACgkQ/NedwLUzIr7gGgCfSWQTRbSRQRkO6uSRfoY20f3H
fUUAn10M2aKPkcCSEnaYjxw4dFArG4iq
=i40Z
-END PGP SIGNATURE-
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


[Qgis-developer] Labels on topologically wrong polygons

2013-07-24 Thread Paolo Cavallini
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi all.
I noticed that labels are not placed on topologically wrong polygons. This makes
sense, but is surprising for the user: could we think of some solution?
All the best.
- -- 
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iEYEARECAAYFAlHv7bwACgkQ/NedwLUzIr4D1ACeKZdyAOUz7SAujvNy5ziztHTq
RM8An05nyhyTMsJlts2GamUi2akvpCPy
=hesG
-END PGP SIGNATURE-
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Labels on topologically wrong polygons

2013-07-24 Thread Paolo Cavallini
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Il 24/07/2013 17:55, Larry Shaffer ha scritto:

 I think QGIS should offer the option to on-the-fly try to fix those 
 geometries. This
 was discussed previously [0], and I think the best solution presented so far 
 is to
 find a way to incorporate the standalone PostGIS library 'lwgeom' into the 
 QGIS

done for now: http://plugins.qgis.org/plugins/sextantelwgeomprovider/

 Ideally, if someone where to find a way (maybe it is simple, but not for me) 
 to have
 the lwgeom library compile-able as a standalone library, apart from PostGIS, 
 it would

we are doing it now, for osgeo4w. ready on debian.

All the best.
- -- 
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iEYEARECAAYFAlHv+nUACgkQ/NedwLUzIr6orACgrj5T0/FytPBmOsiJTKfLzX/D
NCUAoIY5yXtEt2Ddtht7nSnt7dq01Qi6
=2m/z
-END PGP SIGNATURE-
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Labels on topologically wrong polygons

2013-07-24 Thread Paolo Cavallini
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Il 24/07/2013 18:21, Larry Shaffer ha scritto:

 But that just wraps the C++ library with Python doesn't? (Very nice, btw!) 
 That still
 requires a full install of PostGIS/PostgreSQL (at this time):

not, we have compiled it as standalone; in deb it is the same:
http://packages.debian.org/sid/liblwgeom-2.0.3

 For labeling, I don't think we would want to introduce Python into the mix, 
 or
 require PostGIS to be installed. So, either C++ compiled-in or shared lib 
 support
 would be best (for the speed).

agreed

 Do you have some links to any notes on how this was done using the PostGIS 
 source
 code? I'd like to make that library available for the Mac builds and pass 
 the notes
 along to others.

coming soon

thanks.
- -- 
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iEYEARECAAYFAlHv//sACgkQ/NedwLUzIr4Y9wCfZm9hqdp2EcnBVShAbleg0DpW
tMYAnR6S/thBQW/9XfWQekRZPAF2wYNZ
=BSK3
-END PGP SIGNATURE-
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Labels on topologically wrong polygons

2013-07-24 Thread aperi2007

On 24/07/2013 17:55, Larry Shaffer wrote:
I think QGIS should offer the option to on-the-fly try to fix those 
geometries. This was discussed previously [0]


The MakeValid is not a fast process.
Try to apply it on-the-fly will slow again the labelling flow.

Another problem is tht it could change little , but not less important, 
part of a geometry.

so if the user will decide to edit it .
Instead of editing the original geometry it will edit a changed geometry.
And save in the shapefile (o r other container) another more changed 
geometry.


Don't forgot that the original ST_MakeValid of postgis (and also 
spatialite) will return also the

removed parts of original geometry. (point , arc or other it was)

To not lost of view the original geometry.

___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Labels on topologically wrong polygons

2013-07-24 Thread Larry Shaffer
Hi,

On Wed, Jul 24, 2013 at 11:04 AM, aperi2007 aperi2...@gmail.com wrote:

 On 24/07/2013 17:55, Larry Shaffer wrote:

 I think QGIS should offer the option to on-the-fly try to fix those
 geometries. This was discussed previously [0]


 The MakeValid is not a fast process.
 Try to apply it on-the-fly will slow again the labelling flow.


Yes, but only for those features that are tested to be invalid (already
done). Also, as I noted, this should be optional, and probably disabled by
default.



 Another problem is tht it could change little , but not less important,
 part of a geometry.
 so if the user will decide to edit it .
 Instead of editing the original geometry it will edit a changed geometry.
 And save in the shapefile (o r other container) another more changed
 geometry.


The labeling engine sends to the backend PAL library *copies* of the
feature geometries. So, the original geometry is never edited, i.e. the
copy would be what is run through ST_MakeValid. Once the labels are
created, those copied geometries are dumped and never rendered on the
canvas.

There should probably be some logging somewhere, if the geometry is
invalid, but usually the copied geometry has been clipped to the extent
rectangle. In other words, invalid geometries of the copies at that point
have nothing to do with the original features, which may be valid. So,
logging invalids at that point doesn't make sense.



 Don't forgot that the original ST_MakeValid of postgis (and also
 spatialite) will return also the
 removed parts of original geometry. (point , arc or other it was)


This could be an issue, where a multi-geometry is return for a single
input. It seems this could be overcome with some checks, and eventually
fallback to rejecting the geometry, if necessary.



 To not lost of view the original geometry.


Sorry. I don't understand your meaning here.


Regards,

Larry



 __**_
 Qgis-developer mailing list
 Qgis-developer@lists.osgeo.org
 http://lists.osgeo.org/**mailman/listinfo/qgis-**developerhttp://lists.osgeo.org/mailman/listinfo/qgis-developer

___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Labels on topologically wrong polygons

2013-07-24 Thread Larry Shaffer
Hi Paolo,

On Wed, Jul 24, 2013 at 10:25 AM, Paolo Cavallini cavall...@faunalia.itwrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Il 24/07/2013 18:21, Larry Shaffer ha scritto:

  But that just wraps the C++ library with Python doesn't? (Very nice,
 btw!) That still
  requires a full install of PostGIS/PostgreSQL (at this time):

 not, we have compiled it as standalone; in deb it is the same:
 http://packages.debian.org/sid/liblwgeom-2.0.3

  For labeling, I don't think we would want to introduce Python into the
 mix, or
  require PostGIS to be installed. So, either C++ compiled-in or shared
 lib support
  would be best (for the speed).

 agreed

  Do you have some links to any notes on how this was done using the
 PostGIS source
  code? I'd like to make that library available for the Mac builds and
 pass the notes
  along to others.

 coming soon


Actually, I hadn't tested building the standalone Mac liblwgeom.dylib since
PostGIS 2.0.3 came out. I was able to easily build the .dylib for both
2.0.3 and with current source trunk. Trunk appears to now require the
json-c lib, which was not part of the Kyngchaos framework installs, but is
readily available via homebrew.

So, it fairly simple to compile and include liblwgeom-2.0.3.dylib (422 KB)
with Mac bundled app builds, once it is utilized directly in QGIS code.
Very nice, indeed, for geometry repairing routines!

William, here is what I did [0]. Please let me know if there is something I
am missing in the build steps that might cause issues for use in a bundled
QGIS. Thanks.

[0] http://drive.dakotacarto.com/qgis/liblwgeom.dylib-build.txt

Regards,

Larry




 thanks.
 - --
 Paolo Cavallini - Faunalia
 www.faunalia.eu
 Full contact details at www.faunalia.eu/pc
 Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.12 (GNU/Linux)
 Comment: Using GnuPG with Icedove - http://www.enigmail.net/

 iEYEARECAAYFAlHv//sACgkQ/NedwLUzIr4Y9wCfZm9hqdp2EcnBVShAbleg0DpW
 tMYAnR6S/thBQW/9XfWQekRZPAF2wYNZ
 =BSK3
 -END PGP SIGNATURE-

___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Labels on topologically wrong polygons

2013-07-24 Thread Andrea Peri
2013/7/24 Larry Shaffer lar...@dakotacarto.com

 Hi,

 On Wed, Jul 24, 2013 at 11:04 AM, aperi2007 aperi2...@gmail.com wrote:

 On 24/07/2013 17:55, Larry Shaffer wrote:

 I think QGIS should offer the option to on-the-fly try to fix those
 geometries. This was discussed previously [0]


 The MakeValid is not a fast process.
 Try to apply it on-the-fly will slow again the labelling flow.


 Yes, but only for those features that are tested to be invalid (already
 done). Also, as I noted, this should be optional, and probably disabled by
 default.


Agree.



 Another problem is tht it could change little , but not less important,
 part of a geometry.
 so if the user will decide to edit it .
 Instead of editing the original geometry it will edit a changed geometry.
 And save in the shapefile (o r other container) another more changed
 geometry.


 The labeling engine sends to the backend PAL library *copies* of the
 feature geometries. So, the original geometry is never edited, i.e. the
 copy would be what is run through ST_MakeValid. Once the labels are
 created, those copied geometries are dumped and never rendered on the
 canvas.

 There should probably be some logging somewhere, if the geometry is
 invalid, but usually the copied geometry has been clipped to the extent
 rectangle. In other words, invalid geometries of the copies at that point
 have nothing to do with the original features, which may be valid. So,
 logging invalids at that point doesn't make sense.


ok, your idea is more sophisticated.





 Don't forgot that the original ST_MakeValid of postgis (and also
 spatialite) will return also the
 removed parts of original geometry. (point , arc or other it was)


 This could be an issue, where a multi-geometry is return for a single
 input. It seems this could be overcome with some checks, and eventually
 fallback to rejecting the geometry, if necessary.


The MakeValid is capable to resolve very complex situations, the main goal
is never lost any vertex. So the MakeValid in the Postgs often could return
a geometrycollection with one, two or three parts (polygons, linea and
points).

As example when the invalidity is a line inside a polygon (this is quite
normal when the geometries came from cad systems), the MakeValid will
create a collection with the polygon and a line. In Spatialite instead the
collection are not so flexible so the solution was to wrap the MakeValid on
two distinct functions:
MakeValid() and MakeValidDiscarded.



 To not lost of view the original geometry.


 Sorry. I don't understand your meaning here.



Sorry, I was unable to explain.

Simply I want say that the main goal of the MakeValid was to resolve an
invalidity withoun lost any vertex of the original geometry.

In spatialite where the collection are no so flexible.
The solution was to support two functions one to return the higher level
geometry (usually the more interesting to see) and another function
(MakeValidDiscarded) to return the lower level geometries.

But this mean that using only the ST_MakeValid() in spatialite without see
what return the MakeValidDiscarded Function could mean to lost something.

Regards,

Andrea.



 Regards,

 Larry



 __**_
 Qgis-developer mailing list
 Qgis-developer@lists.osgeo.org
 http://lists.osgeo.org/**mailman/listinfo/qgis-**developerhttp://lists.osgeo.org/mailman/listinfo/qgis-developer





-- 
-
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Labels on topologically wrong polygons

2013-07-24 Thread Paolo Cavallini
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Il 25/07/2013 01:57, William Kyngesburye ha scritto:

 If liblwgeom becomes a requirement for QGIS, I'll certainly be packaging it 
 with
 QGIS, and adding instructions to INSTALL.

it is not a requirement, but it wouold be good if you could include it anyway, 
to let
osx users enjoy our plugin.

 It probably requires a full install of Postgres.

it should not; at least, o win and deb this is not the case.

re: this discussion, see also: http://hub.qgis.org/issues/4079

all the best, and thanks.
- -- 
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iEYEARECAAYFAlHwtSwACgkQ/NedwLUzIr6vyACgoAuq2d67cNsuxcgITMu+jmNB
mp4An0wM13qFGdAuMhgpsTTd44SZ4Qth
=0Bk4
-END PGP SIGNATURE-
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer