-
-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Support for OGC API - Styles #1809
Comments
As discussed, an initial iteration could be listing/access of styles via |
I have a question regarding how styles should be configured in the pygeoapi configuration YAML file. Specifically, how should styles be associated with a collection? For example, should the style be configured under the providers section of a collection, and how would this work for both Mapbox and SLD 1.1 styles? Could you provide a sample configuration for both vector tiles (Mapbox style) and GeoJSON (SLD 1.1)? Here are two example configurations I'm trying to achieve: resources:
bathingwater-estonia:
type: collection
title: Bathing water sources
description: Data of bathing water sources used by water supply systems under the supervision of the Health Board from the Water Health Information System.
keywords:
- Water
- Water bodies
- Drilled wells
- Surface water
- Groundwater
- Environmental health
- Health
- Bathing water
links:
- type: text/html
rel: canonical
title: information
href: https://avaandmed.eesti.ee/api/datasets/slug/supluskohad
hreflang: en-US
extents:
spatial:
bbox:
[
22.2290936066586440,
57.6912449743385451,
28.2024877654160555,
59.6097269178904412,
]
crs: http://www.opengis.net/def/crs/OGC/1.3/CRS84
temporal:
begin: null
end: null # or empty
providers:
- type: feature
name: GeoJSON
data: tests/data/tartu/bathingwater-estonia.geojson
id_field: id
styles:
- name: water-bodies
title: Water Bodies SLD Style
style:
type: sld
version: 1.1
data: tests/styles/bathing_water_sources.sld
- type: tile
name: MVT-tippecanoe
data: tests/data/tiles_es/ # local directory tree
options:
zoom:
min: 0
max: 16
format:
name: pbf
mimetype: application/vnd.mapbox-vector-tile
styles:
- name: mapbox style test
title: style title
style:
type: mapbox
data: tests/styles/bathing_water_sources.json Could you confirm if this is the right way to configure the styles, and if there's anything else that should be included for proper style support? Additionally, I'm curious about the compatibility of certain style types with specific providers (assuming that it will be under providers). From what I understand, it's possible to define a GeoJSON source (either inline or as a remote URL) within a Mapbox style JSON, but it's not possible to define an SLD style for a vector tiles (PBF) provider. Could you clarify if this assumption is correct? If there are limitations on which style types (e.g., Mapbox vs. SLD) can be applied to specific providers (e.g., GeoJSON vs. PBF), it would be helpful to understand how pygeoapi handles this, and whether these limitations are enforced in the configuration. |
Should we add |
Hi @Youssef-Harby these are all valid questions, but they regard the application of styles in other Standards (e.g: tiles) and we may be stepping ourselves ahead a bit, as we do not have any support for serving the actual style, yet (: The PR I am working on aims for support for publishing styles, starting from a very simple case (e.g.: SLDs on a folder). Once we are able to provide a list of styles and styles metadata, we can start thinking about calling these styles from other APIs (: If you have some sample style files that you can provide, as examples, I would be very grateful! |
Thanks, @doublebyte1 . I am using the exercise data from https://dive.pygeoapi.io/setup/ (bathingwater-estonia) to generate a very simple style using QGIS for SLD 1.1 and Maputnik for Mapbox GL style. tests/styles/bathing_water_sources.json: {
"version": 8,
"name": "Empty Style",
"metadata": {"maputnik:renderer": "mlgljs"},
"sources": {
"earth": {
"type": "raster",
"tiles": ["https://tile.openstreetmap.org/{z}/{x}/{y}.png"],
"minzoom": 0,
"maxzoom": 16
},
"pygeoapi": {
"type": "vector",
"tiles": [
"https://localhost/collections/bathingwater-estonia/tiles/WebMercatorQuad/{z}/{x}/{y}?f=pbf"
],
"minzoom": 0,
"maxzoom": 16
}
},
"sprite": "",
"glyphs": "https://orangemug.github.io/font-glyphs/glyphs/{fontstack}/{range}.pbf",
"layers": [
{"id": "earth", "type": "raster", "source": "earth"},
{
"id": "bathingwaterestonia",
"type": "circle",
"source": "pygeoapi",
"source-layer": "bathingwaterestonia",
"paint": {"circle-color": "rgba(255, 0, 0, 1)", "circle-radius": 10}
}
],
"id": "oi0gcaa"
} tests/styles/bathing_water_sources.sld: <?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" version="1.1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:se="http://www.opengis.net/se" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd">
<NamedLayer>
<se:Name>bathingwater-estonia</se:Name>
<UserStyle>
<se:Name>bathingwater-estonia</se:Name>
<se:FeatureTypeStyle>
<se:Rule>
<se:Name>Single symbol</se:Name>
<se:PointSymbolizer>
<se:Graphic>
<se:Mark>
<se:WellKnownName>star</se:WellKnownName>
<se:Fill>
<se:SvgParameter name="fill">#b80808</se:SvgParameter>
</se:Fill>
<se:Stroke>
<se:SvgParameter name="stroke">#b80808</se:SvgParameter>
<se:SvgParameter name="stroke-width">1</se:SvgParameter>
</se:Stroke>
</se:Mark>
<se:Size>24</se:Size>
</se:Graphic>
</se:PointSymbolizer>
<se:PointSymbolizer>
<se:Graphic>
<se:Mark>
<se:WellKnownName>star</se:WellKnownName>
<se:Fill>
<se:SvgParameter name="fill">#ff0000</se:SvgParameter>
</se:Fill>
<se:Stroke>
<se:SvgParameter name="stroke">#ff0000</se:SvgParameter>
<se:SvgParameter name="stroke-width">1</se:SvgParameter>
</se:Stroke>
</se:Mark>
<se:Size>26</se:Size>
<se:Rotation>
<ogc:Literal>34</ogc:Literal>
</se:Rotation>
</se:Graphic>
</se:PointSymbolizer>
</se:Rule>
</se:FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor> Also, I have started working on https://github.com/Youssef-Harby/pygeoapi/tree/styles , incorporating your changes/boilerplate, and began drafting from that point. However, since your plan involves serving only simple SLDs from a directory, I would like to ask if you could provide an example configuration YAML showing how you would prefer the SLD to be defined, so we're aligned on the same page. |
@Youssef-Harby: sure, based on your example, I was thinking of something like this (but open to feedback!): 😁
In summary, the type would be the new type, |
@tomkralidis what do you think? :-) |
The OGC API - Styles Draft Standard enables map servers, clients as well as visual style editors, to manage and fetch styles. The styles consist of symbolizing instructions that can be applied by a rendering engine on features and/or coverages. The API implements the conceptual model for style encodings and style metadata.
The text was updated successfully, but these errors were encountered: