Re: [QGIS-Developer] Convert from mapunits to pixels

2017-11-10 Thread Tom Chadwin
Because this conversion will not take place in QGIS but elsewhere, I need the
underlying maths for the conversion, not the API method. I've now found the
formula for EPSG:3857, and a method for all projections which works in
Leaflet, here:

https://stackoverflow.com/questions/27545098/leaflet-calculating-meters-per-pixel-at-zoom-level

Thanks

Tom



-
Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon 
--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html
___
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] discuss: What's our development gameplan for 3.0 and above?

2017-11-10 Thread Nyall Dawson
On 10 November 2017 at 09:43, Luigi Pirelli  wrote:
> super +1, I follow the same rule.
> We should add rule for that methods that require pyqt bindings... e.g.
> any API should use and return QT containers (just to simplify type
> mapping)

Agreed.

Also very remember to remember that in any case where the implicit
sharing is beneficial we should still return a Qt container
(preferably QVector, using only QList if the container has come from a
Qt method or needs to be consumed by a Qt method which uses QList).

The "TLDW" for interested parties:
- Qt containers (qlist, qvector, qmap, etc) are unmaintained, They
won't be removed by upstream, but you shouldn't use them if you have a
choice
- QList is absolute rubbish and should never be used, unless you're
forced to by Qt API. It's likely to be killed in Qt 6 (becoming just
an alias for QVector)

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] QGis3: QgsLayerMetadata usage from QgsDataProvider to QgsMapLayer ?

2017-11-10 Thread Nyall Dawson
On 10 November 2017 at 18:15, Mark Johnson  wrote:
> My assumption is that it a Provider would be a major source to gather the
> needed information an set QgsLayerMetadata.
> I am doing this now for the new QgsSpatiaLiteProvider.
>
> QgsDataProvider does not contain (at present) a mMetadata; member as
> QgsMapLayer does.
>
> So when setDataProvider runs in QgsVectorLayer and QgsRasterLayer, any
> Metadata gathered by a provider (in the form of QgsLayerMetadata) cannot be
> set.
>
> So the practical usage of QgsLayerMetadata is not quite complete.
>
> https://github.com/qgis/QGIS-Enhancement-Proposals/issues/91

The proper metadata storage/retrieval is not yet implemented. In
master currently there's a very limited (i.e. hack) support for
storing and loading metadata from the current project, but it's really
just a temporary measure.

See https://github.com/qgis/QGIS/pull/5379 for the first stage in real
metadata storage and retrieval. I'd see how that PR is done, and then
make your comments there.

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] Convert from mapunits to pixels

2017-11-10 Thread Nyall Dawson
On 10 November 2017 at 02:26, Tom Chadwin  wrote:
> Hello all
>
> I've never implemented support of any unit other than pixels in my plugin. A
> particular use case (vector tiles) could really use mapunits. Can someone
> explain (or point me towards) the method for converting from mapunits to
> pixels for on-screen rendering?

Have you got access to a QgsRenderContext? (If not, you can create one
from a QgsMapSettings by QgsRenderContext::fromMapSettings)

After you've got the render context you can use

- QgsRenderContext::convertFromMapUnits to convert from map units to
any other unit (including pixels, mm, etc)
- QgsRenderContext::convertToMapUnits to convert from any unit
(including pixels and mm) to map units

(That's 3.0 API)

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] pyqgis: adding features to SQLite layer

2017-11-10 Thread Martin Landa
Hi,

I found difference when adding features (addFeature) to SQLite layer
in QGIS 2.14 and 2.18.

In QGIS 2.14 ogc_fid (primary key) column in not shown in attribute
table. Feature ID does not need to be set, by adding feature the
ogc_fid sequence is automatically incremented. Everything works, first
feature has ogc_fid set to 0, second to 1, etc.

In QGIS 2.18 ogc_fid column in show in attribute table. Adding feature
is failing on same ogc_fid value, in other words, the ogc_fid value is
not autoincremented. Even feature.setFeatureId() do not help. I solved
it by adding ogc_fid value to the list of values passed to
feature.setAttributes(). Then features are finally added to the layer.

Is it really needed in QGIS 2.18 to add ogc_fid value to attributes? I
would assume that this value is set by feature id or autoincremented.
And I also wonder why setFeatureId() does not work.

Thanks for clarification. Martin

-- 
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa
___
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 [1072] wps4server approval notification.

2017-11-10 Thread noreply

Plugin wps4server approval by pcav.
The plugin version "[1072] wps4server 1.0.7" is now approved
Link: http://plugins.qgis.org/plugins/wps4server/
___
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] Convert from mapunits to pixels

2017-11-10 Thread Michel Stuyts
That's because it's a QGIS 3 plugin. It had a wrong qgisMinimumVersion in the 
metadata in the previous versions.


Michel

-Oorspronkelijk bericht-
Van: QGIS-Developer [mailto:qgis-developer-boun...@lists.osgeo.org] Namens Tom 
Chadwin
Verzonden: vrijdag 10 november 2017 12:23
Aan: qgis-developer@lists.osgeo.org
Onderwerp: Re: [QGIS-Developer] Convert from mapunits to pixels

By the way, I couldn't load go2mapillary in 2.18.14 via the plugin manager - I 
get "cannot import name QgsDataSourceUri".

Thanks

Tom



-
Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon
--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html
___
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 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] Convert from mapunits to pixels

2017-11-10 Thread Enrico Ferreguti
did you noticed QgsMapCanvas.mapUnitsPerPixel
()
?
then
lenght in pixels = lenght in mapunits / mapUnitsPerPixel

()

2017-11-10 13:27 GMT+01:00 Enrico Ferreguti :

> It's a QGIS3 plugin, I have not yet understood how to exclude QGIS2 from
> plugin search.
>
> 2017-11-10 13:26 GMT+01:00 Enrico Ferreguti :
>
>> It's a QGIS3 plugin, I have not yet understood how to exclude QGIS2 from
>> plugin search.
>>
>> 2017-11-10 12:22 GMT+01:00 Tom Chadwin :
>>
>>> By the way, I couldn't load go2mapillary in 2.18.14 via the plugin
>>> manager -
>>> I get "cannot import name QgsDataSourceUri".
>>>
>>> Thanks
>>>
>>> Tom
>>>
>>>
>>>
>>> -
>>> Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon
>>> --
>>> Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.
>>> html
>>> ___
>>> 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 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] Convert from mapunits to pixels

2017-11-10 Thread Enrico Ferreguti
It's a QGIS3 plugin, I have not yet understood how to exclude QGIS2 from
plugin search.

2017-11-10 13:26 GMT+01:00 Enrico Ferreguti :

> It's a QGIS3 plugin, I have not yet understood how to exclude QGIS2 from
> plugin search.
>
> 2017-11-10 12:22 GMT+01:00 Tom Chadwin :
>
>> By the way, I couldn't load go2mapillary in 2.18.14 via the plugin
>> manager -
>> I get "cannot import name QgsDataSourceUri".
>>
>> Thanks
>>
>> Tom
>>
>>
>>
>> -
>> Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon
>> --
>> Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.
>> html
>> ___
>> 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 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] Convert from mapunits to pixels

2017-11-10 Thread Tom Chadwin
By the way, I couldn't load go2mapillary in 2.18.14 via the plugin manager -
I get "cannot import name QgsDataSourceUri".

Thanks

Tom



-
Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon 
--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html
___
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] Convert from mapunits to pixels

2017-11-10 Thread Tom Chadwin
Thanks for the link - this looks relevant:

map_units_per_pixel = (wgs84_maximum.x() -
wgs84_minimum.x())/self.iface.mapCanvas().width()

To explain more fully, my plugin exports QGIS projects as webmaps. I am
working on Leaflet webmaps at the moment, and, as far as I can see, Leaflet
only supports styling (point feature radius, stroke width etc) in pixels.
The plugin therefore works when styling units are pixels, but fails if they
are mapunits.

I therefore need to understand how QGIS (or whatever) calculates the pixel
dimensions for something on screen when the QGIS units are mapunits. In
other words, some formula for converting map units to pixels (presumably
involving scale/zoom as a parameter).

Hope this makes sense

Tom



-
Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon 
--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html
___
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] Convert from mapunits to pixels

2017-11-10 Thread Enrico Ferreguti
Hi Tom, I'm not sure to understand your problem, I point you to the
function that downloads vector tiles from mapillary doing that conversion:
https://github.com/enricofer/go2mapillary/blob/6c452b768e8bf8264516f27db33b1e6c690ada48/mapillary_coverage.py#L139

2017-11-09 17:26 GMT+01:00 Tom Chadwin :

> Hello all
>
> I've never implemented support of any unit other than pixels in my plugin.
> A
> particular use case (vector tiles) could really use mapunits. Can someone
> explain (or point me towards) the method for converting from mapunits to
> pixels for on-screen rendering?
>
> Thanks
>
> Tom
>
>
>
> -
> Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon
> --
> Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-
> f4099106.html
> ___
> 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 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] missing *load* button in raster style?

2017-11-10 Thread matteo
Hi devs,

I just compiled the master branch and I noticed that in the style tab
for raster layer, I can change the min/max values (with default options
+ user defined) but I cannot see the *load values* button.

even when clicking on apply the min/max values don't change.

Am I missing something?

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

[QGIS-Developer] QGis3: QgsLayerMetadata usage from QgsDataProvider to QgsMapLayer ?

2017-11-10 Thread Mark Johnson
My assumption is that it a Provider would be a major source to gather the
needed information an set QgsLayerMetadata.
I am doing this now for the new QgsSpatiaLiteProvider.

QgsDataProvider does not contain (at present) a mMetadata; member as
QgsMapLayer does.

So when setDataProvider runs in QgsVectorLayer and QgsRasterLayer, any
Metadata gathered by a provider (in the form of QgsLayerMetadata) cannot be
set.

So the practical usage of QgsLayerMetadata is not quite complete.

https://github.com/qgis/QGIS-Enhancement-Proposals/issues/91

---
Also there seems to be, alternative and different, 'metadata' still in
place - preventing an unified way of dealing with metadata:

QgsRasterDataProvider has a QString based  metadata() function
- virtual QString metadata() = 0;
QgsVectorDataProvider has a  QVariantMap metadata() function
- virtual QVariantMap metadata() const { return QVariantMap(); }
___
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