从你的问题来看,这是你的WMS链接@antochoy:
http://portal.ina-sdi.or.id/arcgis/services/IGD/RupabumiIndonesia/MapServer/WMSServer?request=GetCapabilities&service=WMS
对于地图部分,试试这个(它有效,我只包含你的图层名为“2”):
var layers = [ new ol.layer.Tile({ source: new ol.source.OSM() }), new ol.layer.Tile({ extent: [94.972663,-11.007615,141.029973,6.076940], source: new ol.source.TileWMS({ url: 'http://portal.ina-sdi.or.id/arcgis/services/IGD/RupabumiIndonesia/MapServer/WMSServer', params: {'LAYERS': '2', 'TILED': true}, projection: 'EPSG:4326' }) }) ]; var map = new ol.Map({ layers: layers, target: 'map', view: new ol.View({ center: [106,0], zoom: 6, projection: 'EPSG:4326' }) });
**您可以使用ARCGIS URL显示该网址的平铺层**
Openlayers 4.5
var layers = [ new ol.layer.Tile({ source: new ol.source.OSM() }), new ol.layer.Tile({ extent: [-13884991, 2870341, -7455066, 6338219], source: new ol.source.TileArcGISRest({ url: https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer }) }) ];