OpenLayers feature styling change by the baselayer The 2019 Stack Overflow Developer Survey...

Is there a name of the flying bionic bird?

"What time...?" or "At what time...?" - what is more grammatically correct?

Idiomatic way to prevent slicing?

Unbreakable Formation vs. Cry of the Carnarium

Why is it "Tumoren" and not "Tumore"?

What is the meaning of Triage in Cybersec world?

Inline version of a function returns different value then non-inline version

Are there any other methods to apply to solving simultaneous equations?

How can I create a character who can assume the widest possible range of creature sizes?

Output the Arecibo Message

Should I use my personal or workplace e-mail when registering to external websites for work purpose?

How can I fix this gap between bookcases I made?

What is the use of option -o in the useradd command?

Why isn't airport relocation done gradually?

Does it makes sense to buy a new cycle to learn riding?

Are USB sockets on wall outlets live all the time, even when the switch is off?

Could JWST stay at L2 "forever"?

What do the Banks children have against barley water?

What is a mixture ratio of propellant?

Why is Grand Jury testimony secret?

Understanding the implication of what "well-defined" means for the operation in quotient group

What is the motivation for a law requiring 2 parties to consent for recording a conversation

Is this food a bread or a loaf?

Carnot-Caratheodory metric



OpenLayers feature styling change by the baselayer



The 2019 Stack Overflow Developer Survey Results Are InIn OpenLayers displaying two images at the same timeOpenLayers: Feature edit handles not appearing when addUniqueValueRules appliedOpenlayers - Cloned features get style from original featureGeoExt Feature RendererGoogle base layer opacity change in OpenLayers 2.13OpenLayers programmatically select base layerMapServer and OpenLayers: Properly using MAXSCALEDENOM in mapfile (google baselayer)Raster overlay in OpenLayersBaselayer disappears when I draw a layerOpenLayers 3: How to Refresh map after changing a Feature's style?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















How can I have the style of the features on a vector layer depending on the OpenLayers' "base layer"?



For example, some base layers are dark images and I need (for the contrast) the features to be displayed bright in the vector layer upon the base layer. And as soon as base layer changes to a bright one, features should be redrawn dark.



How can I achieve this with OpenLayers code?










share|improve this question














bumped to the homepage by Community 3 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















    1















    How can I have the style of the features on a vector layer depending on the OpenLayers' "base layer"?



    For example, some base layers are dark images and I need (for the contrast) the features to be displayed bright in the vector layer upon the base layer. And as soon as base layer changes to a bright one, features should be redrawn dark.



    How can I achieve this with OpenLayers code?










    share|improve this question














    bumped to the homepage by Community 3 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      1












      1








      1








      How can I have the style of the features on a vector layer depending on the OpenLayers' "base layer"?



      For example, some base layers are dark images and I need (for the contrast) the features to be displayed bright in the vector layer upon the base layer. And as soon as base layer changes to a bright one, features should be redrawn dark.



      How can I achieve this with OpenLayers code?










      share|improve this question














      How can I have the style of the features on a vector layer depending on the OpenLayers' "base layer"?



      For example, some base layers are dark images and I need (for the contrast) the features to be displayed bright in the vector layer upon the base layer. And as soon as base layer changes to a bright one, features should be redrawn dark.



      How can I achieve this with OpenLayers code?







      openlayers-2 feature-layer






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 20 '14 at 9:17









      user32916user32916

      412




      412





      bumped to the homepage by Community 3 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 3 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          You can do this using a Stylemap and a context function.



          This example shows it in operation http://openlayers.org/dev/examples/styles-context.html



          Your function would return the value based upon the features layer, eg:-



          var context = {
          getColor: function(feature) {
          var baselayer = feature.map.baseLayer;

          ...

          SELECT and return your color based upon the baselayer
          ...
          }
          };





          share|improve this answer
























          • What actually worked was feature.layer.map.baseLayer.name.toString() for selection based upon the baselayer name

            – user32916
            Aug 27 '14 at 5:44














          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%2f111124%2fopenlayers-feature-styling-change-by-the-baselayer%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









          0














          You can do this using a Stylemap and a context function.



          This example shows it in operation http://openlayers.org/dev/examples/styles-context.html



          Your function would return the value based upon the features layer, eg:-



          var context = {
          getColor: function(feature) {
          var baselayer = feature.map.baseLayer;

          ...

          SELECT and return your color based upon the baselayer
          ...
          }
          };





          share|improve this answer
























          • What actually worked was feature.layer.map.baseLayer.name.toString() for selection based upon the baselayer name

            – user32916
            Aug 27 '14 at 5:44


















          0














          You can do this using a Stylemap and a context function.



          This example shows it in operation http://openlayers.org/dev/examples/styles-context.html



          Your function would return the value based upon the features layer, eg:-



          var context = {
          getColor: function(feature) {
          var baselayer = feature.map.baseLayer;

          ...

          SELECT and return your color based upon the baselayer
          ...
          }
          };





          share|improve this answer
























          • What actually worked was feature.layer.map.baseLayer.name.toString() for selection based upon the baselayer name

            – user32916
            Aug 27 '14 at 5:44
















          0












          0








          0







          You can do this using a Stylemap and a context function.



          This example shows it in operation http://openlayers.org/dev/examples/styles-context.html



          Your function would return the value based upon the features layer, eg:-



          var context = {
          getColor: function(feature) {
          var baselayer = feature.map.baseLayer;

          ...

          SELECT and return your color based upon the baselayer
          ...
          }
          };





          share|improve this answer













          You can do this using a Stylemap and a context function.



          This example shows it in operation http://openlayers.org/dev/examples/styles-context.html



          Your function would return the value based upon the features layer, eg:-



          var context = {
          getColor: function(feature) {
          var baselayer = feature.map.baseLayer;

          ...

          SELECT and return your color based upon the baselayer
          ...
          }
          };






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 20 '14 at 13:50









          user1331131user1331131

          571212




          571212













          • What actually worked was feature.layer.map.baseLayer.name.toString() for selection based upon the baselayer name

            – user32916
            Aug 27 '14 at 5:44





















          • What actually worked was feature.layer.map.baseLayer.name.toString() for selection based upon the baselayer name

            – user32916
            Aug 27 '14 at 5:44



















          What actually worked was feature.layer.map.baseLayer.name.toString() for selection based upon the baselayer name

          – user32916
          Aug 27 '14 at 5:44







          What actually worked was feature.layer.map.baseLayer.name.toString() for selection based upon the baselayer name

          – user32916
          Aug 27 '14 at 5:44




















          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%2f111124%2fopenlayers-feature-styling-change-by-the-baselayer%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 Содержание Параметры шины | Стандартизация |...