Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rasters not stylized #148

Closed
nothing-butanol opened this issue Nov 3, 2015 · 36 comments
Closed

Rasters not stylized #148

nothing-butanol opened this issue Nov 3, 2015 · 36 comments

Comments

@nothing-butanol
Copy link

I may have done something wrong but when I try to add a raster with a defined pseudocolor band all I get is a black box for the extent of the raster. The raster should be yellow to red scaled. Not sure if it is a bug or I am not setting it up correctly. Using QGIS 2.8 and the raster is a .tif file created from the Heatmap tool.

raster_qgis2web

@nothing-butanol nothing-butanol changed the title Rasters in Leaflet Rasters not stylized in Leaflet Nov 3, 2015
@tomchadwin
Copy link
Collaborator

Yes. The plugin works on the input image, not the styled output. This issue remains from qgis2leaf (Geolicious/qgis2leaf#168). I believe qgis-ol3 did the same, so the issue potentially exists for both formats - perhaps you could confirm or deny whether OL3 export fails in the same way?

tomchadwin added a commit that referenced this issue Jan 5, 2016
Not working, but I don't understand why - any ideas, anyone?
@tomchadwin
Copy link
Collaborator

I've started work on this in a new branch (https://github.com/tomchadwin/qgis2web/tree/rendered-raster). Not working yet, so any help would be most welcome.

@tomchadwin
Copy link
Collaborator

I've not made any progress on this, so I've asked for help: http://gis.stackexchange.com/questions/175952/pyqgis-save-raster-as-rendered-image-then-use-gdal-tools-on-it

tomchadwin added a commit that referenced this issue Jan 11, 2016
@tomchadwin
Copy link
Collaborator

OK, as far as I can see, there are four different ways of calling GDAL:

  • os.system() - not recommended
  • subprocess.call()/subprocess.popen() - we used to do it this way, at least in the OL3 raster export
  • processing.runalg() - how we do it now
  • Python GDAL bindings - never tried this

I wonder if the GDAL bindings might be worth exploring. Since I don't know what has caused previous attempts to fail, I don't know what I'm looking for. Can anyone explain the pros and cons of the approaches above?

@pcav
Copy link

pcav commented Apr 2, 2016

Confirmed here, both on OL3 and on leaflet: a coloured DTM turns out as grayscale.

@pcav
Copy link

pcav commented Apr 2, 2016

@lucacasagrande
Copy link
Contributor

I will take a look.

@tomchadwin
Copy link
Collaborator

Thanks, @lucacasagrande!

@tomchadwin tomchadwin changed the title Rasters not stylized in Leaflet Rasters not stylized Jun 17, 2016
@lucacasagrande
Copy link
Contributor

Update: Style is working with OL3 (with QGIS-master).

@tomchadwin
Copy link
Collaborator

Only with master? Not working for me with a nightly from a couple of weeks ago:

qgis/QGIS@94d88e6

@tomchadwin
Copy link
Collaborator

No, I can't get this to work:

  1. Downloaded latest nightly
  2. Loaded singleband greyscale raster
  3. Applied pseudocolour style
  4. qgis2web

I see nothing on screen. Are we not describing the same thing?

@lucacasagrande
Copy link
Contributor

lucacasagrande commented Jun 20, 2016

Yes Tom.
In master (next 2.15 I think) some of the algorithms parameters, needed to use raster, have been modified.

@lucacasagrande
Copy link
Contributor

Update: Style is working also in LeafletJS.

@tomchadwin
Copy link
Collaborator

tomchadwin commented Jun 21, 2016

Sorry, @lucacasagrande. I couldn't see any commits/PRs, so I thought you were talking about tomchadwin/qgis2web master as well as QGIS master.

@lucacasagrande
Copy link
Contributor

Hi @tomchadwin I can make a pull request, but it's better in a specific branch because currently it's working only with QGIS-master. Tomorrow I will start to work on a solution to make it compatible with old version.

@tomchadwin
Copy link
Collaborator

Now I understand. Sorry for being so slow. Do you need me to branch here (git non-expert)?

@lucacasagrande
Copy link
Contributor

No problem Tom 👍
Probably we don't need another branch..I have modified the code and now rasters work fine also in 2.14.3. I will do some more tests and I will make the pull request.

@tomchadwin
Copy link
Collaborator

Wow, that was quick.

On a related topic, I've upped the minimum supported QGIS version to 2.8. I would be prepared to up it to 2.14 once that becomes LTR - pretty soon.

tomchadwin added a commit that referenced this issue Jun 25, 2016
@lucacasagrande
Copy link
Contributor

Please test if we can close this issue. Thanks :)

