Hot answers tagged

14

This is possible in QGIS using the print composer. You'll need to both: Remove the background color from the map item. This is done by unchecking the "background" option in the map item's properties. (The default is a white background) Set the page itself to a transparent style. This is done through the composition properties tab.


11

You can set the page background to transparent by creating a transparent symbol and setting the page background to use that symbol: transparent_fill = QgsFillSymbolV2.createSimple({ 'outline_style': 'no', 'style': 'no'}) c.setPageStyleSymbol( transparent_fill ) There's also a few other things wrong with your script: First, mapRenderer = iface.mapCanvas()...


8

This is currently not supported. The only way you are able to do this is to embed or link a png in a SVG file. Adding support for loading other image formats shouldn't be too hard for a future version.


8

Your best bet is to use InkScape and convert your graphics to SVG. Polygons can be filled with rasters, but points and markers need SVG. If your symbol is available in a font, you can also use Font markers. It's fairly straightforward:- Load bitmap (png, jpg etc) into Inkscape with File > Open File > Save as (use Plain SVG rather than default Inkscape SVG) ...


7

I just gave this a test using ArcGIS for Desktop 10.2 on Windows 7 SP1 and was able to create a PNG and GIF files that had a transparent background that I could verify by inserting them as pictures into Word 2010 as In Front Of Text. I followed the Exporting your map instructions from the ArcGIS 10.1 Online Help, using Rose Quartz as both Background and ...


7

The key to this is to recognize that ST_AsPNG returns a bytea, ie a byte array, representing a png. So, you need to somehow convert those bytes to a file on the file system. There are a couple of ways of doing this as shown in the docs. The oid approach, as outlined by @Stefan, works, but requires psql and is a bit obscure, in my opinion. The other ...


7

This is a limitation of the PNG format. It only has 3 information channels (RGB), so one of your bands will be suppressed. If you really need to, you can save your NIR band as an alpha channel, but beware - you won't be able to access it easily. Neither QGIS nor ArcGIS allow allocating the alpha channel to one of its display channels. The information will ...


6

