Code Monkey home page Code Monkey logo

Comments (2)

GaborFarkas avatar GaborFarkas commented on June 23, 2024

Hi @kanerlevent,

Did you use a proxy file served from your web server when accessing GeoServer? The main problem with GeoServer is that it sits in a Java servlet, which has a different port than the main web server. Consequently, CORS (cross-origin resource sharing) limitations apply, and the browser won't accept any non-image data sent by GeoServer.

One way around this limitation is using a proxy file, like the one provided by the book. For this, your web server needs to be configured in a way, it can execute the proxy file written in Python.

The other way is configuring GeoServer to provide a special CORS header. With this header, browsers will no longer discard non-image responses from GeoServer. There are some online tutorials for achieving it with different types of Java servlets (Jetty, Tomcat).

Of course it can also be some other problem completely unrelated to CORS. Did you get any error message in your console (F12 in most browsers)?

from mastering_openlayers3.

miha114 avatar miha114 commented on June 23, 2024

Hello Gábor,

I realize this issue is over a year old, but I am having problems that of similar nature.

Before carrying on, I too want to say your book is of great help to me. I am learning stuff that helps me with my qGis use as well as web/GIS development.

Now to my issue: I am able to load WMS layers to my test application (I am using Firefox with cors-plugin). The script returns an error when calling createRegistry method as result of adding the layer to map -- the console reports TypeError: this.createRegistry is not a function. I am unable to hunt down the culprit for this behavior. The method fires fine when called 'manually' from init() function on both original layers.

One final note: I am running a node.js server with parcel bundler as per instruction of the OpenLayers 3 tutorials.

Edit: Just thought of one more thing -- application behaves similarly in Chromium too.
Thank you very much in advance!
Miha

from mastering_openlayers3.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.