[QGIS-Developer] how to add mbtiles data

2018-03-28 Thread weskerjiang
I'm creating an standalone application with QGIS 3.0,I want to add mbtiles 
data,I use 
QgsRasterLayer *layer = new QgsRasterLayer(filePath,fileName,"gdal");
but layer->isValid()is  false,the error has two messages
1.Cannot open GDAL dataset, "c:\XX\*.mbtiles" not recognized as a supported 
file format.
2.Provider is not valid(provider:gdal)

so what's wrong with 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] Call for upgrade of Qt library in osgeo4w to 5.10.1

2018-03-28 Thread Nyall Dawson
Hi all/Jürgen,

I'd like to raise a call for the version of Qt in osgeo4w and the QGIS
windows builds to be upgraded to 5.10.1 (or at least 5.9.4).

I've been watching the bug tracker following the release of 3.0 and
trying to fix crashes where I can, but there's a LOT of strange crash
reports coming from deep within Qt internals on the windows builds.

E.g.

https://issues.qgis.org/issues/18566
https://issues.qgis.org/issues/18528
https://issues.qgis.org/issues/18498
https://issues.qgis.org/issues/18483
https://issues.qgis.org/issues/18570
https://issues.qgis.org/issues/18569
https://issues.qgis.org/issues/18260
https://issues.qgis.org/issues/18548 (this is a duplicate of 18260)
https://issues.qgis.org/issues/18470
https://issues.qgis.org/issues/18460
https://issues.qgis.org/issues/18306

I'm at a loss how to proceed with these, and I'd like to rule out
underlying issues in Qt as the cause. I've also personally seen many
crashes with the 3d functionality on windows (again, from deep within
Qt3d internals), which I believe are usually caused by graphics card
drivers... BUT... Qt3d is a relatively new component and I'm sure
we're missing many upstream fixes by not running on 5.10.1/5.9.4.

Would you be in favour of bumping the version?

Cheers,
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

Re: [QGIS-Developer] Problem with symbology rule containing @atlas_featureid

2018-03-28 Thread Nyall Dawson
On 26 March 2018 at 14:40, Nyall Dawson  wrote:
> On 24 March 2018 at 10:22, Nyall Dawson  wrote:
>> On 23 March 2018 at 22:47, Andreas Neumann  wrote:
>>> Hi,
>>>
>>> I noticed a big problem in the rule based renderer when PostgreSQL layers
>>> are involved and the rule contains @atlas_featureid.
>>>
>>> As an example, I use this rule:
>>>
>>> $id != @atlas_featureid
>>>
>>> When I click on the "Test" button I get "Filter returned  features". So
>>> far so good. But the bad thing: nothing is drawn on the canvas!
>>>
>>> Could it be that the expression compiler tries to forward this query, but
>>> PostgreSQL knows nothing about @atlas_featurid ?
>>>
>>> Can someone confirm that this really is the case before I file an issues
>>> report?
>>
>> Confirmed - think I can see an easy fix for this.
>
> I take that back - I'd made a mistake. Can you open a ticket and share
> a project demonstrating this?
>

For future reference, this is fixed now. It was caused by the canvas
initially having the @atlas_featureid variable having a null value
(until an atlas is opened), so the expression was effectively $id !=
NULL (which is always false).

In contrast the Test button would set a @atlas_featureid to 0 if a
real feature id wasn't available - so it was reporting matching
features.

Now the canvas uses the same approach as the test button and defaults
@atlas_featureid to 0 if it's not yet set.

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

Re: [QGIS-Developer] QgsPrintLayout Setup from PyQGIS 3

