How to disable imageSmoothingEnabled for geoImageLayer?How do I get ArcGIS tiles to display a single layer...

Is it possible to set values for a list of variables using a for loop?

Including proofs of known theorems in master's thesis

Would water spill from a bowl in a Bag of Holding?

How can guns be countered by melee combat without raw-ability or exceptional explanations?

Why "rm -r" is unable to delete this folder?

I have trouble understanding this fallacy: "If A, then B. Therefore if not-B, then not-A."

How do I avoid the "chosen hero" feeling?

Why is Shelob considered evil?

What happened to Hermione’s clothing and other possessions after she wiped her parents’ memories of her?

Is there any danger of my neighbor having my wife's signature?

Isn't a semicolon (';') needed after a function declaration in C++?

Is the percentage symbol a constant?

How to regain lost focus?

How to know if I am a 'Real Developer'

Tikz: Perpendicular FROM a line

What's the reason that we have different quantities of days each month?

Is the UK legally prevented from having another referendum on Brexit?

Lubuntu 18.10 File Manager: How to view directory tree structure?

Boss asked me to sign a resignation paper without a date on it along with my new contract

Identical projects by students at two different colleges: still plagiarism?

What is an efficient way to digitize a family photo collection?

In the Lost in Space intro why was Dr. Smith actor listed as a special guest star?

How do I add a strong "onion flavor" to the biryani (in restaurant style)?

Why did Ylvis use "go" instead of "say" in phrases like "Dog goes 'woof'"?



How to disable imageSmoothingEnabled for geoImageLayer?


How do I get ArcGIS tiles to display a single layer when multiple layers are available?Multi layer, multi controlOpenLayers 3: setCenter seems not to work in jsfiddleOpenLayers3 with google map local tiles serverMapbox Error: Style is not done loadingGeoJSON external file reloading - caching issuesOpenlayers3, vector data layer not visible after proceeding select onchange functionOpenLayers and proj4js.defs() - why does one custom projection work and not the other?How to highlight marker dynamically with leaflet and leaflet drawHow to temporary disable map click event in OpenLayers













0















Considering the code below (which uses openlayers and Viglino's ol-ext), how do I disable imageSmoothingEnabled for the geoImageLayer? I am trying to achieve the same thing as in this question, but for the geoImageLayer, which is part of Viglino's ol-ext.



var map = new ol.Map({
target: 'map',
view: new ol.View({
zoom: 18,
center: ol.proj.fromLonLat([4.8728,52.3316])
}),
layers: [new ol.layer.Tile({
source: new ol.source.OSM()
})]
})

var geoImageLayer = new ol.layer.Image({
name: "Georef",
opacity: 0.5,
source: new ol.source.GeoImage({
url: 'image.jpg',
imageCenter: ol.proj.fromLonLat([4.8728,52.3316]),
projection: 'EPSG:3857',
imageScale: [1, 1]
})
})
map.addLayer(geoimg);


The internet says that this should work:



map.on('precompose', function(evt) {
evt.context.imageSmoothingEnabled = false;
});


And it does work for the background OSM layer, but it does nothing for the geoImageLayer



I've also tried,



geoImageLayer.on('change', function(evt) {
evt.target.values_.source.canvas_.canvas_.getContext('2d').imageSmoothingEnabled = false;
});


but it didn't do the trick. Probably because I'm modifying a copy of the actual layer, but I don't have any other ideas.



Here is a jsfiddle with the above code.









share



























    0















    Considering the code below (which uses openlayers and Viglino's ol-ext), how do I disable imageSmoothingEnabled for the geoImageLayer? I am trying to achieve the same thing as in this question, but for the geoImageLayer, which is part of Viglino's ol-ext.



    var map = new ol.Map({
    target: 'map',
    view: new ol.View({
    zoom: 18,
    center: ol.proj.fromLonLat([4.8728,52.3316])
    }),
    layers: [new ol.layer.Tile({
    source: new ol.source.OSM()
    })]
    })

    var geoImageLayer = new ol.layer.Image({
    name: "Georef",
    opacity: 0.5,
    source: new ol.source.GeoImage({
    url: 'image.jpg',
    imageCenter: ol.proj.fromLonLat([4.8728,52.3316]),
    projection: 'EPSG:3857',
    imageScale: [1, 1]
    })
    })
    map.addLayer(geoimg);


    The internet says that this should work:



    map.on('precompose', function(evt) {
    evt.context.imageSmoothingEnabled = false;
    });


    And it does work for the background OSM layer, but it does nothing for the geoImageLayer



    I've also tried,



    geoImageLayer.on('change', function(evt) {
    evt.target.values_.source.canvas_.canvas_.getContext('2d').imageSmoothingEnabled = false;
    });


    but it didn't do the trick. Probably because I'm modifying a copy of the actual layer, but I don't have any other ideas.



    Here is a jsfiddle with the above code.









    share

























      0












      0








      0








      Considering the code below (which uses openlayers and Viglino's ol-ext), how do I disable imageSmoothingEnabled for the geoImageLayer? I am trying to achieve the same thing as in this question, but for the geoImageLayer, which is part of Viglino's ol-ext.



      var map = new ol.Map({
      target: 'map',
      view: new ol.View({
      zoom: 18,
      center: ol.proj.fromLonLat([4.8728,52.3316])
      }),
      layers: [new ol.layer.Tile({
      source: new ol.source.OSM()
      })]
      })

      var geoImageLayer = new ol.layer.Image({
      name: "Georef",
      opacity: 0.5,
      source: new ol.source.GeoImage({
      url: 'image.jpg',
      imageCenter: ol.proj.fromLonLat([4.8728,52.3316]),
      projection: 'EPSG:3857',
      imageScale: [1, 1]
      })
      })
      map.addLayer(geoimg);


      The internet says that this should work:



      map.on('precompose', function(evt) {
      evt.context.imageSmoothingEnabled = false;
      });


      And it does work for the background OSM layer, but it does nothing for the geoImageLayer



      I've also tried,



      geoImageLayer.on('change', function(evt) {
      evt.target.values_.source.canvas_.canvas_.getContext('2d').imageSmoothingEnabled = false;
      });


      but it didn't do the trick. Probably because I'm modifying a copy of the actual layer, but I don't have any other ideas.



      Here is a jsfiddle with the above code.









      share














      Considering the code below (which uses openlayers and Viglino's ol-ext), how do I disable imageSmoothingEnabled for the geoImageLayer? I am trying to achieve the same thing as in this question, but for the geoImageLayer, which is part of Viglino's ol-ext.



      var map = new ol.Map({
      target: 'map',
      view: new ol.View({
      zoom: 18,
      center: ol.proj.fromLonLat([4.8728,52.3316])
      }),
      layers: [new ol.layer.Tile({
      source: new ol.source.OSM()
      })]
      })

      var geoImageLayer = new ol.layer.Image({
      name: "Georef",
      opacity: 0.5,
      source: new ol.source.GeoImage({
      url: 'image.jpg',
      imageCenter: ol.proj.fromLonLat([4.8728,52.3316]),
      projection: 'EPSG:3857',
      imageScale: [1, 1]
      })
      })
      map.addLayer(geoimg);


      The internet says that this should work:



      map.on('precompose', function(evt) {
      evt.context.imageSmoothingEnabled = false;
      });


      And it does work for the background OSM layer, but it does nothing for the geoImageLayer



      I've also tried,



      geoImageLayer.on('change', function(evt) {
      evt.target.values_.source.canvas_.canvas_.getContext('2d').imageSmoothingEnabled = false;
      });


      but it didn't do the trick. Probably because I'm modifying a copy of the actual layer, but I don't have any other ideas.



      Here is a jsfiddle with the above code.







      raster openlayers javascript





      share












      share










      share



      share










      asked 5 mins ago









      AndreiAndrei

      16017




      16017






















          0






          active

          oldest

          votes











          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
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f313362%2fhow-to-disable-imagesmoothingenabled-for-geoimagelayer%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          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.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f313362%2fhow-to-disable-imagesmoothingenabled-for-geoimagelayer%23new-answer', 'question_page');
          }
          );

          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







          Popular posts from this blog

          Щит и меч (фильм) Содержание Названия серий | Сюжет |...

          Венесуэла на летних Олимпийских играх 2000 Содержание Состав...

          Meter-Bus Содержание Параметры шины | Стандартизация |...