How to add WFS and WMS in openlayers?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I have two service url like WFS and WMS below:
http://neii.bom.gov.au/services/solarclim/wms/data/monClim_dirNorExp1Hou.nc?service=WMS&version=1.3.0&request=GetCapabilities&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image/png&TRANSPARENT=true&LAYERS=topp:states&TILED=true&WIDTH=256&HEIGHT=256&CRS=EPSG:4326&STYLES=&BBOX=45%2c-67.5%2c56.25%2c-56.25
http://services.land.vic.gov.au/catalogue/publicproxy/guest/dv_geoserver/datavic/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=datavic:VMADMIN_LGA_POLYGON&SRSNAME=EPSG:4283&cql_filter=LGA_CODE=325
I want those two services need to add as layer in my openlayers map. Is it possible and how?
Updated code with sample data:
myFunction(layerUrl:string, layer: any) {
var bbox = layer.BoundingBox[0].extent;
var crs = layer.BoundingBox[0].crs;
var wmsSource = new ol.source.TileWMS({
url: `${layerUrl}`,
params: {'LAYERS': `${layer.Name}`, 'TILED': true},
serverType: 'geoserver',
projection: `${crs}`,
// Countries have transparency, so do not fade tiles:
transition: 0
});
var wmsLayer = new ol.layer.Tile({
extent: bbox,
source: wmsSource
});
map.addLayer(wmsLayer);
map.getView().fit(wmsLayer.getExtent());
}
Layer url here:
https://wms.geo.admin.ch/
Here is layer object:
Abstract: "Als Kulturgüter von nationaler Bedeutung im Inventar von 2009 gelten rund 3200 Objekte (Einzelbauten / Sammlungen in Museeen, Archiven und Bibliotheken sowie Archäologie)."
Attribution: {Title: "Das Geoportal des Bundes", OnlineResource: "http://www.geo.admin.ch/", LogoURL: {…}}
BoundingBox: [{…}]
CRS: (14) ["epsg:2056", "epsg:21781", "epsg:4326", "epsg:3857", "epsg:3034", "epsg:3035", "epsg:4258", "epsg:31287", "epsg:25832", "epsg:25833", "epsg:31467", "epsg:32632", "epsg:32633", "epsg:900913"]
Dimension: undefined
EX_GeographicBoundingBox: (4) [0.659965, 45.4183, 10.8344, 48.7495]
Layer: (2) [{…}, {…}]
MaxScaleDenominator: undefined
MinScaleDenominator: undefined
Name: "ch.babs.kulturgueter"
Style: [{…}]
Title: "KGS Inventar"
cascaded: undefined
fixedHeight: undefined
fixedWidth: undefined
noSubsets: false
opaque: false
queryable: false
__proto__: Object
openlayers
|
show 3 more comments
I have two service url like WFS and WMS below:
http://neii.bom.gov.au/services/solarclim/wms/data/monClim_dirNorExp1Hou.nc?service=WMS&version=1.3.0&request=GetCapabilities&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image/png&TRANSPARENT=true&LAYERS=topp:states&TILED=true&WIDTH=256&HEIGHT=256&CRS=EPSG:4326&STYLES=&BBOX=45%2c-67.5%2c56.25%2c-56.25
http://services.land.vic.gov.au/catalogue/publicproxy/guest/dv_geoserver/datavic/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=datavic:VMADMIN_LGA_POLYGON&SRSNAME=EPSG:4283&cql_filter=LGA_CODE=325
I want those two services need to add as layer in my openlayers map. Is it possible and how?
Updated code with sample data:
myFunction(layerUrl:string, layer: any) {
var bbox = layer.BoundingBox[0].extent;
var crs = layer.BoundingBox[0].crs;
var wmsSource = new ol.source.TileWMS({
url: `${layerUrl}`,
params: {'LAYERS': `${layer.Name}`, 'TILED': true},
serverType: 'geoserver',
projection: `${crs}`,
// Countries have transparency, so do not fade tiles:
transition: 0
});
var wmsLayer = new ol.layer.Tile({
extent: bbox,
source: wmsSource
});
map.addLayer(wmsLayer);
map.getView().fit(wmsLayer.getExtent());
}
Layer url here:
https://wms.geo.admin.ch/
Here is layer object:
Abstract: "Als Kulturgüter von nationaler Bedeutung im Inventar von 2009 gelten rund 3200 Objekte (Einzelbauten / Sammlungen in Museeen, Archiven und Bibliotheken sowie Archäologie)."
Attribution: {Title: "Das Geoportal des Bundes", OnlineResource: "http://www.geo.admin.ch/", LogoURL: {…}}
BoundingBox: [{…}]
CRS: (14) ["epsg:2056", "epsg:21781", "epsg:4326", "epsg:3857", "epsg:3034", "epsg:3035", "epsg:4258", "epsg:31287", "epsg:25832", "epsg:25833", "epsg:31467", "epsg:32632", "epsg:32633", "epsg:900913"]
Dimension: undefined
EX_GeographicBoundingBox: (4) [0.659965, 45.4183, 10.8344, 48.7495]
Layer: (2) [{…}, {…}]
MaxScaleDenominator: undefined
MinScaleDenominator: undefined
Name: "ch.babs.kulturgueter"
Style: [{…}]
Title: "KGS Inventar"
cascaded: undefined
fixedHeight: undefined
fixedWidth: undefined
noSubsets: false
opaque: false
queryable: false
__proto__: Object
openlayers
See this example FOR WMS openlayers.org/en/latest/examples/wms-tiled.html FOR WFS openlayers.org/en/latest/examples/vector-wfs.html
– Atanu
Nov 23 '18 at 8:59
Try using that example if you found any problem show us what you did we will help you
– Atanu
Nov 23 '18 at 9:01
@Atanu in your given wms example extent is hard code, how to use dynamic one?
– user10496245
Nov 23 '18 at 10:37
See this example also openlayers.org/en/latest/examples/wms-no-proj.html
– Atanu
Nov 23 '18 at 11:19
Hi @Atanu thanks for your quick reply. From this service url ahocevar.com/geoserver/wms I am getting list of layers and now I want to show some layers from the list not all. Suppose that one layer, can you provide some sample code by which I can add that specific layer into openlayers map?
– user10496245
Nov 23 '18 at 11:41
|
show 3 more comments
I have two service url like WFS and WMS below:
http://neii.bom.gov.au/services/solarclim/wms/data/monClim_dirNorExp1Hou.nc?service=WMS&version=1.3.0&request=GetCapabilities&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image/png&TRANSPARENT=true&LAYERS=topp:states&TILED=true&WIDTH=256&HEIGHT=256&CRS=EPSG:4326&STYLES=&BBOX=45%2c-67.5%2c56.25%2c-56.25
http://services.land.vic.gov.au/catalogue/publicproxy/guest/dv_geoserver/datavic/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=datavic:VMADMIN_LGA_POLYGON&SRSNAME=EPSG:4283&cql_filter=LGA_CODE=325
I want those two services need to add as layer in my openlayers map. Is it possible and how?
Updated code with sample data:
myFunction(layerUrl:string, layer: any) {
var bbox = layer.BoundingBox[0].extent;
var crs = layer.BoundingBox[0].crs;
var wmsSource = new ol.source.TileWMS({
url: `${layerUrl}`,
params: {'LAYERS': `${layer.Name}`, 'TILED': true},
serverType: 'geoserver',
projection: `${crs}`,
// Countries have transparency, so do not fade tiles:
transition: 0
});
var wmsLayer = new ol.layer.Tile({
extent: bbox,
source: wmsSource
});
map.addLayer(wmsLayer);
map.getView().fit(wmsLayer.getExtent());
}
Layer url here:
https://wms.geo.admin.ch/
Here is layer object:
Abstract: "Als Kulturgüter von nationaler Bedeutung im Inventar von 2009 gelten rund 3200 Objekte (Einzelbauten / Sammlungen in Museeen, Archiven und Bibliotheken sowie Archäologie)."
Attribution: {Title: "Das Geoportal des Bundes", OnlineResource: "http://www.geo.admin.ch/", LogoURL: {…}}
BoundingBox: [{…}]
CRS: (14) ["epsg:2056", "epsg:21781", "epsg:4326", "epsg:3857", "epsg:3034", "epsg:3035", "epsg:4258", "epsg:31287", "epsg:25832", "epsg:25833", "epsg:31467", "epsg:32632", "epsg:32633", "epsg:900913"]
Dimension: undefined
EX_GeographicBoundingBox: (4) [0.659965, 45.4183, 10.8344, 48.7495]
Layer: (2) [{…}, {…}]
MaxScaleDenominator: undefined
MinScaleDenominator: undefined
Name: "ch.babs.kulturgueter"
Style: [{…}]
Title: "KGS Inventar"
cascaded: undefined
fixedHeight: undefined
fixedWidth: undefined
noSubsets: false
opaque: false
queryable: false
__proto__: Object
openlayers
I have two service url like WFS and WMS below:
http://neii.bom.gov.au/services/solarclim/wms/data/monClim_dirNorExp1Hou.nc?service=WMS&version=1.3.0&request=GetCapabilities&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image/png&TRANSPARENT=true&LAYERS=topp:states&TILED=true&WIDTH=256&HEIGHT=256&CRS=EPSG:4326&STYLES=&BBOX=45%2c-67.5%2c56.25%2c-56.25
http://services.land.vic.gov.au/catalogue/publicproxy/guest/dv_geoserver/datavic/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=datavic:VMADMIN_LGA_POLYGON&SRSNAME=EPSG:4283&cql_filter=LGA_CODE=325
I want those two services need to add as layer in my openlayers map. Is it possible and how?
Updated code with sample data:
myFunction(layerUrl:string, layer: any) {
var bbox = layer.BoundingBox[0].extent;
var crs = layer.BoundingBox[0].crs;
var wmsSource = new ol.source.TileWMS({
url: `${layerUrl}`,
params: {'LAYERS': `${layer.Name}`, 'TILED': true},
serverType: 'geoserver',
projection: `${crs}`,
// Countries have transparency, so do not fade tiles:
transition: 0
});
var wmsLayer = new ol.layer.Tile({
extent: bbox,
source: wmsSource
});
map.addLayer(wmsLayer);
map.getView().fit(wmsLayer.getExtent());
}
Layer url here:
https://wms.geo.admin.ch/
Here is layer object:
Abstract: "Als Kulturgüter von nationaler Bedeutung im Inventar von 2009 gelten rund 3200 Objekte (Einzelbauten / Sammlungen in Museeen, Archiven und Bibliotheken sowie Archäologie)."
Attribution: {Title: "Das Geoportal des Bundes", OnlineResource: "http://www.geo.admin.ch/", LogoURL: {…}}
BoundingBox: [{…}]
CRS: (14) ["epsg:2056", "epsg:21781", "epsg:4326", "epsg:3857", "epsg:3034", "epsg:3035", "epsg:4258", "epsg:31287", "epsg:25832", "epsg:25833", "epsg:31467", "epsg:32632", "epsg:32633", "epsg:900913"]
Dimension: undefined
EX_GeographicBoundingBox: (4) [0.659965, 45.4183, 10.8344, 48.7495]
Layer: (2) [{…}, {…}]
MaxScaleDenominator: undefined
MinScaleDenominator: undefined
Name: "ch.babs.kulturgueter"
Style: [{…}]
Title: "KGS Inventar"
cascaded: undefined
fixedHeight: undefined
fixedWidth: undefined
noSubsets: false
opaque: false
queryable: false
__proto__: Object
openlayers
openlayers
edited Nov 23 '18 at 16:26
user10496245
asked Nov 22 '18 at 15:28
user10496245user10496245
406
406
See this example FOR WMS openlayers.org/en/latest/examples/wms-tiled.html FOR WFS openlayers.org/en/latest/examples/vector-wfs.html
– Atanu
Nov 23 '18 at 8:59
Try using that example if you found any problem show us what you did we will help you
– Atanu
Nov 23 '18 at 9:01
@Atanu in your given wms example extent is hard code, how to use dynamic one?
– user10496245
Nov 23 '18 at 10:37
See this example also openlayers.org/en/latest/examples/wms-no-proj.html
– Atanu
Nov 23 '18 at 11:19
Hi @Atanu thanks for your quick reply. From this service url ahocevar.com/geoserver/wms I am getting list of layers and now I want to show some layers from the list not all. Suppose that one layer, can you provide some sample code by which I can add that specific layer into openlayers map?
– user10496245
Nov 23 '18 at 11:41
|
show 3 more comments
See this example FOR WMS openlayers.org/en/latest/examples/wms-tiled.html FOR WFS openlayers.org/en/latest/examples/vector-wfs.html
– Atanu
Nov 23 '18 at 8:59
Try using that example if you found any problem show us what you did we will help you
– Atanu
Nov 23 '18 at 9:01
@Atanu in your given wms example extent is hard code, how to use dynamic one?
– user10496245
Nov 23 '18 at 10:37
See this example also openlayers.org/en/latest/examples/wms-no-proj.html
– Atanu
Nov 23 '18 at 11:19
Hi @Atanu thanks for your quick reply. From this service url ahocevar.com/geoserver/wms I am getting list of layers and now I want to show some layers from the list not all. Suppose that one layer, can you provide some sample code by which I can add that specific layer into openlayers map?
– user10496245
Nov 23 '18 at 11:41
See this example FOR WMS openlayers.org/en/latest/examples/wms-tiled.html FOR WFS openlayers.org/en/latest/examples/vector-wfs.html
– Atanu
Nov 23 '18 at 8:59
See this example FOR WMS openlayers.org/en/latest/examples/wms-tiled.html FOR WFS openlayers.org/en/latest/examples/vector-wfs.html
– Atanu
Nov 23 '18 at 8:59
Try using that example if you found any problem show us what you did we will help you
– Atanu
Nov 23 '18 at 9:01
Try using that example if you found any problem show us what you did we will help you
– Atanu
Nov 23 '18 at 9:01
@Atanu in your given wms example extent is hard code, how to use dynamic one?
– user10496245
Nov 23 '18 at 10:37
@Atanu in your given wms example extent is hard code, how to use dynamic one?
– user10496245
Nov 23 '18 at 10:37
See this example also openlayers.org/en/latest/examples/wms-no-proj.html
– Atanu
Nov 23 '18 at 11:19
See this example also openlayers.org/en/latest/examples/wms-no-proj.html
– Atanu
Nov 23 '18 at 11:19
Hi @Atanu thanks for your quick reply. From this service url ahocevar.com/geoserver/wms I am getting list of layers and now I want to show some layers from the list not all. Suppose that one layer, can you provide some sample code by which I can add that specific layer into openlayers map?
– user10496245
Nov 23 '18 at 11:41
Hi @Atanu thanks for your quick reply. From this service url ahocevar.com/geoserver/wms I am getting list of layers and now I want to show some layers from the list not all. Suppose that one layer, can you provide some sample code by which I can add that specific layer into openlayers map?
– user10496245
Nov 23 '18 at 11:41
|
show 3 more comments
1 Answer
1
active
oldest
votes
Sorry for late reply, but i use this code in my project with custom settings and this provide me a valid output.
Code is as follows [ please change static ip with your variable ]
var wmsSource = new ol.source.TileWMS({
url: 'https://wms.geo.admin.ch/',
params: {'LAYERS': 'ch.babs.kulturgueter','TILED': true},
serverType: 'geoserver',
projection: 'EPSG:4326',
transition: 0
});
var wmsLayer = new ol.layer.Tile({
source: wmsSource
});
map.addLayer(wmsLayer);
And the output is as follows: [ working just fine ]
Hi @Atanu, can I use your code for wfs service also? I think wms and wfs same thing, right?
– user10496245
Nov 26 '18 at 11:51
@user10496245 wfs is basically Vector Layer source, Not an WMS title, See this example openlayers.org/en/latest/examples/vector-wfs.html
– Atanu
Nov 26 '18 at 11:55
they used the url as example is confusing to me: 'ahocevar.com/geoserver/wfs?service=WFS&' + 'version=1.1.0&request=GetFeature&typename=osm:water_areas&' + 'outputFormat=application/json&srsname=EPSG:3857&' + 'bbox=' + extent.join(',') + ',EPSG:3857'
– user10496245
Nov 26 '18 at 12:03
I have seen some wfs sample url like: gisserver.domain.com:6080/arcgis/services/wfs_services/…
– user10496245
Nov 26 '18 at 12:04
in this last sample url they didn't use bbox or projection , so in this case their code will not work I think, can you help me on this issue?
– user10496245
Nov 26 '18 at 12:04
|
show 2 more comments
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53434137%2fhow-to-add-wfs-and-wms-in-openlayers%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sorry for late reply, but i use this code in my project with custom settings and this provide me a valid output.
Code is as follows [ please change static ip with your variable ]
var wmsSource = new ol.source.TileWMS({
url: 'https://wms.geo.admin.ch/',
params: {'LAYERS': 'ch.babs.kulturgueter','TILED': true},
serverType: 'geoserver',
projection: 'EPSG:4326',
transition: 0
});
var wmsLayer = new ol.layer.Tile({
source: wmsSource
});
map.addLayer(wmsLayer);
And the output is as follows: [ working just fine ]
Hi @Atanu, can I use your code for wfs service also? I think wms and wfs same thing, right?
– user10496245
Nov 26 '18 at 11:51
@user10496245 wfs is basically Vector Layer source, Not an WMS title, See this example openlayers.org/en/latest/examples/vector-wfs.html
– Atanu
Nov 26 '18 at 11:55
they used the url as example is confusing to me: 'ahocevar.com/geoserver/wfs?service=WFS&' + 'version=1.1.0&request=GetFeature&typename=osm:water_areas&' + 'outputFormat=application/json&srsname=EPSG:3857&' + 'bbox=' + extent.join(',') + ',EPSG:3857'
– user10496245
Nov 26 '18 at 12:03
I have seen some wfs sample url like: gisserver.domain.com:6080/arcgis/services/wfs_services/…
– user10496245
Nov 26 '18 at 12:04
in this last sample url they didn't use bbox or projection , so in this case their code will not work I think, can you help me on this issue?
– user10496245
Nov 26 '18 at 12:04
|
show 2 more comments
Sorry for late reply, but i use this code in my project with custom settings and this provide me a valid output.
Code is as follows [ please change static ip with your variable ]
var wmsSource = new ol.source.TileWMS({
url: 'https://wms.geo.admin.ch/',
params: {'LAYERS': 'ch.babs.kulturgueter','TILED': true},
serverType: 'geoserver',
projection: 'EPSG:4326',
transition: 0
});
var wmsLayer = new ol.layer.Tile({
source: wmsSource
});
map.addLayer(wmsLayer);
And the output is as follows: [ working just fine ]
Hi @Atanu, can I use your code for wfs service also? I think wms and wfs same thing, right?
– user10496245
Nov 26 '18 at 11:51
@user10496245 wfs is basically Vector Layer source, Not an WMS title, See this example openlayers.org/en/latest/examples/vector-wfs.html
– Atanu
Nov 26 '18 at 11:55
they used the url as example is confusing to me: 'ahocevar.com/geoserver/wfs?service=WFS&' + 'version=1.1.0&request=GetFeature&typename=osm:water_areas&' + 'outputFormat=application/json&srsname=EPSG:3857&' + 'bbox=' + extent.join(',') + ',EPSG:3857'
– user10496245
Nov 26 '18 at 12:03
I have seen some wfs sample url like: gisserver.domain.com:6080/arcgis/services/wfs_services/…
– user10496245
Nov 26 '18 at 12:04
in this last sample url they didn't use bbox or projection , so in this case their code will not work I think, can you help me on this issue?
– user10496245
Nov 26 '18 at 12:04
|
show 2 more comments
Sorry for late reply, but i use this code in my project with custom settings and this provide me a valid output.
Code is as follows [ please change static ip with your variable ]
var wmsSource = new ol.source.TileWMS({
url: 'https://wms.geo.admin.ch/',
params: {'LAYERS': 'ch.babs.kulturgueter','TILED': true},
serverType: 'geoserver',
projection: 'EPSG:4326',
transition: 0
});
var wmsLayer = new ol.layer.Tile({
source: wmsSource
});
map.addLayer(wmsLayer);
And the output is as follows: [ working just fine ]
Sorry for late reply, but i use this code in my project with custom settings and this provide me a valid output.
Code is as follows [ please change static ip with your variable ]
var wmsSource = new ol.source.TileWMS({
url: 'https://wms.geo.admin.ch/',
params: {'LAYERS': 'ch.babs.kulturgueter','TILED': true},
serverType: 'geoserver',
projection: 'EPSG:4326',
transition: 0
});
var wmsLayer = new ol.layer.Tile({
source: wmsSource
});
map.addLayer(wmsLayer);
And the output is as follows: [ working just fine ]
answered Nov 26 '18 at 11:14
AtanuAtanu
314113
314113
Hi @Atanu, can I use your code for wfs service also? I think wms and wfs same thing, right?
– user10496245
Nov 26 '18 at 11:51
@user10496245 wfs is basically Vector Layer source, Not an WMS title, See this example openlayers.org/en/latest/examples/vector-wfs.html
– Atanu
Nov 26 '18 at 11:55
they used the url as example is confusing to me: 'ahocevar.com/geoserver/wfs?service=WFS&' + 'version=1.1.0&request=GetFeature&typename=osm:water_areas&' + 'outputFormat=application/json&srsname=EPSG:3857&' + 'bbox=' + extent.join(',') + ',EPSG:3857'
– user10496245
Nov 26 '18 at 12:03
I have seen some wfs sample url like: gisserver.domain.com:6080/arcgis/services/wfs_services/…
– user10496245
Nov 26 '18 at 12:04
in this last sample url they didn't use bbox or projection , so in this case their code will not work I think, can you help me on this issue?
– user10496245
Nov 26 '18 at 12:04
|
show 2 more comments
Hi @Atanu, can I use your code for wfs service also? I think wms and wfs same thing, right?
– user10496245
Nov 26 '18 at 11:51
@user10496245 wfs is basically Vector Layer source, Not an WMS title, See this example openlayers.org/en/latest/examples/vector-wfs.html
– Atanu
Nov 26 '18 at 11:55
they used the url as example is confusing to me: 'ahocevar.com/geoserver/wfs?service=WFS&' + 'version=1.1.0&request=GetFeature&typename=osm:water_areas&' + 'outputFormat=application/json&srsname=EPSG:3857&' + 'bbox=' + extent.join(',') + ',EPSG:3857'
– user10496245
Nov 26 '18 at 12:03
I have seen some wfs sample url like: gisserver.domain.com:6080/arcgis/services/wfs_services/…
– user10496245
Nov 26 '18 at 12:04
in this last sample url they didn't use bbox or projection , so in this case their code will not work I think, can you help me on this issue?
– user10496245
Nov 26 '18 at 12:04
Hi @Atanu, can I use your code for wfs service also? I think wms and wfs same thing, right?
– user10496245
Nov 26 '18 at 11:51
Hi @Atanu, can I use your code for wfs service also? I think wms and wfs same thing, right?
– user10496245
Nov 26 '18 at 11:51
@user10496245 wfs is basically Vector Layer source, Not an WMS title, See this example openlayers.org/en/latest/examples/vector-wfs.html
– Atanu
Nov 26 '18 at 11:55
@user10496245 wfs is basically Vector Layer source, Not an WMS title, See this example openlayers.org/en/latest/examples/vector-wfs.html
– Atanu
Nov 26 '18 at 11:55
they used the url as example is confusing to me: 'ahocevar.com/geoserver/wfs?service=WFS&' + 'version=1.1.0&request=GetFeature&typename=osm:water_areas&' + 'outputFormat=application/json&srsname=EPSG:3857&' + 'bbox=' + extent.join(',') + ',EPSG:3857'
– user10496245
Nov 26 '18 at 12:03
they used the url as example is confusing to me: 'ahocevar.com/geoserver/wfs?service=WFS&' + 'version=1.1.0&request=GetFeature&typename=osm:water_areas&' + 'outputFormat=application/json&srsname=EPSG:3857&' + 'bbox=' + extent.join(',') + ',EPSG:3857'
– user10496245
Nov 26 '18 at 12:03
I have seen some wfs sample url like: gisserver.domain.com:6080/arcgis/services/wfs_services/…
– user10496245
Nov 26 '18 at 12:04
I have seen some wfs sample url like: gisserver.domain.com:6080/arcgis/services/wfs_services/…
– user10496245
Nov 26 '18 at 12:04
in this last sample url they didn't use bbox or projection , so in this case their code will not work I think, can you help me on this issue?
– user10496245
Nov 26 '18 at 12:04
in this last sample url they didn't use bbox or projection , so in this case their code will not work I think, can you help me on this issue?
– user10496245
Nov 26 '18 at 12:04
|
show 2 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53434137%2fhow-to-add-wfs-and-wms-in-openlayers%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
See this example FOR WMS openlayers.org/en/latest/examples/wms-tiled.html FOR WFS openlayers.org/en/latest/examples/vector-wfs.html
– Atanu
Nov 23 '18 at 8:59
Try using that example if you found any problem show us what you did we will help you
– Atanu
Nov 23 '18 at 9:01
@Atanu in your given wms example extent is hard code, how to use dynamic one?
– user10496245
Nov 23 '18 at 10:37
See this example also openlayers.org/en/latest/examples/wms-no-proj.html
– Atanu
Nov 23 '18 at 11:19
Hi @Atanu thanks for your quick reply. From this service url ahocevar.com/geoserver/wms I am getting list of layers and now I want to show some layers from the list not all. Suppose that one layer, can you provide some sample code by which I can add that specific layer into openlayers map?
– user10496245
Nov 23 '18 at 11:41