Comments (2)
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.
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)
- Book Question HOT 2
- css button.active typo? HOT 1
- Uncaught TypeError: this.scrollTo is not a function HOT 7
- dynamic forms HOT 3
- API availability HOT 3
- ch04_thematic question HOT 4
- categorized colors are invalid (sometimes) HOT 1
- ch05_draw handleEvents question HOT 2
- ch05_measure question HOT 2
- ch03_fileapi question HOT 1
- ch03_layertree question HOT 2
- How to draw geometry on preexisting layers? HOT 1
- styleGraduated missing typeof HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mastering_openlayers3.