2018-03-28 Thread Nyall Dawson
On 29 March 2018 at 08:03, Nyall Dawson  wrote:
> On 27 March 2018 at 23:55, Brian Libgober  wrote:
>> I am interested in making reproducible PDF figures in QGIS3, and therefore
>> want to work from the console/PyQGIS. Thanks to some previous helpful advice
>> here, the problem is successfully reduced to setting up the QgsPrintLayout.
>> I am not sure how to do this, below is my best attempt so far:
>>
>> #setup the background classes for managing the project
>> canvas =iface.mapCanvas()
>> manager = project.layoutManager()
>> #new layout
>> layout = QgsPrintLayout(project)
>> layout.initializeDefaults()
>> layout.setName('console')
>> itemMap = QgsLayoutItemMap(layout)
>> itemMap.setExtent(canvas.extent())
>> layout.addLayoutItem(itemMap)
>> #add the layout to the manager
>> manager.addLayout(layout)
>>
>> The "console" layout is successfully added to QGIS 3 and I can open it to
>> see if the content is satisfactory. The map does not render and its extent
>> is nan,nan,nan,nan. How do I setup the extent and size of the map object in
>> the layout?
>>
>
> I answered over on stackexchange too, but for completeness:
>
> You need to set a size for the map item (usually you do this before
> setting the extent):
>
> itemMap.attemptResize(QgsLayoutSize(50, 60, QgsUnitTypes.LayoutMillimeters))
> itemMap.attemptMove(QgsLayoutPoint(1,2,QgsUnitTypes.LayoutMillimeters))
> itemMap.setExtent(...)
>
> This is because the call to setExtent uses the item size for various
> scale and aspect ratio calculations, and initially a new item is
> created with an empty size.

Also, you may want to consider using zoomToExtent(...) instead -
setExtent can change the item's size to ensure that the map item
matches the aspect ratio of the extent, whereas zoomToExtent will
never resize the item and instead zooms out the extent until it fits
completely within the existing item size.

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

Re: [QGIS-Developer] QgsPrintLayout Setup from PyQGIS 3

2018-03-28 Thread Nyall Dawson
On 27 March 2018 at 23:55, Brian Libgober  wrote:
> I am interested in making reproducible PDF figures in QGIS3, and therefore
> want to work from the console/PyQGIS. Thanks to some previous helpful advice
> here, the problem is successfully reduced to setting up the QgsPrintLayout.
> I am not sure how to do this, below is my best attempt so far:
>
> #setup the background classes for managing the project
> canvas =iface.mapCanvas()
> manager = project.layoutManager()
> #new layout
> layout = QgsPrintLayout(project)
> layout.initializeDefaults()
> layout.setName('console')
> itemMap = QgsLayoutItemMap(layout)
> itemMap.setExtent(canvas.extent())
> layout.addLayoutItem(itemMap)
> #add the layout to the manager
> manager.addLayout(layout)
>
> The "console" layout is successfully added to QGIS 3 and I can open it to
> see if the content is satisfactory. The map does not render and its extent
> is nan,nan,nan,nan. How do I setup the extent and size of the map object in
> the layout?
>

I answered over on stackexchange too, but for completeness:

You need to set a size for the map item (usually you do this before
setting the extent):

itemMap.attemptResize(QgsLayoutSize(50, 60, QgsUnitTypes.LayoutMillimeters))
itemMap.attemptMove(QgsLayoutPoint(1,2,QgsUnitTypes.LayoutMillimeters))
itemMap.setExtent(...)

This is because the call to setExtent uses the item size for various
scale and aspect ratio calculations, and initially a new item is
created with an empty size.

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

Re: [QGIS-Developer] PyQGIS - how to handle primary keys in geopackage

2018-03-28 Thread Nyall Dawson
On 28 March 2018 at 08:32, Alexandre Neto  wrote:
> My multipart split plugin (which I am porting to 3), It breaks multipart
> features and transforms each part in individual features, copying the
> attributes from the original feature.
>
> In the process, I need to be careful with the autoincrement primary keys.
> For PostGIS and Spatialite, asking for the providers pkattributesindex works
> and I can do the following:
>
> new_attributes = feature.attributes()
>
> # When attribute is a Primary Key, replace by default value
> ### This is not working well with spatialite provider###
> for j in provider.pkAttributeIndexes():
> if provider.defaultValue(j):
> new_attributes[j] = provider.defaultValue(j)
> else:
> new_attributes[j] = QVariant()
>
> But for geopackage the provider.pkAttributeIndexes() always returns an empty
> list...
>
> The above code was copied a long time ago from the split features tools in
> core. Looking at the code now, there is no longer that part where the
> provider's primary keys are searched, Nevertheless, the code works and the
> split features tool leave the pkattributes NULL to be autogenerated. Wasn't
> able to figure out where that is done now ...