For best logo results, make sure you start with a PNG that has high pixel values, like 3500x3500 (if it's a square). Next, make sure you shrink that down to at most a couple inches. For export settings, set DPI to 600, and Image Compression to "LZW". Then export to PDF.


5

In Windows: for %i in (*.tif) do gdal_translate -of GTIFF -a_nodata 0 %i %~new_ndata.tif for %i in (*.tif) do gdal_translate -of PNG -scale -co worldfile=yes %i %~cnvt.png In bash: for i in *.tif; do gdal_translate -of GTIFF -a_nodata 0 $i $i~new_ndata.tif; done; for i in *~new_ndata.tif; do gdal_translate -of PNG -scale -co worldfile=no $i $i~cnvt.png; ...


5

Couldn't you try something like... SELECT encode(ST_AsPNG(rast), 'base64') FROM foo Granted, I have no idea if that'll work but it is worth a shot.


5

reaname world file to .pgw from .pnwx. keep both image and world in same directory with same name.


5

You can use gdal_rasterize to create an image from a vector source: Create a view of your query in PostGIS: CREATE VIEW myunion AS SELECT ST_Union(geom) FROM holdings WHERE town='Macclesfield'; Then use gdal_rasterize from the command line: gdal_rasterize -burn -9999 -tr 0.001 0.001 -l myunion PG:'host=localhost dbname=yourDBname user=usernamehere' ...


5

Windows photo is not a GIS viewer and it does not know anything about georeferencing. Therefore is considers pixels as square. However, as you can see from the gdalinfo report the pixel x and y size are not equal Pixel Size = (0.068380000000000,-0.119760000000000) I would say that you image is correct, QGIS is doing the right thing as GIS viewer and ...


5

The composer map windows don't automatically refresh when you update layers, but pull the latest view when you export. If you toggled each layer then added the map to canvas this could cause the problem described. If you refresh the canvas, does it change to look like the .png? If so, toggle each layer as before, refresh the canvas and then lock the layers ...


4

Agree with Devdatta, PNG Itself won't have the data. However its possible the data could be contained in an associated file. For example GDAL can export PNGs with the referencing stored within filename.aux.XML


4

Have you tried it sucessfully with a handfull of files? For me, it worked with 300 files. At first, I had to build individual vrts for each image to expand the colour information to rgba: for %%N in (D:\Karten\gdal\gdal2tiles\NL25\*.tif) DO gdal_translate -of vrt -expand rgba %%N D:\Karten\gdal\gdal2tiles\NL25\%%~nN.vrt Second run, I merged all those vrts ...


4

Well, on my own, I finally dug out the key function I needed: setSubsetString(). Whoever named this thing?...doesn't seem very intuitive as to its function. Here's the skeleton I'm working with now: qgis.utils.iface canvas = qgis.utils.iface.mapCanvas() allLayers = canvas.layers() for n in range(1, 201) for layer in allLayers: layer....


4

If you don't know the extent in coordinates of the prj file, you have to georeference the file manually using ground control points. This is rather comfortable if you have QGIS installed, and you can guess some details from the image. In some cases, you can build the extent manually if the filename follows a certain rule, like the one-degree-SRTM files do. ...


4

Arcmap has the ability to save with transparent colour for those image formats that support a transparent colour: GIF and PNG, of these two the PNG (Portable Network Graphic) is the better format as it supports 24bit colour and transparency where GIF only has 8bit palette colour and transparency. To make the export transparent select in the export dialog (...


4

The only thing that would change the size of the PNG by that magnitude, assuming your DPI has always been 220, and the vectors are generally similar, would be the page size being larger. 1-4MB is typical for an 8.5"x11" paper, but something larger like 14" x 22" could conceivably generate a PNG around 20MB. If the page size is the same, then I'd try out the ...


4

For tricky (and scriptable) image manipulation, my tool of choice is ImageMagick. It's not a particularly easy-to-learn tool, but it can do things like changing the bit depth of images, or convert from grayscale to a colour ramp, control the number of channels of the output file (RGB/greyscale/etc), or anything, really. With a bit of work, it should be able ...


4

ArcGIS Pro will share/export to PNG including transparency. If you have set a background colour, there will be no transparency, but if there is no background and no basemap then it will export to PNG with a transparent background. The following image was exported from ArcGIS Pro to PNG (Color Mode: 32-bit with Alpha) and then added to ArcMap I then set ...


4

Regarding to my comment, this could be the (untested) query: WITH foo AS ( SELECT ST_AsRast(ST_Union(geom)) AS rast FROM holdings WHERE town='Macclesfield') SELECT oid, lowrite(lo_open(oid, 131072), png) As num_bytes FROM ( VALUES (lo_create(0), ST_AsGDALRaster(((SELECT ST_Union(rast) FROM foo)),'GTiff') )) As v(...


4

It is not about the contrast, the elevation in each scene is different. In other words, the minimum and maximum elevation is different in each scene. The only solution to this problem is that you need to mosaic the DEM scene first to get a the correct elevation. You need to use Merge tool from Processing toolbox -> GDAL/OGR -> Miscellaneous -> ...


4

"MTM Zone 8" is the important thing here. In QGIS, Load Raster, choose the .PNG and then set the CRS to "NAD 83(CSRS) MTM Zone 8" (EPSG code 2950). This puts your image just south-west of Montreal. Its possible the Coordinate system isn't quite that, but QGIS won't read a .prj and apply it to a .png. But it looks right...


4

You can try to run a command with the options that handle the input bands in the best way possible and result in a well-constructed image similar to the one shown by qgis: gdal_translate -ot Byte -of PNG -b 1 -b 2 -b 3 -scale_1 0 439 -scale_2 0 460 -scale_3 0 454 -a_nodata none -colorinterp_1 red -colorinterp_2 green -colorinterp_3 blue test.tiff output.png ...


3

I would suggest you to go through their API documentation. Coming back to your question, you can iterate through all layers in the TOC using: canvas = qgis.utils.iface.mapCanvas() allLayers = canvas.layers() for i in allLayers: print i.name() #Do other stuff here.


3

for resolve the problem of black areas is necessary to proceed this way: 1) create a virtual mosaic of the images with the param -vrtnodata 255: gdalbuildvrt test.vrt -vrtnodata 255 *.tif this add a white background to the mosaic see this explanation: http://lists.osgeo.org/pipermail/gdal-dev/2010-January/023032.html 2) download the correct prj file from ...


3

From Jeff Moulds (ESRI) originally for pdf export here's some python you can customize. It works on all mxds in a folder so you could adjust that or perhaps copy the projects into one temporarily for exporting. I added paragraph spaces after the first 3 lines to make the text properly indent in the box below, not being smart enough to do that any other way....


Only top voted, non community-wiki answers of a minimum length are eligible