Introducción a GeoServer
Acerca de nosotros
Acerca de vosotros?
Geoserver en un día
1.1 Introducción
¿Qué es un servidor de mapas?
Estándares OGC
Open Source: ventajas y desventajas
Arquitectura
Repaso a la configuración
1.2 Publicación de shapefile
Estructura del GEOSERVER_DATA_DIR
Subiendo los archivos para publicar
Workspaces, data stores, layers
1.3. Simbolización básica con SLD
Simbolización de una capa de puntos
Simbolización de una capa de líneas
Simbolización básica de una capa de polígonos
Filtrado y etiquetas con SLD
Generación de SLD con QGIS
Documentación on-line sobre SLD
1.4 Publicación de otros formatos
Como subir capas a PostGIS desde QGIS
Creación de un almacén de trabajo PostGIS
Publicación de datos raster
1.5 Uso del estándar WMS
Contenido de un documento GetCapabilities
Parámetros estándar de la operación GetMap
Formatos de respuesta y sus usos
Consumo desde QGIS y desde un visor web
Otros estándares OGC: WFS, WMTS, WCS ...
1.1 ¿Qué es GeoServer?
Arquitectura
Geoserver
PostgreSQL/PostGIS
Arquitectura
¿Qué es un servidor de mapas?
Un servidor de mapas de Internet proporciona mapas a través de Internet, generalmente como imágenes (???). Una especificación estándar para dicho servidor es la OGC Web Map Service.
Wikipedia, 2006
¿Qué es un servidor de mapas?
Un servidor de cartografía digital (en inglés IMS: Internet Map Server) provee cartografía a través de la red tanto en modo vectorial como con imágenes. La especificación estándar para estos servidores es la OGC Web Map Service, (Open Geospatial Consortium Web Map Service).
Wikipedia actual
¿Qué es un servidor de mapas?
¿Qué es un servidor de mapas?
¿Qué es GeoServer?
Think free as in free speech, not free beer
R.Stallman
¿Qué es GeoServer?
Free / Open source software
¿Qué es GeoServer?
Al ser un proyecto impulsado por la comunidad, GeoServer es desarrollado, probado y respaldado por un grupo diverso de individuos y organizaciones de todo el mundo.
¿Qué es GeoServer?
Diseñado para la interoperabilidad, publica datos de diversas fuentes utilizando estándares abiertos.
¿Qué es GeoServer?
Estándares OGC
GeoServer serves data using standard protocols established by the Open Geospatial Consortium:
- The Web Map Service (WMS) supports requests for map images (and other formats) generated from geographical data.
- The Web Feature Service (WFS) supports requests for geographical feature data (with vector geometry and attributes).
- The Web Coverage Service (WCS) supports requests for coverage data (rasters).
Estándares OGC
WFS
Vectores
WMS
Imágenes
WCS
Análisis raster
{"type":"FeatureCollection","features":[{"type":"Feature","id":"fondo_lineas.1","geometry":{"type":"MultiLineString","coordinates":[[[182058.3406,4370370.6027,0],[182059.5583,4370393
Estándares OGC
Conectarse a un servicio WMS (con QGIS):
http://www.ign.es/wms-inspire/ign-base?
Ver las capabilities en un navegador:
http://www.ign.es/wms-inspire/ign-base?VERSION=1.3.0&REQUEST=GetCapabilities&SERVICE=WMS
Estándares OGC
¿Qué es XML?
La tecnología XML busca dar solución al problema de expresar información estructurada de la manera más abstracta y reutilizable posible. Que la información sea estructurada quiere decir que se compone de partes bien definidas, y que esas partes se componen a su vez de otras partes. Entonces se tiene un árbol de trozos de información
¿Qué es XML?
<?xml version="1.0" encoding="UTF-8" ?>
<Edit_Mensaje>
<Mensaje>
<Remitente>
<Nombre>Nombre del remitente</Nombre>
<Mail> Correo del remitente </Mail>
</Remitente>
<Destinatario>
<Nombre>Nombre del destinatario</Nombre>
<Mail>Correo del destinatario</Mail>
</Destinatario>
<Texto>
<Asunto>
Este es mi documento con una estructura muy sencilla
no contiene atributos ni entidades...
</Asunto>
<Parrafo>
Este es mi documento con una estructura muy sencilla
no contiene atributos ni entidades...
</Parrafo>
</Texto>
</Mensaje>
</Edit_Mensaje>
Estándares OGC
Metadatos importantes para interoperabilidad!
Estándares OGC
Metadatos importantes para interoperabilidad!
1.1 Repaso a la configuración
Instalando Geoserver
Instalando Geoserver
- Java 11 - GeoServer 2.15.x and above (OpenJDK tested)
- Java 8 - GeoServer 2.9.x and above (OpenJDK and Oracle JRE tested)
- Java 7 - GeoServer 2.6.x to GeoServer 2.8.x (OpenJDK and Oracle JRE tested)
Instalando Geoserver
Jetty (development):
https://docs.geoserver.org/stable/en/user/installation/win_installer.html
Tomcat (production, WAR): https://docs.geoserver.org/stable/en/user/installation/war.html
Instalando Geoserver
Instalando Geoserver
docker pull oscarfonts/geoserver
docker run -d -p 8080:8080 -v /path/to/local/data_dir:/var/local/geoserver
oscarfonts/geoserver
Instalando Geoserver
Balanceo de carga
N1
N2
N3
N4
Log file
GEOSERVER_DATA_DIR/logging.xml
logs/geoserver.log
User Administration Interface
Log file
1.2 Publicación de shapefile
Ubicación del data directory
Standalone platform Default/typical location
Windows (except XP) | C:\Program Files (x86)\GeoServer 2.16.x\data_dir |
Windows XP | C:Program Files\GeoServer 2.16.x\data_dir |
Mac OS X | /Applications/GeoServer.app/Contents/Resources/Java/data_dir |
Linux (Tomcat) | /var/lib/tomcat7/webapps/geoserver/data |
Ubicación del data directory
Estructura del data directory
Data directory
Todo se almacena en el data directory. Si:
- Rutas relativas
- Archivos en la subcarpeta 'data'
=> PORTABILIDAD!
Publicación de shapefile
- Subir el archivo al servidor
- Descomprimir y comprobar permisos
- Publicar con User Administration Interface
Publicación de shapefile: subir el archivo
#uploading with SSH
scp local_file user@remote_host:remote_file
#example
scp aliseda.zip root@ide2.dip-caceres.geomati.co:/opt/ide_caceres/data/geoserver
Publicación de shapefile: comprobar permisos
#check permissions
ls -l
chmod 644 /tmp/myfile.zip
Workspaces, stores, layers
Workspace 1
Data Store A
Data Store B
Layer A1
Layer A2
Layer A3
Layer B1
Layer B2
Espacios de trabajo, almacenes de datos, capas
Espacio de trabajo 1
Almacén A
Almacén B
Capa A1
Capa A2
Capa A3
Capa B1
Capa B2
Publicación de shapefile
Formatos de salida
Ir a Previsualización de capas y comprobar los siguientes formatos (Otros formatos) de la capa seleccionada:
- Openlayers
- GIF
- GeoTiff
- JPEG
- KMK
Proyecciones
Qué proyecciones estaran disponibles para las capas que hemos subido?
Ejercicio: Publicación de shapefile
Publicar una capa en el Espacio de trabajo 'formacion'
Ejercicio: Publicación de carpeta de shapefiles
Publicar una carpeta de shapefile en el Espacio de trabajo 'formacion'
Crear un grupo de capas
1.3 Simbolización con SLD
¿Qué es SLD?
Estilos
Estilos
Editor de estilos
Simbolización básica de una capa de puntos
<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
xmlns="http://www.opengis.net/sld"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- a named layer is the basic building block of an sld document -->
<NamedLayer>
<Name>Default Point</Name>
<UserStyle>
<!-- they have names, titles and abstracts -->
<Title>Red Square point</Title>
<Abstract>A sample style that just prints out a red square</Abstract>
<!-- FeatureTypeStyles describe how to render different features -->
<!-- a feature type for points -->
<FeatureTypeStyle>
<Rule>
<PointSymbolizer>
<Graphic>
<Mark>
<WellKnownName>circle</WellKnownName>
<Fill>
<CssParameter name="fill">#FF0000</CssParameter>
</Fill>
<Stroke>
<CssParameter name="stroke">#000000</CssParameter>
<CssParameter name="stroke-width">2</CssParameter>
</Stroke>
</Mark>
<Size>6</Size>
</Graphic>
</PointSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
Simbolización básica de una capa de líneas
<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
xmlns="http://www.opengis.net/sld"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- a named layer is the basic building block of an sld document -->
<NamedLayer>
<Name>Default Line</Name>
<UserStyle>
<!-- they have names, titles and abstracts -->
<Title>BRed Line</Title>
<Abstract>A sample style that just prints out a blue line</Abstract>
<!-- FeatureTypeStyles describe how to render different features -->
<!-- a feature type for lines -->
<FeatureTypeStyle>
<Rule>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke">#FF0000</CssParameter>
<CssParameter name="stroke-width">3</CssParameter>
<CssParameter name="stroke-dasharray">5 2</CssParameter>
</Stroke>
</LineSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
Simbolización básica de una capa de polígonos
<FeatureTypeStyle>
<Rule>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#000080</CssParameter>
</Fill>
<Stroke>
<CssParameter name="stroke">#FFFFFF</CssParameter>
<CssParameter name="stroke-width">2</CssParameter>
</Stroke>
</PolygonSymbolizer>
</Rule>
</FeatureTypeStyle>
Ejercicio
Style:
- Línea marrón para test:fondo_lineas
- Punto con estrella para test:equipamiento_solar
- Simbolizar polígonos como líneas para test:suelo_min
Documentación sobre SLD:
SLD Cookbook
Documentación sobre SLD:
SLD Reference
Etiquetado
Filtrado
Exportando SLD desde QGIS
Demo
Style:
- Crear estilo con etiquetas de nombre de playas
CSS: una alternativa
1.4 Publicación de
una tabla PostGIS
¿Qué es PostGIS?
¿Qué es PostGIS?
A spatial database is a database that is optimized for storing and querying data that represents objects defined in a geometric space. Most spatial databases allow the representation of simple geometric objects such as points, lines and polygons. Some spatial databases handle more complex structures such as 3D objects, topological coverages, linear networks, and TINs. While typical databases have developed to manage various numeric and character types of data, such databases require additional functionality to process spatial data types efficiently, and developers have often added geometry or feature data types.
Conectar a PostGIS desde QGIS
- Host: ide2.dip-caceres.geomati.co
- Service:
- Database: formacion
- Port: 5432
- User: formacion
- Pwd: xmqJ3DYd
Crear almacén de datos PostGIS desde GS
- Host: 10.8.0.3
- Database: pg_formacion
- Port: 5432
- User: geoserver
- Pwd: geoserver
Conectar via pgAdmin
pg_hba.conf
# TYPE DATABASE USER ADDRESS METHOD
local all postgres ident
local all all md5
#only localhost
host all all 127.0.0.1/32 md5
#everything open
host all all 0.0.0.0/32 md5
#open for a specific BD
host bd_abierta all 0.0.0.0/32 md5
Crear base de datos
CREATE DATABASE nyc;
CREATE EXTENSION postgis;
Herramientas para importar datos
- ogr2ogr
- shp2pgsql
- QGIS, Navicat ...
shp2pgsql (old way)
cd C:\Program Files\PostgreSQL \9.5\bin
shp2pgsql -I -s 26918 C:\Documents\postgis-workshop\data\roads.shp
roads | psql -U postgres -d <DBNAME>
Subir capas a PostGIS
desde QGIS
Importar
Que cada uno importe a PostGIS una capa SHP de Aliseda
Crear un almacén de datos PostGIS (data store)
PostGIS: funciones
Ejercicio provincia
1) Todos los abrevaderos de un municipio
2) Todos los abrevaderos a menos de 10kms de lon:-5.71 lat:39.79
Pista: usar ST_Distance o ST_Within
SELECT * FROM provincia.red_distr_abrevadero WHERE cod_mun='091'
Ejercicio
SELECT *
FROM provincia.red_distr_abrevadero
WHERE ST_DWithin(
geom,
ST_Transform(ST_GeomFromText('POINT(-5.72 39.79)', 4326), 25830), 10000
);
PostGIS triggers
PostgreSQL trigger can be specified to fire
- Before the operation is attempted on a row (before constraints are checked and the INSERT, UPDATE or DELETE is attempted)
- After the operation has completed (after constraints are checked and the INSERT, UPDATE, or DELETE has completed)
- Instead of the operation (in the case of inserts, updates or deletes on a view)
PostGIS triggers
PostgreSQL Triggers are database callback functions, which are automatically performed/invoked when a specified database event occurs.
1.4 Publicación de
datos raster
Formatos raster
Extensión GDAL
¿Qué es GDAL?
GDAL is a translator library for raster and vector geospatial data formats that is released under an X/MIT style Open Source License by the Open Source Geospatial Foundation.
Extensión GDAL
Instalando extensión GDAL
cd /var/lib/tomcat8/webapps/geoserver/WEB-INF/lib/
sudo wget https://sourceforge.net/projects/geoserver/files/GeoServer/2.14.2/extensions/geoserver-2.14.2-gdal-plugin.zip
sudo unzip geoserver-2.14.2-gdal-plugin.zip
rm *.txt *.TXT *.zip
chown tomcat8:tomcat8 *.jar
Instalando librerías
nativas GDAL
cd /usr/local/geoserver/
mkdir gdal
cd gdal
wget http://demo.geo-solutions.it/share/github/imageio-ext/releases/1.1.X/1.1.8/gdal/gdal-data.zip
unzip gdal-data.zip
mkdir lib
cd lib
wget https://demo.geo-solutions.it/share/github/imageio-ext/releases/native/gdal/1.9.2/linux/gdal192-Ubuntu12-gcc4.6.3-x86_64.tar.gz
tar -xvf gdal192-Ubuntu12-gcc4.6.3-x86_64.tar.gz
Formatos GDAL
- DTED, Military Elevation Data (.dt0, .dt1, .dt2): http://www.gdal.org/frmt_dted.html
- EHdr, ESRI .hdr Labelled: <http://www.gdal.org/frmt_various.html#EHdr>
- ENVI, ENVI .hdr Labelled Raster: <http://www.gdal.org/frmt_various.html#ENVI>
- HFA, Erdas Imagine (.img): <http://www.gdal.org/frmt_hfa.html>
- JP2MrSID, JPEG2000 (.jp2, .j2k): <http://www.gdal.org/frmt_jp2mrsid.html>
- MrSID, Multi-resolution Seamless Image Database: <http://www.gdal.org/frmt_mrsid.html>
- NITF: <http://www.gdal.org/frmt_nitf.html>
- ECW, ERDAS Compressed Wavelets (.ecw): <http://www.gdal.org/frmt_ecw.html>
- JP2ECW, JPEG2000 (.jp2, .j2k): http://www.gdal.org/frmt_jp2ecw.html
- AIG, Arc/Info Binary Grid: <http://www.gdal.org/frmt_various.html#AIG>
- JP2KAK, JPEG2000 (.jp2, .j2k): <http://www.gdal.org/frmt_jp2kak.html>
Publicación de un
GeoTiff RGB
1. Subir archivo .tiff
2. Crear almacén de datos en Geoserver
3. Publicar capa
Publicación de un
NDVI GeoTiff
1. Subir archivo rgb.tiff
2. Crear almacén de datos en Geoserver
3. Simbolizar (SLD o vía QGIS)
4. Publicar capa
Índice de vegetación de diferencia normalizada
Publicación de un
Mosaic GeoTiff
Ejemplo capa: cabu
Consejos trabajando con raster
- GeoTiff raramente va muy lento
- No reproyectar: mismo EPSG nativo que el utilizado
- Generar pirámides/overviews (GDAL)
- Usar cache (GeoWebCache)
Optimización con GDAL
o QGIS
Crear overviews (pyramids)
Ex: gdaladdo -r average abc.tif 2 4 8 16
Mejor consejo para rasters
Si es posible, crear cache con GeoWebCache!
Ejercicio en equipo
- unirse a un grupo: abastecimiento, cartobase, equipamientos
- en QGIS, simbolizar los shp de tu grupo (con algo de criterio)
- subir las capas a PostGIS:
usuario: formacion, pwd: 123456, BDD: <grupo> - publicar las capas a Geoserver en el espacio de trabajo <grupo> (habrá que crear el almacén de datos antes)
- simbolizar las capas en Geoserver usando las SLD exportadas desde QGIS
1.5 Uso del
estándar WMS
Geoserver y los estándares OGC
Diseñado para la interoperabilidad, publica datos de diversas fuentes utilizando estándares abiertos.
Estándares OGC
- The Web Map Service (WMS) supports requests for map images (and other formats) generated from geographical data.
- The Web Feature Service (WFS) supports requests for geographical feature data (with vector geometry and attributes).
- The Web Coverage Service (WCS) supports requests for coverage data (rasters).
Estándares OGC
WFS
Vectores
WMS
Imágenes
WCS
Raster
{"type":"FeatureCollection","features":[{"type":"Feature","id":"fondo_lineas.1","geometry":{"type":"MultiLineString","coordinates":[[[182058.3406,4370370.6027,0],[182059.5583,4370393
Estándares OGC
REQUEST (GetMap, GetCapabilities ...)
RESPONSE (image/png, application/json, ...)
CLIENTE:
QGIS, ArcGIS, cliente web (OpenLayers, LeafletJS)
SERVIDOR:
GeoServer, MapServer, QGISServer, ...
Estándares OGC
Paradigma: cada capa de información puede ser mantenida y publicada por su productor y consumida por múltiples clientes utilizando los Estándares OGC.
Estándares OGC
WMS REQUEST1
CLIENTE:
QGIS, ArcGIS, página web/ mashup (OpenLayers, LeafletJS)
SERVIDOR1
WFS REQUEST2
SERVIDOR2
WMS REQUEST3
SERVIDOR3
Web Map Service (WMS)
WMS proporciona una interfaz estándar para solicitar una imagen de mapa geoespacial. El beneficio de esto es que los clientes WMS pueden solicitar imágenes de múltiples servidores WMS y luego combinarlas en una sola vista para el usuario. El estándar garantiza que todas estas imágenes pueden superponerse entre sí como se verían en la realidad.
Concepto de IDE
https://volaya.github.io/libro-sig/chapters/IDE.html
Del libro "Sistemas de Información Geográfica" de Víctor Olaya https://volaya.github.io/libro-sig
Concepto de IDE
Las IDE surgen para coordinar la producción cartográfica a nivel global y su uso por todo tipo de usuarios. No obstante, no resulta práctico ni organizativamente viable gestionar tal cantidad de trabajo e información a un único nivel, siendo necesario delegar en distintos niveles y establecer una estructura organizativa para distribuir las responsabilidades y tareas. Esto da lugar a una estructura en forma de red en la que se distinguen una serie de nodos interconectados, cada uno de los cuales lo administra un determinado organismo responsable. Las relaciones existentes dependerán de la posición y nivel del nodo en cuestión, así como el tipo de organismo responsable de este.
Concepto de IDE
Web Map Service (WMS)
WMS requests can perform the following operations:
Operation | Description |
Exceptions | If an exception occur |
GetCapabilities | Retrieves metadata about the service, including supported operations and parameters, and a list of the available layers |
GetMap | Retrieves a map image for a specified area and content |
GetFeatureInfo(optional) | Retrieves the underlying data, including geometry and attribute values, for a pixel location on a map |
DescribeLayer(optional) | Indicates the WFS or WCS to retrieve additional information about the layer. |
GetLegendGraphic(optional) |
GetCapabilities: request
GetCapabilities: request
- http://localhost:8080/geoserver/wms?
- service=wms&
- version=1.1.1&
- request=GetCapabilities
GetCapabilities: request
GetMap
GetMap
- http://localhost:8080/geoserver/formacion/wms?
- service=WMS&
- version=1.1.0&
- request=GetMap&
- layers=formacion%3AMonumentos_Naturales_Lineas
- bbox=176792.27460000012%2C4781009.7369%2C335241.2165999999%2C4831117.0825&
- width=768&
- height=330&
- srs=EPSG%3A25830&
- format=application/openlayers
GetMap
GetMap
GetMap: formatos
GetMap: formatos
- png (o gif) para topográficos
- jpeg para ortos
- pdf para impresión
(Previsualización de capas)
Usando WMS desde QGIS
https://docs.qgis.org/testing/en/docs/user_manual/working_with_ogc/ogc_client_support.html
GetCapabilities -> GetMap
Ejercicio
Hacer mapa QGIS map con 3 capas WMS
- aliseda:fondo_lineas de https://ideprueba.ide-caceres.es
- cartobase:suelo_min de https://ide2.dip-caceres.geomati.co
- orto del PNOA 2017 (buscar URL en Internet)
Usando WMS desde un cliente web
Ejercicio
Make a Leaflet map with 2 WMS layers
- nyc_subway_stations from http://geoserver.geomati.co:8080
- nyc_streets from http://localhost:8080
GetLegendGraphic
GetLegendGraphic
WMS Decorations:
Marca de agua
WMS Decorations:
Leyenda embebida
Leyenda en formato JSON
Leyenda personalizada
Defined in Style Editor. Make a custom legend (a static image) for subway_stations
GetFeatureInfo
GetFeatureInfo
- http://localhost:8080/geoserver/formacion/wms?
- SERVICE=WMS&
- VERSION=1.1.1&
- REQUEST=GetFeatureInfo&
- FORMAT=image%2Fpng&
- TRANSPARENT=true&
- QUERY_LAYERS=formacion%3AMonumentos_Naturales_Lineas
- layers=formacion%3AMonumentos_Naturales_Lineas
- exceptions=application%2Fvnd.ogc.se_inimage&
- INFO_FORMAT=text%2Fhtml&
- FEATURE_COUNT=50&
- SRS=EPSG%3A4326&
- STYLES=&
- WIDTH=101&HEIGHT=101&X=50&Y=50&BBOX=...
GetFeatureInfo
Parámetros específicos
de GeoServer
Parámetros específicos
de GeoServer
Ejercicio
Get all subway stations less than 2kms from lon:-73.85 lat:40.75 using CQL_FILTER
(localhost, LayerPreview)
1. 6 Uso del
estándar WFS
Estándares OGC
- The Web Map Service (WMS) supports requests for map images (and other formats) generated from geographical data.
- The Web Feature Service (WFS) supports requests for geographical feature data (with vector geometry and attributes).
- The Web Coverage Service (WCS) supports requests for coverage data (rasters).
Web Feature Service (WFS)
WMS requests can perform the following operations:
GetCapabilities | Generates a metadata document describing a WFS service provided by server as well as valid WFS operations and parameters |
DescribeFeatureType | Returns a description of feature types supported by a WFS service |
GetFeature | Returns a selection of features from a data source including geometry and attribute values |
LockFeature | Prevents a feature from being edited through a persistent feature lock |
Transaction | Edits existing feature types by creating, updating, and deleting |
Web Map Service (WMS)
WMS requests can perform the following operations:
Operation | Description |
Exceptions | If an exception occur |
GetCapabilities | Retrieves metadata about the service, including supported operations and parameters, and a list of the available layers |
GetMap | Retrieves a map image for a specified area and content |
GetFeatureInfo(optional) | Retrieves the underlying data, including geometry and attribute values, for a pixel location on a map |
DescribeLayer(optional) | Indicates the WFS or WCS to retrieve additional information about the layer. |
GetLegendGraphic(optional) |
GetCapabilities
Conexión desde QGIS
Diferencias entre
WFS y WMS
WFS descarga todos los datos: Nos conviene?
Diferencias entre
WFS y WMS
Las capas WFS son preferibles a las capas WMS si se necesita acceso directo a los atributos y geometrías de las capas. Sin embargo, teniendo en cuenta la cantidad de datos que deben descargarse (lo que genera problemas de velocidad y también escasez de servidores WFS públicos), no siempre es posible utilizar un WFS en lugar de un WMS.
GML, KML, SHP o GeoJSON?
Configurando WFS
Ejercicio
Hacer un mapa QGIS con 1 capa WFS
y 1 capa WMS
- nyc_subway_stations as WFS from http://localhost:8080
- nyc_census_blocks as WMS from http://localhost:8080
Demos WFS
GetFeature
- WFS_GetFeatureBBOX
- WFS_GetFeatureIntersects
Ejercicio
Get nyc_neighbourhood that intersects with point lon:-73.85 lat:40.55 using WFS_Intersects
WFS-T (Transaccional)
El servicio básico de Web Feature Service permite consultar y descargar elementos. El servicio transaccional Web Feature Service (WFS-T) permite además creación, eliminación y actualización de elementos.
1.7 Cacheado de teselas con GeoWebCache
GeoWebCache
GeoWebCache es un servidor de teselas. Se ejecuta como un proxy entre un cliente de mapas y un servidor de mapas, almacenando teselas a medida que se piden, eliminando solicitudes redundantes y ahorrando así grandes cantidades de tiempo de procesamiento.
GeoWebCache
GeoWebCache
No podemos almacenar todas las solicitudes de WMS GetMap, ¡la combinación de BBOX, WIDTH, HEIGHT y capas es enorme!
=> necesitamos TESELAS
GeoWebCache
Configurar GeoWebCache
Web Administration Interface
Configurar GeoWebCache
¿Qué formato usar?
- image/jpeg para satélite y orto
- image/png para mapa (transparente)
Configurar GeoWebCache
- Integración directa durante la visualización normal de mapas: los mosaicos se almacenan en caché solo cuando se solicitan (on-demand), ya sea a través de la exploración de mapas (como en OpenLayers) o mediante solicitudes manuales de mosaicos WMS.
- mediante seeding. Seeding (siembra) es el proceso en el que se generan mosaicos de mapas y se almacenan en caché internamente desde GeoWebCache. Cuando se procesa por adelantado, la experiencia del usuario mejora enormemente, ya que el usuario nunca tiene que esperar a que se generen teselas.
Integración directa
La integración directa permite que las solicitudes WMS atendidas a través de GeoServer se almacenen en caché como si GeoWebCache las recibiera y procesara.
Con la integración directa, el almacenamiento en caché de teselas se habilita para todas las solicitudes WMS estándar que contienen el parámetro tiled=true y se ajustan a todos los parámetros necesarios.
Ejercicio
Configurar teselas para nyc_census_blocks for EPSG:3857 (aka EPSG:900913).
Warning: keep ZOOM LEVEL below 15 ... it's just training!
Estrategias de teselado
- Pre-generar (seeding) solo niveles de zoom de baja resolución
- Las telesas de más detalle pueden ser cacheadas bajo demanda (integración directa).
¿Dónde se almacena la caché?
geoserver_data_dir/gwc
Standalone platform Default/typical location
Windows (except XP) | C:\Program Files (x86)\GeoServer 2.16.x\data_dir |
Windows XP | C:Program Files\GeoServer 2.16.x\data_dir |
Mac OS X | /Applications/GeoServer.app/Contents/Resources/Java/data_dir |
Linux (Tomcat) | /var/lib/tomcat7/webapps/geoserver/data |
WMS vs caching
Instead of drawing on-demand
we get a few files from the server
Ejercicio
Make a Leaflet map with 2 WMS layers and check it's cached with GeoWebCache header responses (HIT and MISS)
- nyc_subway_stations (WMS) from http://localhost:8080
- nyc_census_blocks (WMS) from http://localhost:8080
1.8 Estándares para caché (WMTS, WMS-C)
WMS-C -> WMTS
WMTS
WMTS
Previsualización en Tile Caching->Tile Layers
WMTS: Gridsets, Tile Matrix
"Modern" tiling
Tiling "moderno"
Las soluciones comunes del mercado masivo siguen implícitamente este perfil utilizando Google-Mercator CRS, un topLeftCorner común, el mismo conjunto de TileMatrices y una plantilla de URL fija.
QUIÉN DEFINIÓ ESTE ESTÁNDAR?
Estándar “De facto”: Google TMS (o XYZ)
Estándar “De facto”: Google TMS (o XYZ)
Ejercicio
Make a Leaflet map with 1 local WMS layer and a basemap from
1.9 Cómo progresar
con GeoServer
Documentación oficial
Manual de uso
Extensiones
Listas de correo
Reportar bugs
Seguimiento de issues
Ejercicio final
- Choose 2-3 layers from your computer or download 2-3 layers from CNIG (use .shp or .tiff, not ECW)
- Publish at local Geoserver (http://localhost:8080/geoserver)
- Style via SLD (labels, filtering)
- Build a Leaflet web client that consumes the layers via WMS
- Cache the first levels of zoom of big layers with GeoWebCache
Gracias!
Copy of Geoserver CETEMAS
By mpericay
Copy of Geoserver CETEMAS
- 166