@tomchadwin
Copy link
Collaborator

Fix committed to master. Please test. @pcav, can you test?

@tomchadwin
Copy link
Collaborator

Released as 1.10.0-FOSS4GUK2016 experimental and pushed to QGIS plugins repo.

@zkuralt
Copy link

zkuralt commented Sep 28, 2016

Hi!

I got this error when trying to add raster layers (GTiff) to map. There is no problem with vector layers.

I am using QGIS 2.16.2 on Mac. I will try same thing on Windows computer to see if that could be a problem.

screen shot 2016-09-28 at 14 29 08

@tomchadwin tomchadwin reopened this Sep 28, 2016
@tomchadwin
Copy link
Collaborator

Can you see if you can find more info in the main QGIS log: View > Panels > Log messages panel?

@zkuralt
Copy link

zkuralt commented Sep 28, 2016

That should be it. On windows machine it kind of works (raster resolution is degraded). I can share files that I'm using.


2016-09-28T15:20:19 1   Unable to execute algorithm
            Wrong parameter value: /var/folders/3p/775fl7zx2_v7918wdpw8s50r0000gn/T/future1475068696_piped_3857.tif
2016-09-28T15:20:29 0   GDAL execution console output


            FAILURE: Unknown option name '-te_srs'

            Usage: gdalwarp [--help-general] [--formats]

                [-s_srs srs_def] [-t_srs srs_def] [-to "NAME=VALUE"]

                [-order n | -tps | -rpc | -geoloc] [-et err_threshold]

                [-refine_gcps tolerance [minimum_gcps]]

                [-te xmin ymin xmax ymax] [-tr xres yres] [-tap] [-ts width height]

                [-wo "NAME=VALUE"] [-ot Byte/Int16/...] [-wt Byte/Int16]

                [-srcnodata "value [value...]"] [-dstnodata "value [value...]"] -dstalpha

                [-r resampling_method] [-wm memory_in_mb] [-multi] [-q]

                [-cutline datasource] [-cl layer] [-cwhere expression]

                [-csql statement] [-cblend dist_in_pixels] [-crop_to_cutline]

                [-of format] [-co "NAME=VALUE"]* [-overwrite]

                [-nomd] [-cvmd meta_conflict_value]

                srcfile* dstfile



            Available resampling methods:

                near (default), bilinear, cubic, cubicspline, lanczos, average, mode.

2016-09-28T15:20:29 1   Unable to execute algorithm
            Wrong parameter value: /var/folders/3p/775fl7zx2_v7918wdpw8s50r0000gn/T/current1475068829_piped_3857.tif
2016-09-28T15:20:30 2   Uncaught error while executing algorithm
            Traceback (most recent call last):
              File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/core/GeoAlgorithm.py", line 203, in execute
                self.processAlgorithm(progress)
              File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/algs/gdal/GdalAlgorithm.py", line 65, in processAlgorithm
                GdalUtils.runGdal(commands, progress)
              File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/algs/gdal/GdalUtils.py", line 99, in runGdal
                raise IOError(e.message + u'\nTried 5 times without success. Last iteration stopped after reading {} line(s).\nLast line(s):\n{}'.format(len(loglines), u'\n'.join(loglines[-10:])))
            IOError: 
            Tried 5 times without success. Last iteration stopped after reading 19 line(s).
            Last line(s):
                [-srcnodata "value [value...]"] [-dstnodata "value [value...]"] -dstalpha

                [-r resampling_method] [-wm memory_in_mb] [-multi] [-q]

                [-cutline datasource] [-cl layer] [-cwhere expression]

                [-csql statement] [-cblend dist_in_pixels] [-crop_to_cutline]

                [-of format] [-co "NAME=VALUE"]* [-overwrite]

                [-nomd] [-cvmd meta_conflict_value]

                srcfile* dstfile



            Available resampling methods:

                near (default), bilinear, cubic, cubicspline, lanczos, average, mode.


2016-09-28T15:20:30 1   There were errors executing the algorithm.
2016-09-28T15:20:31 1   Unable to execute algorithm
            Wrong parameter value: /var/folders/3p/775fl7zx2_v7918wdpw8s50r0000gn/T/future1475068829_piped_3857.tif
2016-09-28T15:20:35 2   Uncaught error while executing algorithm
            Traceback (most recent call last):
              File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/core/GeoAlgorithm.py", line 203, in execute
                self.processAlgorithm(progress)
              File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/algs/gdal/GdalAlgorithm.py", line 65, in processAlgorithm
                GdalUtils.runGdal(commands, progress)
              File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/algs/gdal/GdalUtils.py", line 99, in runGdal
                raise IOError(e.message + u'\nTried 5 times without success. Last iteration stopped after reading {} line(s).\nLast line(s):\n{}'.format(len(loglines), u'\n'.join(loglines[-10:])))
            IOError: 
            Tried 5 times without success. Last iteration stopped after reading 19 line(s).
            Last line(s):
                [-srcnodata "value [value...]"] [-dstnodata "value [value...]"] -dstalpha

                [-r resampling_method] [-wm memory_in_mb] [-multi] [-q]

                [-cutline datasource] [-cl layer] [-cwhere expression]

                [-csql statement] [-cblend dist_in_pixels] [-crop_to_cutline]

                [-of format] [-co "NAME=VALUE"]* [-overwrite]

                [-nomd] [-cvmd meta_conflict_value]

                srcfile* dstfile



            Available resampling methods:

                near (default), bilinear, cubic, cubicspline, lanczos, average, mode.


2016-09-28T15:20:35 1   There were errors executing the algorithm.
2016-09-28T15:20:36 1   Unable to execute algorithm
            Wrong parameter value: /var/folders/3p/775fl7zx2_v7918wdpw8s50r0000gn/T/current1475068835_piped_3857.tif
2016-09-28T15:20:36 0   GDAL execution console output


            FAILURE: Unknown option name '-te_srs'

            Usage: gdalwarp [--help-general] [--formats]

                [-s_srs srs_def] [-t_srs srs_def] [-to "NAME=VALUE"]

                [-order n | -tps | -rpc | -geoloc] [-et err_threshold]

                [-refine_gcps tolerance [minimum_gcps]]

                [-te xmin ymin xmax ymax] [-tr xres yres] [-tap] [-ts width height]

                [-wo "NAME=VALUE"] [-ot Byte/Int16/...] [-wt Byte/Int16]

                [-srcnodata "value [value...]"] [-dstnodata "value [value...]"] -dstalpha

                [-r resampling_method] [-wm memory_in_mb] [-multi] [-q]

                [-cutline datasource] [-cl layer] [-cwhere expression]

                [-csql statement] [-cblend dist_in_pixels] [-crop_to_cutline]

                [-of format] [-co "NAME=VALUE"]* [-overwrite]

                [-nomd] [-cvmd meta_conflict_value]

                srcfile* dstfile



            Available resampling methods:

                near (default), bilinear, cubic, cubicspline, lanczos, average, mode.

2016-09-28T15:20:36 1   Unable to execute algorithm
            Wrong parameter value: /var/folders/3p/775fl7zx2_v7918wdpw8s50r0000gn/T/future1475068836_piped_3857.tif

@tomchadwin
Copy link
Collaborator

Are you able to find out which version of GDAL you are using?

@zkuralt
Copy link

zkuralt commented Oct 3, 2016

Does this answer your question?
screen shot 2016-10-03 at 15 59 29

@tomchadwin
Copy link
Collaborator

@zkuralt Is this still an issue?

@zkuralt
Copy link

zkuralt commented Dec 22, 2016

Yes, I am still not able to add raster layers to map. Vector layers work fine. (working on MacOS, QGIS 2.18.0)

@tomchadwin
Copy link
Collaborator