The canonical/correct 3.0 way to do this is to use
QgsVectorLayerUtils.createFeature

That method should be used whenever you are creating a brand new
feature which is destined for a particular vector layer, and needs to
correctly respect constraints and default value clauses set on the
provider side.

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

Re: [QGIS-Developer] Error during compilation

2018-03-28 Thread matteo
sorry guys, wrong gdal path added

sorry for the noise

Matteo
___
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] Error during compilation

2018-03-28 Thread matteo
Hi devs,

I get this error during the compilation.. any suggestion?

CMakeFiles/qgis_core.dir/qgsogrutils.cpp.o: In function
`QgsOgrUtils::getOgrFeatureAttribute(void*, QgsFields const&, int,
QTextCodec*, bool*)':
qgsogrutils.cpp:(.text+0x724): undefined reference to
`OGR_F_IsFieldSetAndNotNull'
CMakeFiles/qgis_core.dir/qgsvectorfilewriter.cpp.o: In function
`QgsVectorFileWriter::createFeature(QgsFeature const&)':
qgsvectorfilewriter.cpp:(.text+0x5149): undefined reference to
`OGR_F_SetFieldNull'
collect2: error: ld returned 1 exit status
src/core/CMakeFiles/qgis_core.dir/build.make:17452: recipe for target
'output/lib/libqgis_core.so.3.1.0' failed
make[2]: *** [output/lib/libqgis_core.so.3.1.0] Error 1
CMakeFiles/Makefile2:1243: recipe for target
'src/core/CMakeFiles/qgis_core.dir/all' failed
make[1]: *** [src/core/CMakeFiles/qgis_core.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2


Thanks

Matteo
___
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] issues in QGIS Server 2,18

2018-03-28 Thread Giovanni Manghi
Hi all,


>> I have found the reason why QGIS Server 2.18 and probably 3 are slower
>> than 2.14 in generating GeoJSON.
>> I'll fix it.


I discovered two more WFS related issues, one in QGIS Desktop the
other in the Server.

I setup a WFS service, with both QGIS Server 2.18 and Mapserver, with
a layer than contains 5.6million points.
The QGIS WFS client pulls this layer without issues, but there is a
big problem when identifying features with the option "auto open form"
enabled:
on the second identify operation QGIS freezes and it start to leak
memory until it eats it all. It does not happen if the "auto open
form" option is not enabled. This happens also on QGIS 3.

The second issue is about the same dataset published as WFS with QGIS
Server, when saving the layer using QGIS using "save as" (for example
to a geopackage) the result is missing several features/points.
I tried then to save the layer using ogr from th CLI, and at some
point the message "ERROR 1: XML parsing of GML file failed : unclosed
token at line 109413441, column 21" is shown. This is not happening
(and the result is complete) if server used is Mapserver.

I can provide the services URLs is someone wants to give it a try.


cheers!

-- G --
___
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] Plugin [1430] HCMGIS approval notification.

2018-03-28 Thread noreply

Plugin HCMGIS approval by zimbogisgeek.
The plugin version "[1430] HCMGIS 2018.1.2" is now approved
Link: http://plugins.qgis.org/plugins/HCMGIS/
___
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] Plugin [1432] AustrianElevation approval notification.

2018-03-28 Thread noreply

Plugin AustrianElevation approval by zimbogisgeek.
The plugin version "[1432] AustrianElevation 2.0" is now approved
Link: http://plugins.qgis.org/plugins/AustrianElevation/
___
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] Plugin [1431] Parallel Line Construction approval notification.

2018-03-28 Thread noreply

Plugin Parallel Line Construction approval by zimbogisgeek.
The plugin version "[1431] Parallel Line Construction 0.1 Experimental" is now 
approved
Link: http://plugins.qgis.org/plugins/ParallelLineConstruction/
___
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