I'm trying to display geographic information coming from a local Geoserver instalation (local Tomcat server) in an also local Drupal installation (local Apache server) through openlayers module, but I think I am missing something.

Drupal is working on a local Apache server on port 8888; Geoserver is working on local Tomcat server on port 8080.

Consider the layer "Manhattan (NY) roads" which is installed as example in Geoserver. I can preview it in Geoserver (clicking on "openlayers" button) and the GeoJSON feed is working, if I select it from the dropdown menu, also in Geoserver's Layer Preview page.

GeoJSON url is: http://localhost:8080/geoserver/tiger/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=tiger:tiger_roads&maxFeatures=50&outputFormat=application%2Fjson

and OpenLayers url is: http://localhost:8080/geoserver/tiger/wms?service=WMS&version=1.1.0&request=GetMap&layers=tiger:tiger_roads&styles=&bbox=-74.02722,40.684221,-73.907005,40.878178&width=476&height=768&srs=EPSG:4326&format=application/openlayers

I tried using these URL's / portions of it in Drupal through the openlayers modules – creating a source, a layer and a map exposed through a block – but when I enable the block I see no map, only blank space.

I may be entering wrong urls, or selecting wrong source / layer types.

Can someone point me in the right direction?


This is the Geoserver log, after trying to preview the map in Drupal:

2017-02-03 11:15:22,309 INFO [geoserver.wfs] - 
Request: getServiceInfo
2017-02-03 11:15:22,314 INFO [geoserver.wfs] - 
Request: getFeature
service = WFS
version = 1.0.0
baseUrl = http://localhost:8080/geoserver/
typeName[0] = {http://www.census.gov}tiger_roads
maxFeatures = 50
outputFormat = application/json
resultType = results
2017-02-03 11:15:22,315 INFO [wfs.json] - about to encode JSON
  • What do you see in the geoserver logs? What does your client side debug show? – BradHards Feb 3 '17 at 6:06
  • Client side debug showed "No Access-Control-Allow-Origin" error, but I temporarily solved that by using a Chrome extension (will need to find a real fix later). I've updated my question to include the Geoserver log. – BMM Feb 3 '17 at 11:13

I installed the latest development version of Openlayers3, from Drupal module archive. It solved the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.