Leaflet or OpenLayers 3 export (or both)?

@zkuralt
Copy link

zkuralt commented Dec 23, 2016

I get the same error when trying to add raster layer (before export). After export to OpenLayers 3 there is no sign of the raster layer, but when I export it to Leaflet, there is at least something indicating that there is some layer (screenshot attached).

screen shot 2016-12-23 at 08 29 13

@tomchadwin
Copy link
Collaborator

@zkuralt I've just made a change to the raster code. Are you able to download master branch and try again? Let us know what happens.

@zkuralt
Copy link

zkuralt commented May 10, 2017

Seems to be working both with vectors and rasters. I am attaching test webmap I just made.

test.zip

@tomchadwin
Copy link
Collaborator

Fantastic news! Thanks for getting back to me so quickly.

It'll be a pleasure to close this issue after so long.

@aperezrivoira
Copy link

Tom, in relation to my previous inquiry on this topic, I am still getting a similar error as described earlier on this post: not being able to export raster with qgis2web plugin.
One thing I noticed with the last version of the plugin, is that it takes a while to load.
Attached is one of the rasters I used (please change file extension .zip for .tif), and here are the Processing and qgis2web Logs:

Processing Log:
2017-05-15T13:11:02 1 Error: Wrong number of parameters
2017-05-15T13:11:02 0 GDAL execution console output

		FAILURE: Unknown option name '-te_srs'
		
		Usage: gdalwarp [--help-general] [--formats]
		
		    [-s_srs srs_def] [-t_srs srs_def] [-to "NAME=VALUE"]
		
		    [-order n | -tps | -rpc | -geoloc] [-et err_threshold]
		
		    [-refine_gcps tolerance [minimum_gcps]]
		
		    [-te xmin ymin xmax ymax] [-tr xres yres] [-tap] [-ts width height]
		
		    [-wo "NAME=VALUE"] [-ot Byte/Int16/...] [-wt Byte/Int16]
		
		    [-srcnodata "value [value...]"] [-dstnodata "value [value...]"] -dstalpha
		
		    [-r resampling_method] [-wm memory_in_mb] [-multi] [-q]
		
		    [-cutline datasource] [-cl layer] [-cwhere expression]
		
		    [-csql statement] [-cblend dist_in_pixels] [-crop_to_cutline]
		
		    [-of format] [-co "NAME=VALUE"]* [-overwrite]
		
		    [-nomd] [-cvmd meta_conflict_value]
		
		    srcfile* dstfile
		
		
		
		Available resampling methods:
		
		    near (default), bilinear, cubic, cubicspline, lanczos, average, mode.

2017-05-15T13:11:02 1 Unable to execute algorithm
Wrong parameter value: /var/folders/d8/m9jrqdx51ld16gtdw73mjz9w0000gn/T/B02clip_201494864662_piped_3857.tif
2017-05-15T13:11:04 1 Error: Wrong number of parameters
2017-05-15T13:11:04 0 GDAL execution console output

		FAILURE: Unknown option name '-te_srs'
		
		Usage: gdalwarp [--help-general] [--formats]
		
		    [-s_srs srs_def] [-t_srs srs_def] [-to "NAME=VALUE"]
		
		    [-order n | -tps | -rpc | -geoloc] [-et err_threshold]
		
		    [-refine_gcps tolerance [minimum_gcps]]
		
		    [-te xmin ymin xmax ymax] [-tr xres yres] [-tap] [-ts width height]
		
		    [-wo "NAME=VALUE"] [-ot Byte/Int16/...] [-wt Byte/Int16]
		
		    [-srcnodata "value [value...]"] [-dstnodata "value [value...]"] -dstalpha
		
		    [-r resampling_method] [-wm memory_in_mb] [-multi] [-q]
		
		    [-cutline datasource] [-cl layer] [-cwhere expression]
		
		    [-csql statement] [-cblend dist_in_pixels] [-crop_to_cutline]
		
		    [-of format] [-co "NAME=VALUE"]* [-overwrite]
		
		    [-nomd] [-cvmd meta_conflict_value]
		
		    srcfile* dstfile
		
		
		
		Available resampling methods:
		
		    near (default), bilinear, cubic, cubicspline, lanczos, average, mode.

