[Qgis-user] styled vector to raster layer
Andreas Plesch
andreasplesch at netscape.net
Wed May 31 13:20:38 PDT 2017
Hi Matthias,
well, while I could install qgis2compat, QFieldSync installation now
results in a broken plugin warning:
The plugin is broken. Python said:
cannot import name QtWidgets
I do have the PyQt5 QtWidgets module installed. However, I am not sure if
Qgis 2.18.3 can find it since it otherwise only uses PyQt4 ? PyQt4 does
not seem to have a QtWidgets module. Is there perhaps an environmental
variable to set ? Anything I can check ?
-Andreas
On Wed, May 31, 2017 at 2:14 PM, Andreas Plesch <andreasplesch at netscape.net>
wrote:
> Hi Matthias,
>
> sounds like exactly what I need. Unfortunately, QFieldSync depends on
> qgis2compat which in turn wants to use the QtTest PyQt module which
> apparently I do not have. Ah, my default PyQt4 was compiled and installed
> without QtTest, will just need to reinstall. Perhaps of interest that not
> all systems come with QtTest by default.
>
> I looked at https://github.com/opengisch/qfieldsync a bit, perhaps I can
> extract the relevant parts.
>
> Thanks, I would never have discovered this by myself,
>
> -Andreas
>
>
>
>
>
> On Wed, May 31, 2017 at 1:25 PM, Matthias Kuhn <matthias at opengis.ch>
> wrote:
>
>> Hi Andreas,
>>
>> You can use the QFieldSync plugin which comes with a processing algorithm
>> that renders a styled map within a given extent to a raster dataset.
>>
>> Matthias
>>
>> On 5/31/17 6:29 PM, Andreas Plesch wrote:
>>
>> Responding to myself, I found this processing script in the script
>> repository:
>>
>> https://github.com/qgis/QGIS-Processing/blob/master/scripts/
>> Create_rasters_from_canvas_for_each_vector_layer_feature_extent.py
>>
>> It does almost what I had in mind. Its presence indicates that indeed
>> some Python scripting is necessary.
>>
>> I may give it a try. Unlike above, I would probably try to avoid using
>> the composer and just go for the straight maprenderer as in the map
>> rendering cookbook example: http://docs.qgis.org/
>> 2.18/en/docs/pyqgis_developer_cookbook/composer.html#simple-rendering
>>
>> I wonder if it will be necessary to clone the mapcanvas maprendercontext
>> to preserve current settings ?
>>
>> The main idea is to use the rasterized, styled vector layer as a
>> georeferenced image outside of QGis.
>>
>> -Andreas
>>
>> On Tue, May 30, 2017 at 2:19 PM, Andreas Plesch <
>> andreasplesch at netscape.net> wrote:
>>
>>> I feel I am missing a basic function somewhere to "burn" (in gdal terms)
>>> a vector layer as styled by QGIS, for example with labels, to a raster
>>> layer (of some resolution).
>>>
>>> The Rasterize (vector to raster) function is based on gdal_rasterize and
>>> does not take into account styling as it focuses on preserving the actual
>>> data.
>>>
>>> The work around I am currently using is to use Project-Save as Image
>>> while displaying only the styled vector layer which will generate a correct
>>> world file helper, then loading the generated image as raster layer and
>>> assigning the correct projection. Finally, I clip the raster with the
>>> original extent of the vector layer.
>>>
>>> This works but is limited as the resolution is constrained by the
>>> physical size of the map window and requires the additional house keeping
>>> steps.
>>>
>>> qgis2web or QTiles or OGR2Tiles as plugins do something like this
>>> internally but I could not find a plugin which just generates a regular
>>> raster layer (say geotiff).
>>>
>>> I also know I could probably produce a short Python script (perhaps as
>>> processing script) to do this but still think I am missing something ?
>>>
>>> Any help or hint much welcome,
>>>
>>> Andreas
>>>
>>>
>>
>>
>> _______________________________________________
>> Qgis-user mailing listQgis-user at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20170531/e09bf7c8/attachment.html>
More information about the Qgis-user
mailing list