Re: [Qgis-user] Creating PNG images using QGIS 3 pygis

2019-03-06 Thread wambacher
Thanks, Anita

yes that helps :)

"Fighting" a little bit with the layout (never used that) but i'll get it.

regards
walter

current:
https://wambachers-osm.website/images/osm/snaps_2019/Missing_Boundaries.png

goal:
https://wambachers-osm.website/images/osm/snaps_2019/missing_boundaries_20190306.png

Am 05.03.19 um 14:20 schrieb Anita Graser:
> Hi Walter,
>
> On Tue, Mar 5, 2019 at 2:11 PM  > wrote:
>
> I don't need the whole script converted - *only a hint how to
> create a png the new way.*
>
> In that case, check out
> https://anitagraser.com/pyqgis-101-introduction-to-qgis-python-programming-for-non-programmers/pyqgis-101-exporting-layouts/
>
> Regards,
> Anita
>
>
-- 
My projects:

Admin Boundaries of the World 
Missing Boundaries

Emergency Map 
Postal Code Map (Germany only) 
Fools (QA for zipcodes in Germany) 
Postcode Boundaries of Germany 
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

[Qgis-user] Creating PNG images using QGIS 3 pygis

2019-03-05 Thread wambacher
Some days ago I upgraded from QGIS 2.18 to 3.6.0 - not knowing that many
Python scripts won't run without modifications.

I could convert all of them but not this one:

|fromPyQt4.QtCoreimport*fromPyQt4.QtGuiimport*fromPyQt4importQtGuiimportprocessing,sys,time,psycopg2
importpprint ...creatin layers skipped (got this
running)...### Create Graph
#mapRenderer =iface.mapCanvas().mapRenderer()layers
=[missingLayer.id(),clipLayer.id()]mapRenderer.setLayerSet(layers)c
=QgsComposition(mapRenderer)c.setPlotStyle(QgsComposition.Print)c.setPaperSize(148,90)c.setPrintResolution(300)#
add mapx,y =0,0w,h =c.paperWidth(),c.paperHeight()composerMap
=QgsComposerMap(c,x,y,w,h)c.addItem(composerMap)#output to imagedpi
=c.printResolution()dpmm =dpi /25.4width =int(dpmm
*c.paperWidth())height =int(dpmm
*c.paperHeight())BackgroundColor=QColor(0,0,255)# create output image
and initialize itimage
=QImage(QSize(width,height),QImage.Format_ARGB32)image.setDotsPerMeterX(dpmm
*1000)image.setDotsPerMeterY(dpmm
*1000)image.fill(BackgroundColor)header
=QgsComposerLabel(c)header.setItemPosition(40,1)header.setBackgroundEnabled(0)newFont
=QFont("Comic Sans MS",18)header.setFont(newFont)header.setText("Missing
Countries Map")header.adjustSizeToText()c.addItem(header)header2
=QgsComposerLabel(c)header2.setItemPosition(50,11)header2.setBackgroundEnabled(0)newFont2
=QFont("Comic Sans
MS",10)header2.setFont(newFont2)header2.setText("TS="+ts)header2.adjustSizeToText()c.addItem(header2)footer
=QgsComposerLabel(c)footer.setItemPosition(124,87.5)footer.setBackgroundEnabled(0)newFont3
=QFont("Times
Roman",4)footer.setFont(newFont3)footer.setText(time.ctime())footer.adjustSizeToText()c.addItem(footer)legend
=QgsComposerLegend(c)legend.model().setLayerSet(mapRenderer.layerSet())legend.setItemPosition(5,65)legend.setFrameEnabled(1)newFont
=QFont("Comic Sans
MS",6)legend.setStyleFont(QgsComposerLegendStyle.Title,newFont)legend.setStyleFont(QgsComposerLegendStyle.Subgroup,newFont)legend.setStyleFont(QgsComposerLegendStyle.SymbolLabel,newFont)legend.setStyleMargin(QgsComposerLegendStyle.Title,2)legend.setTitle("Legend")legend.setSymbolHeight(2)legend.adjustBoxSize()c.addItem(legend)#
render the compositionimagePainter
=QPainter(image)imagePainter.setRenderHint(QPainter.Antialiasing)sourceArea
=QRectF(0,0,c.paperWidth(),c.paperHeight())targetArea
=QRectF(0,0,width,height)c.render(imagePainter,targetArea,sourceArea)imagePainter.end()imageFile
="missing_boundaries"+ts+".png"print"saving to "+imageFile
image.save(imageFile) |

Yes, I do know the QqsComposer has gone but I can't find any
documentation or example for QGIS3 plotting. Except the API description
of course.

I don't need the whole script converted - *only a hint how to create a
png the new way.*

regards

walter
**

||

-- 
My projects:

Admin Boundaries of the World 
Missing Boundaries

Emergency Map 
Postal Code Map (Germany only) 
Fools (QA for zipcodes in Germany) 
Postcode Boundaries of Germany 
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

[Qgis-user] adding text field from PostgreSQL table without geometry

2019-02-28 Thread wambacher
Hi,

i would like to add a variable text to the graph,  where data is in a
postgres *table **without geometries*.

it's the timestamp of the currently used dataset.

Query is "select timestamp from timestamps where
tablename='collected_admin_boundaries';"  which returns a timestamp like
"2019-02-27 23:00:03+01"

this value should be visible on the graph.

any ideas?

walter/germany

-- 
My projects:

Admin Boundaries of the World 
Missing Boundaries

Emergency Map 
Postal Code Map (Germany only) 
Fools (QA for zipcodes in Germany) 
Postcode Boundaries of Germany 
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

[Qgis-user] categorize using postgis hstore

2018-12-29 Thread wambacher
Hi,

i'm using QGIS 3.4 on ubuntu and want to categorize some data using hstore.

i was told (*) to use *map_get(hstore_to_map("tags"),'entrance')*, but
that does not work (for me). the result is ony one category for all nodes.

sql:

select osm_id,tags->'entrance' "tags->'entrance'"
  from planet_osm_point
 where tags ? 'entrance'
 limit 10;
   osm_id   | tags->'entrance'
+--
 3812284860 | main
 2312180146 | yes
 2773679231 | yes
  339015388 | main
  561073309 | service
  367081276 | main
  339015386 | yes
 1783531793 | main
 1783531816 | main
  367081281 | main
(10 Zeilen)

Zeit: 3,194 ms

any idea whats going wrong?

regards

walter

*)
https://gis.stackexchange.com/questions/209421/how-to-categorize-features-based-on-hstore-values-in-qgis/288550

image: https://wambachers-osm.website/images/osm/snaps_2018/categorize.png

-- 
My projects:

Admin Boundaries of the World 
Missing Boundaries

Emergency Map 
Postal Code Map (Germany only) 
Fools (QA for zipcodes in Germany) 
Postcode Boundaries of Germany 
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

[Qgis-user] qgis global variable store

2018-05-02 Thread wambacher

hi,

i would like to read/process the global qgis variable store outside of 
qgis but i can't find it on disk.


any hint?

Regards

walter

--
My OpenStreetMap projects:

Admin Boundaries of the World 
Missing Boundaries 


Emergency Map 
Postal Code Map (Germany only) 
Fools (QA for zipcodes in Germany) 
Postcode Boundaries of Germany 
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user