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

Static images should be repeated when wrapping around globe #7288

Open
dbaston opened this issue Sep 25, 2017 · 16 comments
Open

Static images should be repeated when wrapping around globe #7288

dbaston opened this issue Sep 25, 2017 · 16 comments

Comments

@dbaston
Copy link

dbaston commented Sep 25, 2017

I have a static JPG that I've added to a map, following this example: https://openlayers.org/en/latest/examples/static-image.html

new ol.layer.Image({
	source: new ol.source.ImageStatic({
		url: 'test.jpg',
		projection : 'EPSG:4326',
		imageExtent: [-180, -90, 180, 90]
	}),
	opacity:0.5
})

Since the image is global in extent, I'd expect to see it repeated as I pan to the left around the globe. However, the image is only shown a single time, as seen below:

image

@bartvde
Copy link
Member

bartvde commented Sep 25, 2017

did you try wrapX: true on the source?

@dbaston
Copy link
Author

dbaston commented Sep 25, 2017

I tried it just now, to no effect. And wrapX doesn't appear on the list of accepted parameters for ol.source.ImageStatic ?

http://openlayers.org/en/latest/apidoc/ol.source.ImageStatic.html

@bartvde
Copy link
Member

bartvde commented Sep 25, 2017

good catch, I suppose we'd accept a PR to add that

@dbaston
Copy link
Author

dbaston commented Sep 25, 2017

So the PR should add a wrapX property and then implement the wrapping behavior?

@bartvde
Copy link
Member

bartvde commented Sep 25, 2017

looks like we only have wrapX for tile based sources

@bartvde
Copy link
Member

bartvde commented Sep 25, 2017

@ahocevar any insight into why this might be? Just not implemented, or another reason?

@ahocevar
Copy link
Member

Like you said @bartvde - wrapX is just not implemented for image sources.

@stale
Copy link

stale bot commented May 22, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 22, 2019
@stale stale bot closed this as completed May 29, 2019
@SoulSpirit79
Copy link

Any news on property wrapX for Static sources?

@mbudk
Copy link

mbudk commented Dec 19, 2019

I use a static image as fallback background layer, so I would really like to see this feature implemented.

@david43
Copy link

david43 commented Nov 6, 2020

any update?
still not work on ImageStatic

@greenlaw
Copy link

I'm also looking for this feature.

There are some use cases where using a dynamically-reloaded source like ol/source/ImageWMS or a tiled source like ol/source/TileWMS can both result in a bad user experience. For example, if you want to load a full time-series of images (e.g. radar loop), using ImageWMS you have to reload the full time series whenever the extent changes at all. Using TileWMS, especially with 256x256 tiles, it generates an even higher number of upfront requests for every zoom level visited (which doesn't work well for services with less than great tiling performance).

While still not ideal, loading an image with static resolution and extent can sometimes provide better UX, but the fact that ImageStatic doesn't repeat across the dateline is a problem.

If anyone can jumpstart me with pointers on how this could be implemented, let me know. Otherwise, would defining a custom tiling scheme be a viable workaround?

@greenlaw
Copy link

greenlaw commented Nov 13, 2020

Okay, so I was able to get a custom tile scheme working for my use case. I'm loading the entire world (in EPSG:3857) as a single large tile (1536 x 1536px). Wrapping is working, although I am getting a gap around the dateline, but that might be a server projection issue.

The following was adapted from this example:

import {getWidth} from 'ol/extent';
import TileGrid from 'ol/tilegrid/TileGrid';
import TileLayer from 'ol/layer/Tile';
import TileWMS from 'ol/source/TileWMS';

const projExtent = map.getView().getProjection().getExtent();
const startResolution = getWidth(projExtent) / 1536;
const resolutions = [startResolution];

const tileGrid = new TileGrid({
  extent: projExtent,
  resolutions: resolutions,
  tileSize: [1536, 1536],
});

const lyr = new TileLayer({
  source: new TileWMS({
    url: '<your wms url>',
    tileGrid: tileGrid,
  }),
});

map.addLayer(lyr);

@eric-g-97477
Copy link

I am hoping this issue can be reopened. Any chance someone can work on it?

@ahocevar ahocevar reopened this Feb 1, 2024
@ahocevar
Copy link
Member

ahocevar commented Feb 1, 2024

Reopened. It would be sufficient to add wrapX support to ol/source/Image, then users could create a static image loader with ol/source/static#createLoader().

@eric-g-97477
Copy link

I did open a StackOverflow question related to this topic, since I will (likely) need a solution before this ticket is resolved.

If anyone has any advice, I would appreciate it.

@stale stale bot removed the stale label Feb 2, 2024
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

8 participants