I used a script from the PyQGISDeveloperCookbook and another StackExchange post to render an image from a specific coordinate. The problem I have is that I am unsure how to input the correct coordinates for a custom CRS. The CRS I am using in my project is ETRS89 / GK25FIN, And the coordinate I want to render is 25500381,6677153. When I attempt to render, I only output garbage similar to the result Leolo got in the previously mentioned post.
I have tried using a smaller number but the odds of me brute forcing the correct location is practically zero. Being a noob I am unsure what the given CRS actually means, and what coordinates it is supposed to use. I have tried using this site to translate the coordinates with no luck.
Here is the my slightly modified script from the previous post:
from PyQt4.QtGui import QImage, QPainter from PyQt4.QtCore import QSize import os # radius for image in meters radius = 512 # center point p = [25499771,6677153] # <- I don't know what to write here in this CRS # bounding box bbox = QgsRectangle(p-radius, p-radius, p+radius, p+radius) # image img = QImage(QSize(200,200), QImage.Format_ARGB32_Premultiplied) ## create painter painter = QPainter() painter.begin(img) render = QgsMapRenderer() ## set layer set layers = QgsMapLayerRegistry.instance().mapLayers() lst = layers.keys() render.setLayerSet(lst) # Set destination CRS to match the CRS of the first layer render.setDestinationCrs(layers.values().crs()) # Enable OTF reprojection render.setProjectionsEnabled(True) ## set extent render.setExtent(bbox) ## set output size render.setOutputSize(img.size(), img.logicalDpiX()) ## do the rendering render.render(painter) painter.end() ## save image img.save("K:\\QgisOutput\\TestHeight.png", "png")