I am currently trying to use the time dimension plug-in from leaflet to show ocean currents in a time range. I have different WMS for each month, and an I am creating a viewer with a date picker to give the user the option to select a date range.
However, I am not able to include several WMS layers at the same time dimension layer. I don't know if this is possible.
I have tried to include all wms layers separated by a comma, but it doesn't work...
var MohidLayer = L.timeDimension.layer.wms(MohidWMS);
var MohidWMS = L.tileLayer.wms("http://192.168.201.1:8601/ncWMS2/wms", {
layers: 'RB_01_2018/velocity_U:velocity_V-group,RB_02_2018/velocity_U:velocity_V-group',
version: '1.3.0',
format: 'image/png',
transparent: true,
styles:'default/x-Sst,default/x-Sst',
attribution:'MOHID/Meteogalicia',
elevation: 35,
// crossOrigin: null,
colorscalerange: '0.00293,0.4695'
// crs: 'EPSG:4326'
});
Related
I'm using OpenLayers (v6.3.1) with ol-ext extensions (to handle animated clustering) on a simple html/javascript/jquery project.
I succeeded displaying data from a geojson with a vector source passed to cluster source then added to a layer.
My goal is now to add/remove filters (by user interaction) to the geojson fields displayed on the map.
The code of vector/cluster sources and the cluster layer :
const clusterSource = new ol.source.Cluster({
distance: 40,
source: new ol.source.Vector({
url: `${URL_PATH}`,
format: new ol.format.GeoJSON(),
})
});
const clusterLayer = new ol.layer.AnimatedCluster({
name: 'Cluster',
source: clusterSource,
animationDuration: $("#animatecluster").prop('checked') ? 700 : 0,
// Cluster style
style: getStyle
});
I'm stuck on the filtering part : should I filter the features array and replace the source of my layer? Or is there a easier way to do it with Openlayers?
Thanks for any help!
I'm using KMZ file, that has png file as layer, plus kml file itself with coordinates. However i'm having issue with PNG overlapping an actual map (city names, country names, etc), everything is behind KML layer.
Code:
let kml = new google.maps.KmlLayer('https://***.com/2g.kmz?dummy=' + (new Date()).getTime(), {suppressInfoWindows: true, preserveViewport: false})
this.kml.setMap(this.map)
Fiddle: http://jsfiddle.net/webcoderkz/x7jgr9n4/6/
Solved this:
img[src*="kmz"] {
opacity: 0.5;
}
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 12,
center: {lat: 37.06, lng: -95.68}
});
var kmlLayer = new google.maps.KmlLayer({
url: 'http://googlemaps.github.io/kml-samples/kml/Placemark/placemark.kml',
suppressInfoWindows: true,
map: map
});
}
A simple example of loading a KML file, which will display the placemarks on the map, taken from: https://developers.google.com/maps/documentation/javascript/examples/layer-kml-features
My question is, how can I toggle the placemarks? I want to have all of them disabled at first, but as I run tests, searches, or whatever, I can have certain ones displayed. How can I do this?
You can't modify the displayed placemarks in a KmlLayer dynamically.
Options:
use a third party KML parser like geoxml3 or geoxml-v3, they display the KML as native Google Maps Javascript API v3 objects, which can be hidden/shown dynamically.
example
import your KML into FusionTables and use a FusionTablesLayer, you can toggle the displayed objects by changing the layer query.
create dynamic KML on your server and display that using KmlLayer
I have created a map using OpenLayers3 which contains two layers. First layer is Open Street Map Layer and the second one is WMS layer provided by the Map Server.
Problem- When i'm rendering first layer it is rendering properly no issue. but when i'm rendering the second layer(provide by map server) it renders incorrectly means it does not fit to its container and it is out of sync with the first layer in terms of location. See this snapshot of the maps for more clarification. In the snapshot top layer is wms layer provide by map server.
Also when i'm zooming or moving the map then both layers work correctly but after a delay of few seconds the second layer(wms layer from map server) again switches back to its initial position(Position that is shown in above attached snapshot).
This is the code that i'm using to consume wms service.
var layer = new ol.layer.Image({
source: new ol.source.ImageWMS({
url: 'http://localhost:19090/rasters/world/wms',
params: {
'LAYERS': 'world',
'mode': 'map',
},
serverType: 'mapserver'
})
});
This is my map file.
MAP
NAME "world"
CONFIG "MS_ERRORFILE" "/home/neelesh/Projects/georbis/data/logs/mapservice_errors.log"
CONFIG "PROJ_LIB" "/home/neelesh/Projects/georbis/deps/proj.4-master/share/proj"
CONFIG "ON_MISSING_DATA" "LOG"
DEBUG 5
EXTENT -180.000 -90.000 180.000 90.000
SHAPEPATH "/home/neelesh/Projects/georbis/data/service_data/data/wms"
IMAGECOLOR 255 255 255
SIZE 1350 675
WEB
METADATA
"wms_title" "Georbis WMS Server"
"wms_author" "VizExperts"
"wms_onlineresource" "http://192.168.1.36:19090/rasters/world/wms?"
"wms_enable_request" "*"
"wms_srs" "EPSG:4326 EPSG:3857"
"wms_feature_info_mime_type" "text/html"
"wms_format" "image/jpg"
END
END
PROJECTION
"init=epsg:4326"
END
LAYER
NAME world
TYPE RASTER
DATA "world.tif"
METADATA
"wms_title" "BlueWorld Map"
"wms_srs" "epsg:4326"
"wms_server_version" "1.1.1"
END
PROJECTION
"init=epsg:4326"
END
END
END
I tried ol.view.fit method to fit the layer to its container but the value of layer.getExtent() for the layer is undefined.
Pleas help me to find out what is wrong. is there any problem with wms request format or the map file?
It's because you configured your MapServer to support only EPSG 4326. It should support EPSG 3857 (the OSM tiles). You should change "wms_srs" "epsg:4326" to "wms_srs" "EPSG:4326 EPSG:3857" (see the official WMS server doc). You can confirm it works doing a GetCapabilities request.
When you use GeoServer, by default, it supports all projections for WMS (so it works because your WMS images are requested with EPSG 3857)
You should be aware that now you can also do raster reprojection on client in OpenLayers. For some demos, go to http://openlayers.org/en/v3.11.0/examples/ and search with keyword "reprojection"
I am trying to import a bunch of KML files from the server and then adding them to the Map. I have an overall count of 23 KML files on the server which i plan to import on the map.
However what i experience is that it would only allow me to import 18 kml layer on the map not more than that. The moment i add an extra one in the list it would just not show anything but than a plan Google map.
Is there a limitation on the number of KML files i can import on a map ? If yes is there a way to work around because i have 23 files in all.
var ctaLayer1 = new google.maps.KmlLayer({
url:'http://www.xyz.com/cfv/maps/1ALL.kml'
});
var ctaLayer2 = new google.maps.KmlLayer({
url:'http://www.xyz.com/cfv/maps/2ALL.kml'
});
ctaLayer1.setMap(map);
ctaLayer2.setMap(map);
ctaLayer3.setMap(map);
ctaLayer4.setMap(map);
ctaLayer5.setMap(map);
ctaLayer6.setMap(map);
ctaLayer7.setMap(map);
ctaLayer8.setMap(map);
ctaLayer9.setMap(map);
ctaLayer10.setMap(map);
ctaLayer11.setMap(map);
ctaLayer12.setMap(map);
ctaLayer13.setMap(map);
ctaLayer14.setMap(map);
ctaLayer15.setMap(map);
ctaLayer16.setMap(map);
//ctaLayer17.setMap(map);
//ctaLayer18.setMap(map);
ctaLayer19.setMap(map);
ctaLayer20.setMap(map);
// ctaLayer21.setMap(map);
// ctaLayer22.setMap(map);
//ctaLayer23.setMap(map);
There is a limit. Check google docs:
There is a limit on the number of KML Layers that can be displayed on a single Google Map. If you exceed this limit, none of your layers will display. The limit is based on the total length of all URLs passed to the KMLLayer class, and consequently will vary by application; on average, you should be able to load between 10 and 20 layers without hitting the limit.