[QGIS-Developer] Openstreemap pyqgis error

Mathias MIRRA mmirra at mcgr.fr
Thu Sep 17 01:17:42 PDT 2020



De : Mathias MIRRA
Envoyé : jeudi 17 septembre 2020 10:10
À : 'qgis-developer at lists.osgeo.org' <qgis-developer at lists.osgeo.org>
Objet : Openstreemap pyqgis error


Hello, I have a problem on the development of a python plugin, I'm trying to display the openstreemap map behind layers, only the map is not synchronized with the layers, it can't find it or even the location.
the geographical position of the map does not correspond to that of my layers
/
Bonjour, j'ai un problème sur le développement d'un plugin en python ,j'essaye de faire afficher la carte openstreemap derrière des layers .Seulement la carte n'est pas synchroniser avec les layers ,elle ce trouve pas ou même endroit.
la position géographique de la carte ne correspond pas à celle de mes couches

#Vlayer is defined above the code / Vlayer est définie au-dessus du code

urlWithParams = 'type=xyz&url=http://a.tile.openstreetmap.org/%7Bz%7D/%7Bx%7D/%7By%7D.png&zmax=19&zmin=0&crs=EPSG3857'
maplayer = QgsRasterLayer(urlWithParams, 'OpenStreetMap', 'wms')
settings = QgsMapSettings()
settings.setLayers([vlayer,maplayer])
settings.setBackgroundColor(QColor(255, 255, 255))
settings.setOutputSize(QSize(800, 690))

settings.setExtent(vlayer.extent())


render = QgsMapRendererParallelJob(settings)

render.start()
render.waitForFinished()

img = render.renderedImage()
img.save(QgsApplication.qgisSettingsDirPath()+"python/plugins/nro_print/img/render.png", "png")



merci bonne continuation

Mathias Mirra
Développeur

Tel. : 06 29 70 41 92 | Mail. : mmirra at mcgr.fr<mailto:mmirra at mcgr.fr>

[cid:image002.png at 01D68CD8.307F1DF0]
281 Route d'Espagne,
31100 Toulouse

05 32 09 38 71 | www.mcgr.fr<http://www.mcgr.fr/>

  [cid:image004.png at 01D68CD8.307F1DF0] <https://www.facebook.com/groupemcgr/>      [cid:image006.png at 01D68CD8.307F1DF0] <https://fr.linkedin.com/company/groupemcgr>      [cid:image008.png at 01D68CD8.307F1DF0] <https://www.youtube.com/channel/UCahBf8ogJuyGlzAczTTtC9w>

[Une image contenant plane, lumière, blanc, grand  Description générée automatiquement]


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200917/72a280b3/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 10961 bytes
Desc: image002.png
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200917/72a280b3/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.png
Type: image/png
Size: 1682 bytes
Desc: image004.png
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200917/72a280b3/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image006.png
Type: image/png
Size: 1830 bytes
Desc: image006.png
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200917/72a280b3/attachment-0007.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image008.png
Type: image/png
Size: 1721 bytes
Desc: image008.png
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200917/72a280b3/attachment-0008.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image010.png
Type: image/png
Size: 18243 bytes
Desc: image010.png
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200917/72a280b3/attachment-0009.png>


More information about the QGIS-Developer mailing list