To make web maps, GeoServer is often used to take vector data and render 
it to Web Map Service tiled images. Your OpenLayers 3 JavaScript client 
consumes these WMS tiles and displays them on the map. In this use-case, 
the JavaScript never sees vector data, only images (typically PNG). This 
is server-side map rendering.

What is your source data geometry type? Polygons, linestrings, or 
points? Do you want it rendered to web map service tiles by GeoServer? 
OpenLayers can also consume vector data. Please tell us what you are 
trying to do. This will determine whether you should be using GeoServer 
to deliver vector data (e.g. via WFS) or image data (e.g via WMS).

The url parameter is the "service endpoint". For local testing you might 
use for WMS:

url: "http://localhost:8080/geoserver/wms";

When you have deployed your GeoServer instance on a web server (for 
example services.example.org) you might change this to:

url: "http://services.example.org/geoserver/wms";

but this is dependent on server configuration. For WMS, it is your 
GeoServer web app context plus "/wms".

All together in OpenLayers 3 you can define a tiled WMS layer with 
something like:

new ol.layer.Tile({
     source: new ol.source.TileWMS({
         url: "http://services.example.org/geoserver/wms";,
         params: {
             "layers": "myns:mylayer",
             "tiled": true
         },
         serverType: "geoserver"
     })
})

The above goes inside a statement like

new ol.Map({
     target: "map",
     layers: [

[...]

Kind regards,
Ben.

On 30/12/15 15:35, epyks23 wrote:
> I am trying to follow the example of this link because I want to add vector
> data (which I have uploaded onto Geoserver) in the map:
>
> https://github.com/walkermatt/ol3-layerswitcher/blob/master/examples/layerswitcher.js
> <https://github.com/walkermatt/ol3-layerswitcher/blob/master/examples/layerswitcher.js>
>
> I am unsure about this part:
> url: 'http://demo.opengeo.org/geoserver/wms',
>
> How can I find out what is my source url?
>
> Also, since it is vector data, do I use these two:
>
> new ol.layer.Vector
> source: new ol.source.Vector
>
>
>
> --
> View this message in context: 
> http://osgeo-org.1560.x6.nabble.com/layerswitcher-js-and-adding-vector-data-from-Geoserver-tp5243249.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