6

Currently, openlayers supports bing maps, however this is not an ideal option for a commercial application. What would be ideal is to have the ability to host and serve ariel imagery like NASA blue marble at http://visibleearth.nasa.gov/view_cat.php?categoryID=1484

Is there a way to serve an open source aerial image as a basemap in an openlayers 3 or 4 application? How could this be accomplished in theory?

EDIT: I'd like to know more about hosting and serving the aerial map locally. There are examples of how to do this with OpenStreetMaps using Mod_tile, renderd, mapnik, osm2pgsql and a postgresql/postgis database on the switch to OSM website https://switch2osm.org/manually-building-a-tile-server-16-04-2-lts/

How would one go about replicating this process locally using just raster imagery like NASA blue marble at http://visibleearth.nasa.gov/view_cat.php?categoryID=1484 (Large file)

  • Can you define the area/extent of aerial coverage you need? – artwork21 May 8 '17 at 12:26
  • North America, specifically Canada – goonerify May 8 '17 at 12:36
  • Do you already have all the imagery you need? Is it a single image or do you need to combine (mosaic) multiple files? – BradHards May 9 '17 at 9:30
  • No i don't already have the imagery that i need. The idea is to use a publicly available raster image that i can download as a basemap in an OL3/4 application. For instance, an image such as eoimages.gsfc.nasa.gov/images/imagerecords/74000/74218/… Or even a combination of such images if necessary – goonerify May 9 '17 at 13:12
4
+25

You could use this example as a template. You can substitute in any tile server in the form http:{a}.server/layer/{z}/{x}/{y}.png, where server is the url, layer is the layer name, and z, x, y and the zoom, row and column of the globally defined 3857 xyz tileset, which is the standard in OpenLayers, Leaflet, Google Maps and other slippy map server you are likely to come accross.

The {a}.server is for mostly historical reasons, as old browsers used to be limited by the number of simultaneous requests they could make to the same domain, which slowed down slippy maps type interfaces, allowing a.tileserver.com, b.tileserver.com, etc, to get round it.

There is a nice Leaflet page which a list of tile server urls you could drop into the above.

There are many options for aerial imagery, for example, from ESRI http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}

The code is as simple as:

 var map = new ol.Map({
    target: 'map',
    layers: [
      new ol.layer.Tile({
        source: new ol.source.XYZ({
          url: 'https://{a-c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png' +
              '?apikey=Your API key from http://www.thunderforest.com/docs/apikeys/ here'
        })
      })
    ],
    view: new ol.View({
      center: [-472202, 7530279],
      zoom: 12
    })
  });

ie, you create an ol.Map instance and pass in ol.layer.Tile instance and an ol.View instance, to set the initial zoom and center point.

There is also a Mapbox using OpenLayers demo page, with a url for satellite of https://api.mapbox.com/styles/v1/mapbox/satellite-v9/tiles/256/{z}/{x}/{y}?access_token='. You will need to apply for an API access token, but their free layer is quite generous.

  • The issue i'd have here would be hosting and serving the aerial maps locally. There are examples of how to do this with OpenStreetMaps using Mod_tile, renderd, mapnik, osm2pgsql and a postgresql/postgis database on the switch to OSM website switch2osm.org/manually-building-a-tile-server-16-04-2-lts How would one go about replicating this process locally using just a custom basemap NASA blue marble at visibleearth.nasa.gov/view_cat.php?categoryID=1484 – goonerify May 8 '17 at 18:21
  • Ah, ok, I misunderstood the question. You are asking how to build your own tile stack (in 3857) from a given input image, as in the NASA images? – John Powell May 8 '17 at 19:26
  • Yes, that's exactly what I'm looking for. How to build it and serve it with OpenLayers XYZ source protocol like in this answer that you provided – goonerify May 9 '17 at 8:52
  • 1
    Are you asking about setting up a WMTS style server or creating the tiles. It's quite a broad question. So, please add more details about preferred software stack etc, because there are numerous ways of doing this, including using GeoServer to do it for you. – John Powell May 11 '17 at 11:15
0

It seems there is a variation of this question that partly answers it by addressing how to import raster images into a PostGIS database How to import a raster into PostGIS?

Theoretically, you would load a raster image like the NASA blue marble imagery into a PostGIS database using a tool called raster2pgsql. The image could then be served as WMS - through a geospatial data server like GeoServer - in a web-based OpenLayers application.

  • You don't even need to load it into Postgis to use with Geoserver. Just use GeoWebCache directly. – John Powell May 14 '17 at 17:00

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.