I`m struggling with my Geoserver resp. OpenLayers.
Environment: Ubuntu 1804, Tomcat8, Geoserver 2.13.2
I just want to publish vector and raster data from my own server. I can upload the files on my server and the Layers Preview is working correctly.
Also, the wfs-t example in the /www folder is working correctly.
http://193.31.24.240:8080/geoserver/www/wfs-t.html
But I can`t use any other map I tried the Simple Map Example from OpenLayers Example page, changed nothing but it is not working.
http://193.31.24.240:8080/geoserver/www/index.html
I tried about 15 different tutorials, the Projection system is clear EPSG:4326, checked the extent but I never get it running.
A normal HTML page is running so I assume my server is running and working. http://193.31.24.240:8080/geoserver/www/index_work.html
-
My Preview example needs some time to load, it`s just a test tif without pyramids.user1504307– user15043072018年08月29日 09:11:24 +00:00Commented Aug 29, 2018 at 9:11
-
What do you mean when you say that 'it is not working?' Is the HTML page itself not showing up? Or are only the WMS layers not showing up? Do you see any errors on the developer console?Devdatta Tengshe– Devdatta Tengshe2018年08月29日 09:37:10 +00:00Commented Aug 29, 2018 at 9:37
-
Hi it`s a complete blank page. You see it when you click on 193.31.24.240:8080/geoserver/www/index.html on some pages i got this message in developer console: SyntaxError: import declarations may only appear at top level of a moduleuser1504307– user15043072018年08月29日 09:52:53 +00:00Commented Aug 29, 2018 at 9:52
1 Answer 1
In your current Application, You have code like:
import Map from 'ol/Map.js';
import View from 'ol/View.js';
import TileLayer from 'ol/layer/Tile.js';
import OSM from 'ol/source/OSM.js';
You are facing a Problem, because Most Browsers don't understand this import
statement. OL3 onwards, you need to use a Modern Javascript Toolchain, to build up the app, since OL3 is built on Modules.
So what should you do?
1)You should look at https://openlayers.org/en/latest/doc/tutorials/bundle.html
This page talks about how you can create an app using NPM. There are other help pages which talk of using webpack, RollUp, Parcel & Browserify as well as
2)If this is too complicated, just use Leaflet instead; leaflet is more user-friendly, and extremely accessible to beginners. What you want, can easily be done using these 2 tutorials: Quick Start & Using WMS
-
Thank you so much for your answers, I was able to do it with npm and bundles.user1504307– user15043072018年08月30日 07:26:15 +00:00Commented Aug 30, 2018 at 7:26
Explore related questions
See similar questions with these tags.