9

Map algebra for raster is easy with ArcGIS Raster Calculator (or QGIS). I had thought this would be easy with web GIS servers such as GeoServer and MapServer plus OpenLayers etc. as well. What I want to achieve is to do simple things like dividing two images and generate a third, ratio image to be displayed in the webpage. I spent weeks to find a solution and it turns out to the pretty hard (for me).

I have tried a few things including:

  1. PostGIS raster. I think raster algebra isn't a problem here.

    But PostGIS raster is pretty difficult to load into GeoServer. There are many many questions repeatedly asked about how to load pgraster in GeoServer. See e.g. How to import GeoTIFF via postGIS into GeoServer?? , https://gis.stackexchange.com/questions/86006/publish-rasters-stored-in-postgresql-with-geoserver?, among others. Not a single answer here in GIS.SE or the GeoServer official website gives a complete list of steps that can be followed to work. Loading pgraster into MapServer has reported success, but with very slow performance. Both seem to require some tiling, and a one-liner command to import a raster to either server seems to be out of the question.

  2. GeoTIFF

    GeoTIFF is easy to load into GeoServer and MapServer. But what can we do with it? Without a PostGIS like SQL, I turned to and briefly searched using WCS to do map algebra, but didn't find much. Is WCS a viable path for this with current servers?

  3. Program it the hard way

    Somehow use AJAX to call a PHP page or write a WPS using GeoServer for importing images into PostGIS, doing the map algebra and then converting the result pgraster to a format (e.g. GeoTIFF) that can be easily loaded and displayed in GeoServer/MapServer.

  4. Of course, one can write code to read GeoTIFF's directly and do the map algebra without GIS support.

None of the above seems to be easy or reasonable to me considering the ease with which the same algebra can be done in Desktop GIS.

I was wondering if someone has had any experience doing Map Algebra in a web GIS environment, and can suggest a viable path?

I am interested in Open Source solutions (for political reasons inside my organization.) I am aware that ArcGIS Server can call python code of ArcGIS, but we don't have the license and the environment here is not favorable for acquiring one.

  • "Is there a reasonable way to ..." is a really wordy phrase (where, e.g., "How to ..." works just fine) to put in a question title, so if you can think of a better way to state your question than what I had suggested please do so. Also, I consider the word "software" to include programming APIs and libraries, such as GDAL, so by that interpretation, your reversion of my edit was probably unnecessary. However, do what you wish if you think it clarifies your question. – blah238 Oct 15 '14 at 22:18
  • @blah238 Thanks for the edits:). I was probably verbose, but I think obviously there are ways to ..., it's just that they appear to be unreasonable effort compared to the ESRI/Desktop world. Also, you are right that "software" can include APIs. I just want to emphasize that coding it from scratch is an option if there is nothing else that's reasonably easy to achieve map algebra. – tinlyx Oct 16 '14 at 0:34
4

Using only open source software, you will almost certainly need to do some programming yourself. GDAL is the de facto open source raster I/O library, so you will probably be using it or one of its many wrappers. You could use Python (e.g. rasterio + numpy/scipy) or node.js, e.g. node-gdal (though beware it is currently synchronous/blocking). As for actually implementing it as a web service, I'm not sure what would be the best approach, but there is a related question here: Comparing different open source GIS servers?

If programming isn't your thing, you might take a look at FME Server. It's a commercial product but probably substantially cheaper than ArcGIS Server, and it has all sorts of raster calculation transformers, so I would be quite surprised if they could not accomplish what you need to do. You would not need to load the rasters into a database as it can read from just about any raster file format.

The server part would allow you to run the transformations (FME workspaces) on a server and use an API, e.g. the FME Server REST API, to initiate those transformations and access the results.

The main benefit is you would not need to do much if any programming to get the services up and running, just a little front-end coding to work with the API.

  • +1 thanks. I was also thinking about rasdaman. I can program, but just don't feel right coding it these many years after map algebra. – tinlyx Oct 14 '14 at 4:12
  • +1 In support of python+gdal. To do raster algebra with numpy is a breeze. Also, if you are working with text based rasters (like .asc files) then you don't even need gdal (which can be a pain to install, depending) by using numpy.loadtxt (skip the header rows, space as delimiter, etc) – user1269942 Oct 14 '14 at 4:39
  • With rasdaman you have the ability to use WCPS to do the processing on the server, though you'll probably need to do some scripting to create the WCPS syntax as doing by hand can be challenging. – nmtoken Sep 22 '15 at 14:36
2

What you are looking for is an image server. ArcGIS for Server has this extension:

ArcGIS Image Extension for Server

i do not know of any open source equivalents.

  • 1
    OP is asking for how to do this in a web context, not for an ArcGIS extension. – John Powell Oct 13 '14 at 19:51
  • 2
    @JohnBarça the extension suggested is to ArcGIS for Server and so is used in a web context. – PolyGeo Oct 13 '14 at 22:00
  • @Pau I forgot to say that I am kind of constrained to use open source GIS. But thanks for the suggestion. It's helpful. – tinlyx Oct 14 '14 at 1:10
  • 1
    @TingL you can start looking for arcgis image server open source alternatives – Pau Oct 15 '14 at 12:35
1

You can probably do this in the browser with WebGL:

http://www.html5rocks.com/en/tutorials/webgl/webgl_fundamentals/

but it would require some programming, and a WebGL-compliant browser. But it should be fast since it would be using the GPU in most cases.

  • 1
    Thanks a lot. Do you have any reference for how to handle GIS data such as GeoTIFF in WebGL? – tinlyx Oct 22 '14 at 21:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.