tombatossals / angular-openlayers-directive

AngularJS directive to embed an interact with maps managed by the OpenLayers library
http://tombatossals.github.io/angular-openlayers-directive/
MIT License
282 stars 184 forks source link

Having problems working with geoserver. #270

Open lehocnc opened 8 years ago

lehocnc commented 8 years ago

Hi there! Thanks for you super-easy directive with openlayers. I have tried this tool with my geoserver, but have no success! I saw an example with WMS from geoserver, but when try with my own i could not see anything. Don't know what is the problem. I can do the same with Openlayer and see the result, here some codes: in openlayer:

var wms = new OpenLayers.Layer.WMS(

        "Vn maps",

        "http://localhost:7070/geoserver/wms/vietnam_bbd",

        {layers: 'vietnam_bbd:tinh'}
        );

In directvie:

          wms: {
             source: {
                 type: 'ImageWMS', // is this optional?
                     url: 'http://localhost:7070/geoserver/vietnam_bbd/wms', 
                     params: { LAYERS: 'vietnam_bbd:tinh' },

             },

             "visible": true,
             "opacity": 1
         }

Thanks for giving this tool and wait for your response!

mooman commented 8 years ago

Your JSON looks good and, no, I don't think the source type is optional in this case.

What's in your HTML? Something like this?

 <ol-layer ol-layer-properties='wms'></ol-layer>
BizioX commented 7 years ago

Hi, is geoserver running in standalone mode on jetty? Openlayers Directive adds property " crossOrigin: 'anonymous' " to the source and jetty blocks the request because cross origin filter, try to add "crossOrigin: 'anonymous'" to openlayers naked version and check if it run, if it doesn't run, you have to enable cross on jetty

Bye, BizioX