2017-05-15T13:11:04 1 Unable to execute algorithm
Wrong parameter value: /var/folders/d8/m9jrqdx51ld16gtdw73mjz9w0000gn/T/B02clip_201494864664_piped_3857.tif
2017-05-15T13:11:05 1 Error: Wrong number of parameters
2017-05-15T13:11:05 0 GDAL execution console output

		FAILURE: Unknown option name '-te_srs'
		
		Usage: gdalwarp [--help-general] [--formats]
		
		    [-s_srs srs_def] [-t_srs srs_def] [-to "NAME=VALUE"]
		
		    [-order n | -tps | -rpc | -geoloc] [-et err_threshold]
		
		    [-refine_gcps tolerance [minimum_gcps]]
		
		    [-te xmin ymin xmax ymax] [-tr xres yres] [-tap] [-ts width height]
		
		    [-wo "NAME=VALUE"] [-ot Byte/Int16/...] [-wt Byte/Int16]
		
		    [-srcnodata "value [value...]"] [-dstnodata "value [value...]"] -dstalpha
		
		    [-r resampling_method] [-wm memory_in_mb] [-multi] [-q]
		
		    [-cutline datasource] [-cl layer] [-cwhere expression]
		
		    [-csql statement] [-cblend dist_in_pixels] [-crop_to_cutline]
		
		    [-of format] [-co "NAME=VALUE"]* [-overwrite]
		
		    [-nomd] [-cvmd meta_conflict_value]
		
		    srcfile* dstfile
		
		
		
		Available resampling methods:
		
		    near (default), bilinear, cubic, cubicspline, lanczos, average, mode.

2017-05-15T13:11:05 1 Unable to execute algorithm
Wrong parameter value: /var/folders/d8/m9jrqdx51ld16gtdw73mjz9w0000gn/T/B02clip_201494864665_piped_3857.tif
2017-05-15T13:11:07 1 Error: Wrong number of parameters
2017-05-15T13:11:07 0 GDAL execution console output

		FAILURE: Unknown option name '-te_srs'
		
		Usage: gdalwarp [--help-general] [--formats]
		
		    [-s_srs srs_def] [-t_srs srs_def] [-to "NAME=VALUE"]
		
		    [-order n | -tps | -rpc | -geoloc] [-et err_threshold]
		
		    [-refine_gcps tolerance [minimum_gcps]]
		
		    [-te xmin ymin xmax ymax] [-tr xres yres] [-tap] [-ts width height]
		
		    [-wo "NAME=VALUE"] [-ot Byte/Int16/...] [-wt Byte/Int16]
		
		    [-srcnodata "value [value...]"] [-dstnodata "value [value...]"] -dstalpha
		
		    [-r resampling_method] [-wm memory_in_mb] [-multi] [-q]
		
		    [-cutline datasource] [-cl layer] [-cwhere expression]
		
		    [-csql statement] [-cblend dist_in_pixels] [-crop_to_cutline]
		
		    [-of format] [-co "NAME=VALUE"]* [-overwrite]
		
		    [-nomd] [-cvmd meta_conflict_value]
		
		    srcfile* dstfile
		
		
		
		Available resampling methods:
		
		    near (default), bilinear, cubic, cubicspline, lanczos, average, mode.

2017-05-15T13:11:07 1 Unable to execute algorithm
Wrong parameter value: /var/folders/d8/m9jrqdx51ld16gtdw73mjz9w0000gn/T/B02clip_201494864667_piped_3857.tif

Qgis2Web Log:
2017-05-15T13:11:02 2 Traceback (most recent call last):
File "/Users/jfm000/.qgis2/python/plugins/qgis2web/olLayerScripts.py", line 75, in writeLayersAndGroups
renderer = layer.rendererV2()
AttributeError: 'QgsRasterLayer' object has no attribute 'rendererV2'

B02clip_2.zip

@tomchadwin
Copy link
Collaborator

@aperezrivoira Can you double-check which version of qgis2web you have installed (find it in the QGIS Plugin Manager)?

@aperezrivoira
Copy link

2.17.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants