Change specific tile image source in OpenLayers 5 Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?OpenLayers OSM tile boundaryOpenLayers 3 zooming to layer when source is ImageWMSupdate Image and Tile/XYZ layers while panning in OpenLayers 3OpenLayers3 with google map local tiles serverUsing custom xyz tiles in CartoDB?OpenLayers 3 - in-house tiled ArcGIS basemap not visibleGenerate a map image file from tiles and featuresIs it possible to insert an XYZ tile layer to an openlayers webmap created by qgis2web plugin?OpenLayers - edit properties of GeoJSON vector sourceServe GeoServer Tiles in XYZ format
How many morphisms from 1 to 1+1 can there be?
Tannaka duality for semisimple groups
Sally's older brother
New Order #6: Easter Egg
What are the main differences between Stargate SG-1 cuts?
How to write capital alpha?
Mounting TV on a weird wall that has some material between the drywall and stud
A term for a woman complaining about things/begging in a cute/childish way
A proverb that is used to imply that you have unexpectedly faced a big problem
Is there hard evidence that the grant peer review system performs significantly better than random?
Did any compiler fully use 80-bit floating point?
Putting class ranking in CV, but against dept guidelines
"klopfte jemand" or "jemand klopfte"?
The Nth Gryphon Number
What does 丫 mean? 丫是什么意思?
Mechanism of oxidative dearomatisation with hypervalent iodine
What would you call this weird metallic apparatus that allows you to lift people?
Short story about a child who is a miniature, living Earth
Nose gear failure in single prop aircraft: belly landing or nose-gear up landing?
Positioning dot before text in math mode
AppleTVs create a chatty alternate WiFi network
RSA find public exponent
Does any scripture mention that forms of God or Goddess are symbolic?
Connecting Mac Book Pro 2017 to 2 Projectors via USB C
Change specific tile image source in OpenLayers 5
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?OpenLayers OSM tile boundaryOpenLayers 3 zooming to layer when source is ImageWMSupdate Image and Tile/XYZ layers while panning in OpenLayers 3OpenLayers3 with google map local tiles serverUsing custom xyz tiles in CartoDB?OpenLayers 3 - in-house tiled ArcGIS basemap not visibleGenerate a map image file from tiles and featuresIs it possible to insert an XYZ tile layer to an openlayers webmap created by qgis2web plugin?OpenLayers - edit properties of GeoJSON vector sourceServe GeoServer Tiles in XYZ format
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I defined a XYZ source and added to map
var source = new ol.source.XYZ(
url: 'http://blabla.com/x/y/z.png',
crossOrigin: 'anonymous'
)
During runtime I can access specific tile by
map.getLayers().getArray()[0].getSource().getTile(2,1,-3)
Now I want to change this tile image. I tried setting src_ and image_ properties but no change.
openlayers tiles
add a comment |
I defined a XYZ source and added to map
var source = new ol.source.XYZ(
url: 'http://blabla.com/x/y/z.png',
crossOrigin: 'anonymous'
)
During runtime I can access specific tile by
map.getLayers().getArray()[0].getSource().getTile(2,1,-3)
Now I want to change this tile image. I tried setting src_ and image_ properties but no change.
openlayers tiles
add a comment |
I defined a XYZ source and added to map
var source = new ol.source.XYZ(
url: 'http://blabla.com/x/y/z.png',
crossOrigin: 'anonymous'
)
During runtime I can access specific tile by
map.getLayers().getArray()[0].getSource().getTile(2,1,-3)
Now I want to change this tile image. I tried setting src_ and image_ properties but no change.
openlayers tiles
I defined a XYZ source and added to map
var source = new ol.source.XYZ(
url: 'http://blabla.com/x/y/z.png',
crossOrigin: 'anonymous'
)
During runtime I can access specific tile by
map.getLayers().getArray()[0].getSource().getTile(2,1,-3)
Now I want to change this tile image. I tried setting src_ and image_ properties but no change.
openlayers tiles
openlayers tiles
edited Apr 12 at 10:42
Vince
14.8k32850
14.8k32850
asked Apr 12 at 7:30
MSBilginMSBilgin
325211
325211
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
OK, I found the solution.
Firstly change tile's src by calling
map.getLayers().getArray()[0].getSource().getTile(2,1,-3).image_.src="base64 or new url"
Then call changed() function on the tile
map.getLayers().getArray()[0].getSource().getTile(2,1,-3).changed()
After all to refresh this tile call changed() function on the source object
map.getLayers().getArray()[0].getSource().changed()
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "79"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f318562%2fchange-specific-tile-image-source-in-openlayers-5%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
OK, I found the solution.
Firstly change tile's src by calling
map.getLayers().getArray()[0].getSource().getTile(2,1,-3).image_.src="base64 or new url"
Then call changed() function on the tile
map.getLayers().getArray()[0].getSource().getTile(2,1,-3).changed()
After all to refresh this tile call changed() function on the source object
map.getLayers().getArray()[0].getSource().changed()
add a comment |
OK, I found the solution.
Firstly change tile's src by calling
map.getLayers().getArray()[0].getSource().getTile(2,1,-3).image_.src="base64 or new url"
Then call changed() function on the tile
map.getLayers().getArray()[0].getSource().getTile(2,1,-3).changed()
After all to refresh this tile call changed() function on the source object
map.getLayers().getArray()[0].getSource().changed()
add a comment |
OK, I found the solution.
Firstly change tile's src by calling
map.getLayers().getArray()[0].getSource().getTile(2,1,-3).image_.src="base64 or new url"
Then call changed() function on the tile
map.getLayers().getArray()[0].getSource().getTile(2,1,-3).changed()
After all to refresh this tile call changed() function on the source object
map.getLayers().getArray()[0].getSource().changed()
OK, I found the solution.
Firstly change tile's src by calling
map.getLayers().getArray()[0].getSource().getTile(2,1,-3).image_.src="base64 or new url"
Then call changed() function on the tile
map.getLayers().getArray()[0].getSource().getTile(2,1,-3).changed()
After all to refresh this tile call changed() function on the source object
map.getLayers().getArray()[0].getSource().changed()
answered Apr 12 at 12:13
MSBilginMSBilgin
325211
325211
add a comment |
add a comment |
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f318562%2fchange-specific-tile-image-source-in-openlayers-5%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown