Layer won't show on OL mapOpenLayers geometric points won't showShow map extent as a polygon onto another map...

Coworker asking me to not bring cakes due to self control issue. What should I do?

What is formjacking?

Is there a configuration of the 8-puzzle where locking a tile makes it harder?

How to make transparent background from pdf to png

How bad is a Computer Science course that doesn't teach Design Patterns?

How does holding onto an active but un-used credit card affect your ability to get a loan?

What really causes series inductance of capacitors?

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

How to run unit tests?

SQL Server Service does not start automatically after system restart

Coworker is trying to get me to sign his petition to run for office. How to decline politely?

How do I make my single-minded character more interested in the main story?

How can I differentiate duration vs starting time

How can a Sorcerer/Warlock use 4 Eldritch blasts in one round?

Is it Safe to Plug an Extension Cord Into a Power Strip?

I am a loser when it comes to jobs, what possibilities do I have?

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

Is there a way to pause a running process on Linux systems and resume later?

Does しかたない imply disappointment?

Do the speed limit reductions due to pollution also apply to electric cars in France?

How can I handle players killing my NPC outside of combat?

Have any astronauts or cosmonauts died in space?

How to store all ctor parameters in fields

What is the reward?



Layer won't show on OL map


OpenLayers geometric points won't showShow map extent as a polygon onto another map - OpenLayers 3why doesn't show feature on mapWhy won't GeoJSON load?OpenLayers 4 projection transform seems to translate latitude values 90 degrees too far southQGIS2web OL3 does not show map titleHide/show data inside Layer in OpenLayers 4Show/hide features on layer in OpenLayers?Points won't display on map using OpenLayers 3 and MapServerGeoServer WMS layer won't load on OpenLayers 5













0















I am new to OL and I'm trying what I thought was a pretty simple thing. I would like to see a second layer that shows lat/lon points. Is the code below the correct way to achieve it, or am I missing something obvious?



const projection = getProjection('EPSG:4326');
const view = new View({ projection });
const mySource = new VectorSource({ wrapX: false });
const myLayer = new VectorLayer({ source: mySource, visible: true });
this.map = new Map({target: 'myMap', layers: [
this.getMyTileLayer(), // Shows up fine
myLayer //Doesn't show
], view});

// Called externally
addToMap(lat,lon) {
// I can console.log here and I have verified the lat/lons coming in are correct
const feature = new Feature(new Point(fromLonLat([lon,lat])));
this.mySource.addFeature(feature);
}








share







New contributor




ekjcfn3902039 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0















    I am new to OL and I'm trying what I thought was a pretty simple thing. I would like to see a second layer that shows lat/lon points. Is the code below the correct way to achieve it, or am I missing something obvious?



    const projection = getProjection('EPSG:4326');
    const view = new View({ projection });
    const mySource = new VectorSource({ wrapX: false });
    const myLayer = new VectorLayer({ source: mySource, visible: true });
    this.map = new Map({target: 'myMap', layers: [
    this.getMyTileLayer(), // Shows up fine
    myLayer //Doesn't show
    ], view});

    // Called externally
    addToMap(lat,lon) {
    // I can console.log here and I have verified the lat/lons coming in are correct
    const feature = new Feature(new Point(fromLonLat([lon,lat])));
    this.mySource.addFeature(feature);
    }








    share







    New contributor




    ekjcfn3902039 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      I am new to OL and I'm trying what I thought was a pretty simple thing. I would like to see a second layer that shows lat/lon points. Is the code below the correct way to achieve it, or am I missing something obvious?



      const projection = getProjection('EPSG:4326');
      const view = new View({ projection });
      const mySource = new VectorSource({ wrapX: false });
      const myLayer = new VectorLayer({ source: mySource, visible: true });
      this.map = new Map({target: 'myMap', layers: [
      this.getMyTileLayer(), // Shows up fine
      myLayer //Doesn't show
      ], view});

      // Called externally
      addToMap(lat,lon) {
      // I can console.log here and I have verified the lat/lons coming in are correct
      const feature = new Feature(new Point(fromLonLat([lon,lat])));
      this.mySource.addFeature(feature);
      }








      share







      New contributor




      ekjcfn3902039 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I am new to OL and I'm trying what I thought was a pretty simple thing. I would like to see a second layer that shows lat/lon points. Is the code below the correct way to achieve it, or am I missing something obvious?



      const projection = getProjection('EPSG:4326');
      const view = new View({ projection });
      const mySource = new VectorSource({ wrapX: false });
      const myLayer = new VectorLayer({ source: mySource, visible: true });
      this.map = new Map({target: 'myMap', layers: [
      this.getMyTileLayer(), // Shows up fine
      myLayer //Doesn't show
      ], view});

      // Called externally
      addToMap(lat,lon) {
      // I can console.log here and I have verified the lat/lons coming in are correct
      const feature = new Feature(new Point(fromLonLat([lon,lat])));
      this.mySource.addFeature(feature);
      }






      openlayers





      share







      New contributor




      ekjcfn3902039 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      ekjcfn3902039 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      ekjcfn3902039 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 2 mins ago









      ekjcfn3902039ekjcfn3902039

      1032




      1032




      New contributor




      ekjcfn3902039 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      ekjcfn3902039 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      ekjcfn3902039 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















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


          }
          });






          ekjcfn3902039 is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f313239%2flayer-wont-show-on-ol-map%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








          ekjcfn3902039 is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          ekjcfn3902039 is a new contributor. Be nice, and check out our Code of Conduct.













          ekjcfn3902039 is a new contributor. Be nice, and check out our Code of Conduct.












          ekjcfn3902039 is a new contributor. Be nice, and check out our Code of Conduct.
















          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%2f313239%2flayer-wont-show-on-ol-map%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 Содержание Параметры шины | Стандартизация |...