0

I would like to find out what is needed and what needs to be done to display multiple single map files (jpg) via WMS (GeoServer?) as multiple single layers?

The example at OpenLayers: Single Image WMS https://openlayers.org/en/latest/examples/wms-image.html

So I have many maps that fit to subareas of an OSM Map. I want to display these many single maps as many layers. The single maps / layers should be loaded / unloaded by JavaScript onclick(). Everything necessary in OpenLayers and JavaScript is no problem.

What I want to know is, with which WMS software this can be realized and how this WMS is to be configured.

I have some experience with PHP and ImageMagick. How I envision this:

  • The map files (jpg) are uploaded/saved to the server.
  • OpenLayers sends a request to one of the map files. In it is the filename and the BBOX, and some more, which is sent by OpenLayers. (I have a JSON / JS object with the "extent" coordinates for each map file.)
  new ImageLayer({
    extent: [-13884991, 2870341, -7455066, 6338219],
    source: new ImageWMS({
      url: 'https://ahocevar.com/geoserver/wms',
      params: {'LAYERS': 'topp:states'},
      ratio: 1,
      serverType: 'geoserver'
    }),
  • The WMS renders the saved map file into a new corresponding single image and sends it back to the browser / into the map.

For a better understanding of the OL example just switch on the browser inspector and there the network monitoring and then zoom in the map. There the requests to and answers from the server are listed - with thumbnails of the newly rendered single image at mouse-hover.

1 Answer 1

0

It shouldn't matter which software you use to configure the WMS, it's a standardized interface; there are multiple software packages to choose from ~ GeoServer, MapServer, deegree, ArcGIS, QGIS... it depends on your need/architecture etc.

For a WMS the data stored on the server don't have to be images, it's very common in fact for the data source to be a vector format. The WMS does the conversion to images on the fly, according to the requests (GetMap) it gets from the client (OpenLayers).

You shouldn't need to do any scripting to configure your WMS, if you want to create a custom interface/web map using PHP, then you could do that using MapServer/MapScript.

2
  • thanks for the answer. I was still in the discovery phase when I asked the question for an realy new project. In the meantime I have my own short PHP script (without database) that delivers the images. See my other questions here, which problems I still have with this. It is a pity that OL has nothing ready for such cases. I have made a feature request on Github.
    – Suka
    May 25, 2022 at 15:19
  • I'm not sure which cases you mean, either your PHP script provides a WMS, or it doesn't. If your script provides additional capabilities to those required for a WMS, which would be described as vendor options, then you should be able to pass those parameters in a request through OpenLayers
    – nmtoken
    May 25, 2022 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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