Expand description
Web Mapping Service support, versions 1.1.0 and 1.3.0.
Typically one would use WebMappingService::from_url
to invoke a remote
Web Mapping Service endpoint, e.g.:
use ogc::wms::{Wms, WebMappingService};
#[tokio::main]
async fn main() -> Result<(), String> {
let url =
"http://giswebservices.massgis.state.ma.us/geoserver/wms?request=GetCapabilities&service=WMS&version=1.3.0".to_string();
let capa = WebMappingService::from_url(url.clone()).unwrap()
.get_capabilities().await.expect("Failure during GetCapabilities call");
assert_eq!(capa.service.name, "WMS");
assert_eq!(capa.service.title, "Massachusetts Data from MassGIS (GeoServer)");
Ok(())
}
§WMS GetMap Support
The supported request parameters are:
- VERSION
- LAYERS
- STYLES
- SRS
- WIDTH
- HEIGHT
- FORMAT
e.g.:
use ogc::wms::{BoundingBox, GetMapParameters, Wms, WebMappingService};
use std::fs::File;
use std::io::Write;
#[tokio::main]
async fn main() {
let url = "https://ows.terrestris.de/osm/service?";
let bytes = WebMappingService::from_url(url.to_string()).unwrap().get_map(
GetMapParameters {
layers: vec!["OSM-WMS".to_string()],
srs: "EPSG:4326".to_string(),
bbox: BoundingBox {
srs: "EPSG:4326".to_string(),
minx: -180.0,
miny: -90.0,
maxx: 180.0,
maxy: 90.0,
},
..GetMapParameters::default()
}).await.unwrap();
assert_ne!(bytes.len(), 0);
let mut file = File::create("/tmp/terrestris-get-map.png").unwrap();
assert!(file.write_all(&bytes).is_ok());
}
Structs§
- Bounding
Box - Capability
- The root element
- GetCapabilities
- GetFeature
Info - GetMap
Parameters - The parameters for a GetMap service request, as per the WMS test data spec.
- Keyword
List - LatLon
Bounding Box - Layer
- Scale
Hint - Service
- General service metadata
- Style
- WebMapping
Service - A configurable WMS endpoint
Traits§
- Wms
- Behaviour for a Web Mapping Service endpoint as per the specification.