epyks23,

you must copy the two files that comprise ol3-layerswitcher and save 
them in your folder alongside the html file:
https://github.com/walkermatt/ol3-layerswitcher/tree/master/src

The two files are:
https://raw.githubusercontent.com/walkermatt/ol3-layerswitcher/master/src/ol3-layerswitcher.js
https://raw.githubusercontent.com/walkermatt/ol3-layerswitcher/master/src/ol3-layerswitcher.css

You have a further error message that indicates that you might have a 
JavaScript cross-origin problem:
http://openlayers.org/en/v3.12.1/apidoc/ol.source.TileWMS.html
https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image

If this error persists once you have copied the js and css, either 
deploy the html, js, and css so that they are delivered by your server 
(rather than as a local file) or enable CORS in your server. This error 
should not affect WMS GetMap, but JavaScript security rules by default 
will block cross-origin XML requests (I think GeoFeatureInfo will be 
affected).

Kind regards,
Ben.

On 05/01/16 16:41, epyks23 wrote:
> Hi,
>
> I do not see the layer switcher in the map. This is what I see when I open
> the map directly through the GeoServer - User website
>
> tile.PNG <http://osgeo-org.1560.x6.nabble.com/file/n5243705/tile.PNG>
>
> When I save the html file and open it in my browser, the topp:states layer
> does not show.
>
> I modified the file to insert my layer. It does not show up on the map. I
> get this error instead:
> error.PNG <http://osgeo-org.1560.x6.nabble.com/file/n5243705/error.PNG>
>
> It cannot find the .js and .css of the ol3-layerswitcher. Does this mean I
> need to create these two files? What code do I need to put in them?
>
>
>
> --
> View this message in context: 
> http://osgeo-org.1560.x6.nabble.com/layerswitcher-js-and-adding-vector-data-from-Geoserver-tp5243249p5243705.html
> Sent from the GeoServer - User mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Geoserver-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>

-- 
Ben Caradoc-Davies <[email protected]>
Director
Transient Software Limited <http://transient.nz/>
New Zealand

------------------------------------------------------------------------------
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to