Re: [QGIS-Developer] compare failing/succeeding CI builds (how to?)

2020-03-17 Thread Sandro Santilli
On Wed, Mar 18, 2020 at 04:46:22AM +1000, Nyall Dawson wrote:
> On Wed, 18 Mar 2020 at 04:31, Sandro Santilli  wrote:

> >   GEOS exception: IllegalArgumentException: Points of LinearRing do not 
> > form a closed linestring
> >   ...
> >   ERROR 6: EPSG PCS/GCS code 7992 not found in EPSG support files.  Is this 
> > a valid EPSG coordinate system?
> 
> These warnings are expected -- the tests include a lot of non-valid
> data (for testing purposes!)

Thanks, that thelps.

> > FAIL: test_algorithms:20
> > 'Find projection', {'algorithm': 'qgis:findprojection', 'name': 
> > 'Find projectio (__main__.TestQgisAlgorithms3)
> > 
> > --
> > Traceback (most recent call last):
> > File 
> > "/root/QGIS/python/plugins/processing/tests/AlgorithmsTestBase.py", line 
> > 154, in check_algorithm
> > self.check_results(results, context, parameters, 
> > defs['results'])
> > File 
> > "/root/QGIS/python/plugins/processing/tests/AlgorithmsTestBase.py", line 
> > 333, in check_results
> > self.assertLayersEqual(expected_lyrs[0], 
> > result_lyr, compare=compare, pk=pk, geometry={'topo_equal_check': 
> > topo_equal_check})
> > File 
> > "/root/QGIS/build/output/python/qgis/testing/__init__.py", line 57, in 
> > assertLayersEqual
> > self.checkLayersEqual(layer_expected, layer_result, 
> > True, **kwargs)
> > File 
> > "/root/QGIS/build/output/python/qgis/testing/__init__.py", line 96, in 
> > checkLayersEqual
> > _TestCase.assertEqual(self, 
> > layer_expby_location_summary_date.gml'}
> >
> 
> This one not expected. What gdal/proj version do you use?

I'm reporting what Travis says, so whatever GDAL/PROJ version is
running on Travis. This is the run of this PR:
https://github.com/qgis/QGIS/pull/31980

--strk;
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] compare failing/succeeding CI builds (how to?)

2020-03-17 Thread Nyall Dawson
On Wed, 18 Mar 2020 at 04:31, Sandro Santilli  wrote:
>
> My long-standing PR about preventing testsuite run from changing
> files in source tree is currently having a Travis failure which
> seems to start with:
>
> ProcessingQgisAlgorithmsTestPt3
>
> Trying to understand what's going wrong with that test I see a lot
> of warnings/errors being printed, like:
>
>   GEOS exception: IllegalArgumentException: Points of LinearRing do not form 
> a closed linestring
>   ...
>   ERROR 6: EPSG PCS/GCS code 7992 not found in EPSG support files.  Is this a 
> valid EPSG coordinate system?

These warnings are expected -- the tests include a lot of non-valid
data (for testing purposes!)

>
> And eventually the actual failure printed in yellow:
>
> FAIL: test_algorithms:20
> 'Find projection', {'algorithm': 'qgis:findprojection', 'name': 'Find 
> projectio (__main__.TestQgisAlgorithms3)
> --
> Traceback (most recent call last):
> File 
> "/root/QGIS/python/plugins/processing/tests/AlgorithmsTestBase.py", line 154, 
> in check_algorithm
> self.check_results(results, context, parameters, 
> defs['results'])
> File 
> "/root/QGIS/python/plugins/processing/tests/AlgorithmsTestBase.py", line 333, 
> in check_results
> self.assertLayersEqual(expected_lyrs[0], result_lyr, 
> compare=compare, pk=pk, geometry={'topo_equal_check': topo_equal_check})
> File 
> "/root/QGIS/build/output/python/qgis/testing/__init__.py", line 57, in 
> assertLayersEqual
> self.checkLayersEqual(layer_expected, layer_result, 
> True, **kwargs)
> File 
> "/root/QGIS/build/output/python/qgis/testing/__init__.py", line 96, in 
> checkLayersEqual
> _TestCase.assertEqual(self, 
> layer_expby_location_summary_date.gml'}
>

This one not expected. What gdal/proj version do you use?

Nyall
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

[QGIS-Developer] compare failing/succeeding CI builds (how to?)

2020-03-17 Thread Sandro Santilli
My long-standing PR about preventing testsuite run from changing
files in source tree is currently having a Travis failure which
seems to start with:

ProcessingQgisAlgorithmsTestPt3

Trying to understand what's going wrong with that test I see a lot
of warnings/errors being printed, like:

  GEOS exception: IllegalArgumentException: Points of LinearRing do not form a 
closed linestring
  ...
  ERROR 6: EPSG PCS/GCS code 7992 not found in EPSG support files.  Is this a 
valid EPSG coordinate system?

And eventually the actual failure printed in yellow:

FAIL: test_algorithms:20
'Find projection', {'algorithm': 'qgis:findprojection', 'name': 'Find 
projectio (__main__.TestQgisAlgorithms3)
--
Traceback (most recent call last):
File 
"/root/QGIS/python/plugins/processing/tests/AlgorithmsTestBase.py", line 154, 
in check_algorithm
self.check_results(results, context, parameters, 
defs['results'])
File 
"/root/QGIS/python/plugins/processing/tests/AlgorithmsTestBase.py", line 333, 
in check_results
self.assertLayersEqual(expected_lyrs[0], result_lyr, 
compare=compare, pk=pk, geometry={'topo_equal_check': topo_equal_check})
File "/root/QGIS/build/output/python/qgis/testing/__init__.py", 
line 57, in assertLayersEqual
self.checkLayersEqual(layer_expected, layer_result, 
True, **kwargs)
File "/root/QGIS/build/output/python/qgis/testing/__init__.py", 
line 96, in checkLayersEqual
_TestCase.assertEqual(self, 
layer_expby_location_summary_date.gml'}

Running alg: "qgis:joinbylocationsummary"
Algorithm parameters are {'DISCARD_NONMATCHING': False, 'INPUT': 
'polys_gml_layername_polys2_4874fd51_2ea0_4a57_9c29_180f0d10efcc', 'JOIN': 
'custom_points_3857_gml_layername_points_3857_94fef703_91b6_4e6f_9a4a_4a26c1e3444f',
 'PREDICATE': [0], 'SUMMARIES': [], 'OUTPUT': 
'/tmp/tmpbtipmdek/join_by_location_summary_reproject.gml'}

Running alg: "qgis:joinbylocationsummary"
Algorithm parameters are {'DISCARD_NONMATCHING': False, 'INPUT': 
'custom_line_3857_gml_layername_line_3857_1f3feb18_ad23_4a7d_a11e_10f89e8499f7',
 'JOIN': 'polys_gml_layername_polys2_aa54703b_6b44_4977_ad0d_9819432a6ca1', 
'PREDICATE': [0], 'SUMMARIES': [], 'OUTPUT': 
'/tmp/tmpfc2zhzz8/join_by_location_line_to_polys_reproj.gml'}

Running alg: "native:extractbyextent"
Algorithm parameters are {'CLIP': False, 'EXTENT': 
'-1.1653,4.775,-2.444285714285715,3.4171428571428573', 'INPUT': 
'polys_gml_17f9a2e4_2ead_4455_97ac_739eb78a8836', 'OUTPUT': 
'/tmp/tmp31zgit2o/extract_bected.featureCount(), layer_result.featureCount())

AssertionError: 9 != 8
--

Now, as the test name mentions "projection" and one of the earlier errors are
about projections, I wanted to compare the failing run with the successful run
but the successful run is silent so I cannot compare. 

Would it make sense to enable verbosity on Travis for tests or should
I create a fake PR just for the sake of seeing those logs ?

Or more simply, can any other developers successfully running that
test let me know if those messages are printed ?

Thank you !

--strk;
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] QGIS "fast" mode

2020-03-17 Thread Julien Cabieces

Hi

>   If I understand correctly, I can change my patch to skip geometry
> type and srid check when they are saved in project already and when
> option "trust project" is switched on?
> (https://github.com/qgis/QGIS/pull/34738)

Yes, I think it looks like the appropriate way of doing it
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

[QGIS-Developer] [Processing][Question] Using Data defined proprieties

2020-03-17 Thread João Gaspar
Hi Devs,
I have a question about using data defined proprieties in algorithms. For
instance,
if I want to do a Buffer using a field with a distance column I can use the
data defined proprieties and choose the field with distance.

But when I want to use more than 1 layer and switch to batch processing
where I want to define the field with distance of each layer I can't use
this option.

I try to use the name of the field in the option Add Values by Expression
and Calculate by Expression but the batch processing always assumes a
default value (10).

In the case of SAGA and buffer algorithm, when you switch for batch
processing is possible to choose the field of distance per layer.

What am I'm doing wrong? Or This is expected behaviour?

Please let me know if you need more details.

Thank you for your time.

Best regards.
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

[QGIS-Developer] QgsProject.instance() in QGIS docker 3.10 crash

2020-03-17 Thread Etienne Trimaille
Hi,

I have setup some plugins with unittests using Docker.
I have followed the documentation :
https://github.com/qgis/QGIS/tree/master/.docker
to run them locally or/and on Travis.

This tests is working well using the QGIS 3.4 docker image :

class TestEditionDialog(unittest.TestCase):

def test_atlas_dialog(self):
"""Test atlas dialog."""
layer = QgsVectorLayer(plugin_test_data_path('lines.geojson'),
'lines', 'ogr')
QgsProject.instance().addMapLayer(layer)
self.assertTrue(layer.isValid())

But as soon as I start using a QGIS 3.10 docker image, QGIS crash.

test_atlas_dialog (lizmap.test.test_dialog_edition.TestEditionDialog)
Test atlas dialog. ... QGIS died on signal 11Test atlas dialog. ... QGIS
died on signal 11
Finished running test
qgis_plugin_tools.infrastructure.test_runner.test_package (codes: IS_DEAD=0
IS_FAILED=1 IS_PASSED=1).
root@1c7939c428c6:/tests_directory/lizmap#

By commenting the code, I noticed it's the `QgsProject.instance()` which
trigger the crash.
It tried quickly to replace by:

layer = QgsVectorLayer(plugin_test_data_path('lines.geojson'),
'lines', 'ogr')
project = QgsProject()
project.addMapLayer(layer)
self.assertTrue(layer.isValid())

It's working, the test is OK. But then, all my tests using a
QgsMapLayerComboBox are failing because the combobox is empty.

Does anyone confirm this kind of behaviour in their tests? Is-it a bug or
is-it another way to do tests using this docker image?

Regards,
Etienne
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

[QGIS-Developer] Saving selected features in a different projection

2020-03-17 Thread Ronald Römer
Hello,

this is my code:

---
id_ = 'my_layer_2bbd2539_97b3_417d_8a2a_97ec4f755a82'

crs = QgsCoordinateReferenceSystem()
crs.createFromString('epsg:4326')

crs2 = QgsCoordinateReferenceSystem()
crs2.createFromString('epsg:32632')

lay = QgsProject.instance().mapLayers()[id_]

lay.selectByExpression('"fclass" = \'{}\''.format(w))
new = processing.run('native:saveselectedfeatures', {'INPUT': lay,
'OUTPUT': 'memory:'})['OUTPUT']

opts = QgsVectorFileWriter.SaveVectorOptions()
opts.fileEncoding = 'UTF-8'
opts.driverName = 'ESRI Shapefile'
if os.path.exists('/home/rr/test.shp'):
opts.actionOnExistingFile =
QgsVectorFileWriter.ActionOnExistingFile.AppendToLayerAddFields # important

ctx = QgsCoordinateTransformContext()
ctx.addCoordinateOperation(crs, crs2, '', False)

err = QgsVectorFileWriter.writeAsVectorFormatV2(new, '/home/rr/test.shp',
ctx, opts)

lay.removeSelection()
---

The result still has WGS84-coordinates. What I'm doing wrong?

I can't use native:reprojectlayer because I need the append-feature from
the QgsVectorFileWriter.
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer