[MapServer-users] Is it possible to make a symbol of symbols?
Hi Is it possible to make a symbol of symbols? My use case is wind barbs. I use lines for barbs up to 45kn, but at 50kn and above the 50kn flag is a filled triangle. I try a symbol like this: SYMBOL NAME "wind_barb_50" TYPE VECTOR FILLED TRUE POINTS 26 8.2 2 8.2 4.4 0 6.8 8.2 26 8.2 END END But here the line of the wind barb is not display. An example here https://drive.google.com/file/d/1maC2OqTwWG5H5WtCqbIAxPOmZoQ5Agkt/view?usp=sharing ( for reference a 40kn wind barb is also plotted) The line of the wind barb can be displayed if I set outlinecolor ( to the same color as the color), but then the line is a bit thicker than the wind bards with no 50kn flag. Example of both here https://drive.google.com/file/d/1aAKLg7fVVxB0hCbI4GRxLHI6Z_44MDml/view?usp=sharing Example how it should look https://www.weather.gov/hfo/windbarbinfo I have looked at various variation using a line symbol and a flag symbol using both in the layer. But then I get problems when I rotate the symbols. I also have looked at using offset and anchorpoint for the flag relative to the line. But I can't get it right. So then my idea of have a line symbol and a flag symbol and then join them together in a new combined symbol before putting it in a layer. Any ideas or sections of the manual I have missed? Trygve Aspenes ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [MapServer-users] How to format labels on contours
Thanks Seth I'm sure I did try the setText method, but I forgot to mention that in the post. Thanks for the tip of convertToString() method. Using your example I get LABEL TEXT (tostring(([SQKM]),"%.0f")+" km2") END # LABEL And the expected label format in my contour layer. Somehow I must missed something with I tried this in the first place, I think the parentheses around tostring. Thanks again! Trygve Aspenes Den 2023-10-21 09:04, skrev Seth G: Hi, The MapScript API docs are back online - see https://mapserver.org/mapscript/mapscript-api/stub/mapscript.classObj.html#mapscript.classObj The setText() method should give you what you need. Example (using Python): s = mapscript.classObj(layer) # other style and label stuff s.setText('(tostring(([SQKM]),"%.0f")+" km2")') # check the output using print(s.convertToString()) When using updateFromString it will replace everything in the classObj hence the error. Seth -- web:https://geographika.net & https://mapserverstudio.net twitter: @geographika On Fri, Oct 20, 2023, at 9:16 PM, Trygve Aspenes via MapServer-users wrote: Hi So I have made a contour plot from a raster. Works nicely. Then I added labels to give context to the contours. Fine. Now I want to format the labels. I have found this post https://gis.stackexchange.com/questions/350089/round-number-for-label-in-mapserver suggesting a syntax: TEXT (tostring(([SQKM]),"%.0f")+" km2") Nice, but I use mapscript. And I do not understand nor find any examples how I could do this with mapscript I tried with: s = mapscript.classObj(layer) s.updateFromString('TEXT (tostring(([SQKM]),"%.0f")+" km2")') But I get: EOFError: loadClass(): Premature End-of-File. So obviously not correct. Is there someone who could suggest what could be wrong here or what else to look at and try? Trygve Aspenes ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
[MapServer-users] How to format labels on contours
Hi So I have made a contour plot from a raster. Works nicely. Then I added labels to give context to the contours. Fine. Now I want to format the labels. I have found this post https://gis.stackexchange.com/questions/350089/round-number-for-label-in-mapserver suggesting a syntax: TEXT (tostring(([SQKM]),"%.0f")+" km2") Nice, but I use mapscript. And I do not understand nor find any examples how I could do this with mapscript I tried with: s = mapscript.classObj(layer) s.updateFromString('TEXT (tostring(([SQKM]),"%.0f")+" km2")') But I get: EOFError: loadClass(): Premature End-of-File. So obviously not correct. Is there someone who could suggest what could be wrong here or what else to look at and try? Trygve Aspenes ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
[MapServer-users] mapserver legend for raster data
Hi I have an idea to generate some static images to be used as legend for some RGBA geotiff raster data (already styled) available as layers in a mapserver setup. But I can't figure out if this is possible to do. I had a look a layer web metadata https://mapserver.org/ogc/wms_server.html#web-object-metadata wms_style and the following mandatory wms_style_[style’s_name]_width, wms_style_[style’s_name]_legendurl_height, wms_style_[style’s_name]_legendurl_format, wms_style_[style’s_name]_legendurl_href So I try with name having this in the map file: METADATA "wms_title" "Test raster title" "wms_timeextent" "2023-10-12T11:26:00Z/2023-10-12T11:26:00Z" "wms_enable_request" "*" "wms_style_raster_title" "mylayerstyletitle" #style title "wms_style_raster_legendurl_width" "85" "wms_style_raster_legendurl_height" "40" "wms_style_raster_legendurl_format" "image/png" "wms_style_raster_legendurl_href" "http://localhost:8080/images/legend.png; END I verified I can reach the png. Then I add: classgroup "raster" CLASS name "TESTNAME" group "raster" END using curl for getlegendgraphic I only get a small png showing "TESTNAME", not image content of 'legend.png'. Anyone know if this is possible achieve? Trygve Aspenes ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [MapServer-users] mapcache: Setting styles for a tileset and source
hm, wait The request from my app is based on the getcapability from mapcache, so no styles. But when mapcache is sending the request to mapserver the configured STYLES in the getmap section in the mapcache config is added correctly. I don't know how I missed that, but I think I get what I expect now. Trygve Aspenes Den 2023-09-29 17:29, skrev Trygve Aspenes via MapServer-users: Hi In mapserver I have several styles. In mapcache I see no styles info in the getcapabilities document, so my app can't know anything about it. Anyway, you would need one tileset for each styles to cache the data. So right, that makes sense. Then I try to make one tileset per style. I add to my source config, getmap like this: http://mapserver:8080? image/png tileset style_name But no luck. STYLES is sent empty to my mapserver wms server. I haven't got time to debug the code now, but my first look, STYLES should be handled here: https://github.com/MapServer/mapcache/blob/main/lib/source_wms.c#L154-L167 the for loop would parse all elements. But I would need a closer look to see if this is what actually happends. Anyone else know how to handle styles in mapcache? Trygve Aspenes ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
[MapServer-users] mapcache: Setting styles for a tileset and source
Hi In mapserver I have several styles. In mapcache I see no styles info in the getcapabilities document, so my app can't know anything about it. Anyway, you would need one tileset for each styles to cache the data. So right, that makes sense. Then I try to make one tileset per style. I add to my source config, getmap like this: http://mapserver:8080? image/png tileset style_name But no luck. STYLES is sent empty to my mapserver wms server. I haven't got time to debug the code now, but my first look, STYLES should be handled here: https://github.com/MapServer/mapcache/blob/main/lib/source_wms.c#L154-L167 the for loop would parse all elements. But I would need a closer look to see if this is what actually happends. Anyone else know how to handle styles in mapcache? Trygve Aspenes ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [MapServer-users] Handeling gdal driver via tileitem for raster
I can answer myself; it might help some others in the future. So the trick or problem is SHAPEPATH. https://github.com/MapServer/MapServer/blob/main/src/mapraster.c#L442-L452 Here in the code the method to msDrawRasterBuildRasterPath is decided, and if you don't have SHAPEPATH set and you use tileindex, mapserver thinks you have a file an prepend some path, like './'. When I set SHAPEPATH to "" ( ie empty) in my config "" is prepended to my driver:filename:variable string. And I get what I want. I don't think this is a feature, but it works as long as you don't need to set SHAPEPATH to something else in you map file. Trygve Aspenes Den 2023-09-21 15:51, skrev Trygve Aspenes via MapServer-users: Hi I have a postgis db with netcdf filenames and the rest of the needed columns. So I have a layer, time_idx, to get the geom. And the raster layer with tileitem and tileindex like this: LAYER NAME "layername" STATUS ON TYPE raster PROCESSING "BANDS=1" TILEITEM "filename" TILEINDEX "time_idx" END The problem is the filename is handled as a full path to a filename. But since this is a netcdf I need something like this (See eg https://gdal.org/drivers/raster/netcdf.html#raster-netcdf) gdalinfo NETCDF:"sst.nc":tos Where NETCDF is the drive sst.nc is the filename tos is the variable name in the file. Is there a way to prepend the driver and append the variable name to the tileitem? Using DATA directly works. img2map give me like this: msPostGISLayerWhichShapes query status: PGRES_TUPLES_OK (2) msPostGISLayerWhichShapes got 1 records in result. msPostGISLayerNextShape called. msPostGISReadShape called. msPostGISReadShape: PQgetlength = 86 msPostGISReadShape: [filename] "netcdf-filename.nc" msPostGISReadShape: Setting shape->index = 5 msPostGISReadShape: Setting shape->resultindex = 0 msPostGISReadShape: [index] 5 msPostGISReadShape: [shape] POLYGON ((-2717181.7304994701407850 -5571048.1403121398761868, -2717181.7304994701407850 -1475048.1403121401090175, 1378818.2695005300920457 -1475048.1403121401090175, 1378818.2695005300920457 -5571048.1403121398761868, -2717181.7304994701407850 -5571048.1403121398761868)) msDrawRasterLayerLow(layer-name): Filename is: netcdf-filename.nc msDrawRasterLayerLow(layer-name): Path is: netcdf-filename.nc GDAL_netCDF: driver detected file type=3, libnetcdf detected type=3 GDAL_netCDF: var_count = 242 GDAL_netCDF: variable #26 [longitude] was ignored GDAL_netCDF: variable #27 [latitude] was ignored GDAL: GDALOpen(netcdf-filename.nc, this=0x56413c343280) succeeds as netCDF. msResampleGDALToMap in effect: cellsize = 1.00 msDrawGDAL(layer-name): using RAW_WINDOW=0 0 512 512, dst=0,0,512,512 msGetGDALBandList(): Image handling error. Attempt to operate on GDAL file with no bands, layer=layer-name. GDAL: GDALClose(netcdf-filename.nc, this=0x56413c343280) msPostGISLayerFreeItemInfo called. msPostGISLayerClose called: geom from (select * from netcdf_data where product_variable='') as foo using unique id msConnPoolRelease(time_idx,host=10.88.0.3 user=postgres dbname=postgres port=5432 password=*msConnPoolClose(host=10.88.0.3 user=postgres dbname=postgres port=5432 password=*msDrawMap(): Image handling error. Failed to draw layer named 'layer-name'. msDrawMap(): Image handling error. Failed to draw layer named 'layer-name'. msGetGDALBandList(): Image handling error. Attempt to operate on GDAL file with no bands, layer=layer-name. msFreeMap(): freeing map at 0x56413bee40a0. freeLayer(): freeing layer at 0x56413bf67950. msPostGISLayerIsOpen called. freeLayer(): freeing layer at 0x56413bf68e50. GDAL: In GDALDestroy - unloading GDAL shared library. At least it detects the driver I think, but I still need to specify the variable. Any ideas are appreciated or if you can point me to the part of the code that handles this. Thanks! Trygve Aspenes ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
[MapServer-users] Handeling gdal driver via tileitem for raster
Hi I have a postgis db with netcdf filenames and the rest of the needed columns. So I have a layer, time_idx, to get the geom. And the raster layer with tileitem and tileindex like this: LAYER NAME "layername" STATUS ON TYPE raster PROCESSING "BANDS=1" TILEITEM "filename" TILEINDEX "time_idx" END The problem is the filename is handled as a full path to a filename. But since this is a netcdf I need something like this (See eg https://gdal.org/drivers/raster/netcdf.html#raster-netcdf) gdalinfo NETCDF:"sst.nc":tos Where NETCDF is the drive sst.nc is the filename tos is the variable name in the file. Is there a way to prepend the driver and append the variable name to the tileitem? Using DATA directly works. img2map give me like this: msPostGISLayerWhichShapes query status: PGRES_TUPLES_OK (2) msPostGISLayerWhichShapes got 1 records in result. msPostGISLayerNextShape called. msPostGISReadShape called. msPostGISReadShape: PQgetlength = 86 msPostGISReadShape: [filename] "netcdf-filename.nc" msPostGISReadShape: Setting shape->index = 5 msPostGISReadShape: Setting shape->resultindex = 0 msPostGISReadShape: [index] 5 msPostGISReadShape: [shape] POLYGON ((-2717181.7304994701407850 -5571048.1403121398761868, -2717181.7304994701407850 -1475048.1403121401090175, 1378818.2695005300920457 -1475048.1403121401090175, 1378818.2695005300920457 -5571048.1403121398761868, -2717181.7304994701407850 -5571048.1403121398761868)) msDrawRasterLayerLow(layer-name): Filename is: netcdf-filename.nc msDrawRasterLayerLow(layer-name): Path is: netcdf-filename.nc GDAL_netCDF: driver detected file type=3, libnetcdf detected type=3 GDAL_netCDF: var_count = 242 GDAL_netCDF: variable #26 [longitude] was ignored GDAL_netCDF: variable #27 [latitude] was ignored GDAL: GDALOpen(netcdf-filename.nc, this=0x56413c343280) succeeds as netCDF. msResampleGDALToMap in effect: cellsize = 1.00 msDrawGDAL(layer-name): using RAW_WINDOW=0 0 512 512, dst=0,0,512,512 msGetGDALBandList(): Image handling error. Attempt to operate on GDAL file with no bands, layer=layer-name. GDAL: GDALClose(netcdf-filename.nc, this=0x56413c343280) msPostGISLayerFreeItemInfo called. msPostGISLayerClose called: geom from (select * from netcdf_data where product_variable='') as foo using unique id msConnPoolRelease(time_idx,host=10.88.0.3 user=postgres dbname=postgres port=5432 password=*msConnPoolClose(host=10.88.0.3 user=postgres dbname=postgres port=5432 password=*msDrawMap(): Image handling error. Failed to draw layer named 'layer-name'. msDrawMap(): Image handling error. Failed to draw layer named 'layer-name'. msGetGDALBandList(): Image handling error. Attempt to operate on GDAL file with no bands, layer=layer-name. msFreeMap(): freeing map at 0x56413bee40a0. freeLayer(): freeing layer at 0x56413bf67950. msPostGISLayerIsOpen called. freeLayer(): freeing layer at 0x56413bf68e50. GDAL: In GDALDestroy - unloading GDAL shared library. At least it detects the driver I think, but I still need to specify the variable. Any ideas are appreciated or if you can point me to the part of the code that handles this. Thanks! Trygve Aspenes ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
[MapServer-users] mapserver: using a shapefile to handle time with netcdf data
Hi all I try to use a shapefile to handle time. But he trick is my data source is a netcdf file. For this I need the gdal netcdf driver. My shapefile looks like this: ogrinfo points.shp points INFO: Open of `points.shp' using driver `ESRI Shapefile' successful. Layer name: points Metadata: DBF_DATE_LAST_UPDATE=2023-08-31 Geometry: Polygon Feature Count: 67 Extent: (-18.10, 49.80) - (54.20, 75.20) Layer SRS WKT: GEOGCRS["WGS 84", DATUM["World Geodetic System 1984", ELLIPSOID["WGS 84",6378137,298.257223563, LENGTHUNIT["metre",1]]], PRIMEM["Greenwich",0, ANGLEUNIT["degree",0.0174532925199433]], CS[ellipsoidal,2], AXIS["latitude",north, ORDER[1], ANGLEUNIT["degree",0.0174532925199433]], AXIS["longitude",east, ORDER[2], ANGLEUNIT["degree",0.0174532925199433]], ID["EPSG",4326]] Data axis to CRS axis mapping: 2,1 location: String (112.0) time: String (80.0) OGRFeature(points):0 location (String) = NETCDF:: time (String) = 2023-08-31T00:00:00Z POLYGON ((-18.1 49.8,-18.1 75.2,54.2 75.2,54.2 49.8,-18.1 49.8)) ... etc for all the time stamps -- The setup mapfile like this first with a time idx helper layer: LAYER STATUS ON NAME "time_idx" TYPE POLYGON DATA "points" METADATA "wms_title" "TIME INDEX" "wms_srs" "EPSG:4326" "wms_extent" "-18.1 49.8 54.2 75.2" "wms_timeextent" "2023-08-31T00:00:00Z/2023-08-02T18:00:00Z/PT1H" "wms_timeitem" "time" "wms_timedefault" "2023-08-31T12:00:00Z" "wms_enable_request" "*" END CONNECTION "points.shp" CONNECTIONTYPE OGR END and the layer itself: LAYER NAME "layer_name" STATUS ON TYPE raster PROCESSING "BANDS=1" PROJECTION END TILEINDEX "time_idx" TILEITEM "location" METADATA "wms_title" "layer_title" "wms_timeextent" "2023-08-31T00:00:00Z/2023-09-01T18:00:00Z/PT1H" "wms_timeitem" "time" "wms_enable_request" "*" END END Now requesting this layer I get: xmlns="http://www.opengis.net/ogc; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wms/1.3.0/exceptions_1_3_0.xsd;> msDrawMap(): Image handling error. Failed to draw layer named . msDrawRasterLayerLow(): Unable to access file. Corrupt, empty or missing file ./NETCDF:: for layer . ./NETCDF::: No such file or directory So for some reason the data is handled as a file name( prepending ./ to the location in my shapefile), and not using gdal driver netcdf to open the file. Is there a way to tell mapserver to handle this correctly using the gdal netcdf driver opening the file? Trygve Aspenes ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [MapServer-users] mapserver: styling multiple stop colorrange for raster data
Yeah I also saw that. So I guess value_ should do it. I'm working with netcdf so I wondered if that has something to do with it. So I tried with a geotiff. Also not working. Then I updated my mapserver to 8.0.1 from 7.4 something, and now I get the expected style for both geotiff and netcdf. So version do matter! Thank you for your patience Seth! Trygve Aspenes Den 2023-08-28 16:07, skrev Seth G: A good question and it doesn't seem to be clearly documented. I've always tried values listed at https://mapserver.org/el/input/raster.html#raster-query even though that section appears to be written for MapScript. Each band has a value based on index, so you should get results using "value_0", "value_1", and "value_2" in RANGEITEM. gdalinfo should peobably provide details on the value ranges in each band. Seth -- web:https://geographika.net & https://mapserverstudio.net twitter: @geographika On Mon, Aug 28, 2023, at 2:50 PM, Trygve Aspenes via MapServer-users wrote: Thanks Seth for your quick reply Yes I have multiple bands. gdalinfo tells me I have bands like this: Band 1 Block=949x1069 Type=Float32, ColorInterp=Undefined Band 2 Block=949x1069 Type=Float32, ColorInterp=Undefined Band 3 Block=949x1069 Type=Float32, ColorInterp=Undefined . . . Band n Block=949x1069 Type=Float32, ColorInterp=Undefined So, how could I figure out how the various bands are named in mapserver for the RANGEITEM? I have looked at the documentation for STYLE/RANGEITEM but I still don't get it. I have tried various values for RANGEITEM ( like "value_0", "0", "1", "pixel", "Band 1" etc), but I dont get it. It must be something that I'm missing. By the way, thanks for the mapserverstudio link. Most helpful! Trygve Aspenes Den 2023-08-28 13:14, skrev Seth G: Hi Trygve, You can have multiple start/stop values and your syntax looks correct. Maybe you have multiple bands in your raster and you are symbolising on the incorrect value? Try explicitly setting the RANGEITEM. See working example at https://app.mapserverstudio.net/#9JBVADFh CLASS NAME "colorramp" STYLE COLORRANGE "#e3edfc" "#287593" # a color gradient from light grey to a shade of blue # a pixel value of -20 will be light grey, and values from -20 to 0 will be # assigned a color from the colour gradient of light grey to blue DATARANGE -20 0 RANGEITEM "value_0" # this is the name of the value band in the raster, the datasets used in the Mapfile have a single band END STYLE COLORRANGE "#29497b" "#759387" DATARANGE 0 20 RANGEITEM "value_0" END STYLE COLORRANGE "#bfa96d" "#480d26" DATARANGE 20 50 RANGEITEM "value_0" END END Seth -- web:https://geographika.net & https://mapserverstudio.net twitter: @geographika On Mon, Aug 28, 2023, at 12:06 PM, Trygve Aspenes via MapServer-users wrote: Hi all I'm looking into creating a styling for a raster of float32 data. The data describes temperature in kelvin and I want to have a colorrange from blue to white for data up to 273 deg kelvin(0 deg C). And from white to red for warmer data. I see here https://mapserver.org/output/kerneldensity.html#raster-color-ramping how this is used for heatmap hoping that this will work for a raster also. I try with something like this: CLASS STYLE COLORRANGE "#" "#" DATARANGE 200 273 END # STYLE STYLE COLORRANGE "#" "#ffff" DATARANGE 273 315 END # STYLE END # CLASS but as far as I can see this gives me only white. If I try to use one style like this: CLASS STYLE COLORRANGE "#ffff" "#ffff" DATARANGE 200 315 END # STYLE END # CLASS it works but the color range goes directly from red to blue. Am I doing something wrong or can I not use multiple stops for these kind of data? Trygve Aspenes ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [MapServer-users] mapserver: styling multiple stop colorrange for raster data
Thanks Seth for your quick reply Yes I have multiple bands. gdalinfo tells me I have bands like this: Band 1 Block=949x1069 Type=Float32, ColorInterp=Undefined Band 2 Block=949x1069 Type=Float32, ColorInterp=Undefined Band 3 Block=949x1069 Type=Float32, ColorInterp=Undefined . . . Band n Block=949x1069 Type=Float32, ColorInterp=Undefined So, how could I figure out how the various bands are named in mapserver for the RANGEITEM? I have looked at the documentation for STYLE/RANGEITEM but I still don't get it. I have tried various values for RANGEITEM ( like "value_0", "0", "1", "pixel", "Band 1" etc), but I dont get it. It must be something that I'm missing. By the way, thanks for the mapserverstudio link. Most helpful! Trygve Aspenes Den 2023-08-28 13:14, skrev Seth G: Hi Trygve, You can have multiple start/stop values and your syntax looks correct. Maybe you have multiple bands in your raster and you are symbolising on the incorrect value? Try explicitly setting the RANGEITEM. See working example at https://app.mapserverstudio.net/#9JBVADFh CLASS NAME "colorramp" STYLE COLORRANGE "#e3edfc" "#287593" # a color gradient from light grey to a shade of blue # a pixel value of -20 will be light grey, and values from -20 to 0 will be # assigned a color from the colour gradient of light grey to blue DATARANGE -20 0 RANGEITEM "value_0" # this is the name of the value band in the raster, the datasets used in the Mapfile have a single band END STYLE COLORRANGE "#29497b" "#759387" DATARANGE 0 20 RANGEITEM "value_0" END STYLE COLORRANGE "#bfa96d" "#480d26" DATARANGE 20 50 RANGEITEM "value_0" END END Seth -- web:https://geographika.net & https://mapserverstudio.net twitter: @geographika On Mon, Aug 28, 2023, at 12:06 PM, Trygve Aspenes via MapServer-users wrote: Hi all I'm looking into creating a styling for a raster of float32 data. The data describes temperature in kelvin and I want to have a colorrange from blue to white for data up to 273 deg kelvin(0 deg C). And from white to red for warmer data. I see here https://mapserver.org/output/kerneldensity.html#raster-color-ramping how this is used for heatmap hoping that this will work for a raster also. I try with something like this: CLASS STYLE COLORRANGE "#" "#" DATARANGE 200 273 END # STYLE STYLE COLORRANGE "#" "#ffff" DATARANGE 273 315 END # STYLE END # CLASS but as far as I can see this gives me only white. If I try to use one style like this: CLASS STYLE COLORRANGE "#" "#ffff" DATARANGE 200 315 END # STYLE END # CLASS it works but the color range goes directly from red to blue. Am I doing something wrong or can I not use multiple stops for these kind of data? Trygve Aspenes ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
[MapServer-users] mapserver: styling multiple stop colorrange for raster data
Hi all I'm looking into creating a styling for a raster of float32 data. The data describes temperature in kelvin and I want to have a colorrange from blue to white for data up to 273 deg kelvin(0 deg C). And from white to red for warmer data. I see here https://mapserver.org/output/kerneldensity.html#raster-color-ramping how this is used for heatmap hoping that this will work for a raster also. I try with something like this: CLASS STYLE COLORRANGE "#" "#" DATARANGE 200 273 END # STYLE STYLE COLORRANGE "#" "#ffff" DATARANGE 273 315 END # STYLE END # CLASS but as far as I can see this gives me only white. If I try to use one style like this: CLASS STYLE COLORRANGE "#" "#ffff" DATARANGE 200 315 END # STYLE END # CLASS it works but the color range goes directly from red to blue. Am I doing something wrong or can I not use multiple stops for these kind of data? Trygve Aspenes ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [MapServer-users] getfeatureinfo works from mapserver but not via mapcache
OK so I was a bit inaccurate. The time value comes from the default value in the mapcache xml tileset dimensions config, I think this is happens here: https://github.com/MapServer/mapcache/blob/main/lib/service_wms.c#L883-L893 and it looks to me if no value for the dimension is set then the default values us used. Seems OK, but why is not my time value not handled. I guess I need some digging. Is the param and dimmension->name maybe case sensitive? Trygve Den 2023-04-14 15:51, skrev Trygve Aspenes via MapServer-users: Hi mapserver users list I have a mapserver with getfeatureinfo available. This seems to return the correct value for the selected timestamp for the given layer when used directly. But when I try to reach the same info, ie. getfeatureinfo, from mapcache a wrong timestamp is passed to mapserver and then the wrong values are returned. The request received by mapcache(as seen in the logs): 2023-04-14T13:34:20.304781696Z 172.16.16.234 - - [14/Apr/2023:13:34:20 +] "GET /okd-satellite =WMS=GetFeatureInfo=1.1.1=ash_meteosat_0deg_LAYERS=ash_meteosat_0deg=EPSG%3A3857=-3396560.8725830186,6408480.4514,7422652.026383018,11520588.9031=1782=842=333=704=image/gif_FORMAT=text/html=&=2023-04-11T07%3A15%3A00Z The request received by mapserver(as seen in the logs): 2023-04-14T13:34:20.303555611Z 172.16.2.224 - - [14/Apr/2023:13:34:20 +] "GET /okd-satellite?VERSION=1.1.1=GetFeatureInfo=WMS==image%2fpng=ash_meteosat_0deg=%2fconfig%2fmapserver-products.map=-3396560.872583%2c6408480.451400%2c7422652.026383%2c11520588.903100=1782=842=EPSG%3a3857=333=704_FORMAT=text%2fhtml_LAYERS=ash_meteosat_0deg=2023-03-25T16%3a00%3a00Z HTTP/1.1" 200 743 "-" "mod-mapcache/1.11dev" So what happens. The mapcache request looks correct with time=2023-04-11T07:15:00Z, then I guess this request is forwarded to mapserver, but I think it is without the TIME parameter. Why I think this is because the request I see in the mapserver logs has the default time stamp as given in my mapfile. Are there some configuration I'm missing? I had a look at https://github.com/MapServer/mapcache/blob/main/mapcache.xml.sample#L753-L763 to see how getfeatureinfo should be configured, but no other information. My mapcache source config looks like http://? image/png ash_meteosat_0deg text/html ash_meteosat_0deg Any hints are appreciated. Trygve ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
[MapServer-users] getfeatureinfo works from mapserver but not via mapcache
Hi mapserver users list I have a mapserver with getfeatureinfo available. This seems to return the correct value for the selected timestamp for the given layer when used directly. But when I try to reach the same info, ie. getfeatureinfo, from mapcache a wrong timestamp is passed to mapserver and then the wrong values are returned. The request received by mapcache(as seen in the logs): 2023-04-14T13:34:20.304781696Z 172.16.16.234 - - [14/Apr/2023:13:34:20 +] "GET /okd-satellite =WMS=GetFeatureInfo=1.1.1=ash_meteosat_0deg_LAYERS=ash_meteosat_0deg=EPSG%3A3857=-3396560.8725830186,6408480.4514,7422652.026383018,11520588.9031=1782=842=333=704=image/gif_FORMAT=text/html=&=2023-04-11T07%3A15%3A00Z The request received by mapserver(as seen in the logs): 2023-04-14T13:34:20.303555611Z 172.16.2.224 - - [14/Apr/2023:13:34:20 +] "GET /okd-satellite?VERSION=1.1.1=GetFeatureInfo=WMS==image%2fpng=ash_meteosat_0deg=%2fconfig%2fmapserver-products.map=-3396560.872583%2c6408480.451400%2c7422652.026383%2c11520588.903100=1782=842=EPSG%3a3857=333=704_FORMAT=text%2fhtml_LAYERS=ash_meteosat_0deg=2023-03-25T16%3a00%3a00Z HTTP/1.1" 200 743 "-" "mod-mapcache/1.11dev" So what happens. The mapcache request looks correct with time=2023-04-11T07:15:00Z, then I guess this request is forwarded to mapserver, but I think it is without the TIME parameter. Why I think this is because the request I see in the mapserver logs has the default time stamp as given in my mapfile. Are there some configuration I'm missing? I had a look at https://github.com/MapServer/mapcache/blob/main/mapcache.xml.sample#L753-L763 to see how getfeatureinfo should be configured, but no other information. My mapcache source config looks like http://? image/png ash_meteosat_0deg text/html ash_meteosat_0deg Any hints are appreciated. Trygve ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
[MapServer-users] mapcache: time dimension default value and psql list_query
Hi mapserver users list I have a mapserver backend with mapcache to handle the tile queries and psql as a db. It's working but I have some details I'm trying to improve. 1: The time dimension has a default value. The client I server data to require this. I have 1 week of data available adding more data every 5 minute ( and deleting old data). Therefor the hard coded default value quickly become out of range. ie: time="true" unit="ISO8601"> Is there a way to make the default value be the newest value from my psql? (an emergency solution will be to make some kind of script that continuously update this value somehow, but I hoped to avoid that.) 2: I think I understand that list all timestamps values from the psql. This will be visible in the mapcache getcapabilities as a list of timestamps, 2016 stamps with data every 5 minutes for one week. Like units="ISO8601">2023-03-23T00:00:00Z, 2023-03-30T13:30:00Z Is there a way to make a start/end/step kind of list? eg 2023-03-23T00:00:00Z/2023-03-30T13:30:00Z/PT5M Thanks Trygve Aspenes ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [MapServer-users] How to add templates(html) to be use with getFeatureInfo for raster data
Thanks I have already tried all kind of options with template and filenames. What I was missing was the query option "info_format=text/html" doing eg. curl. So my setup was working all the time, but my test curl was wrong. Trygve Den 2023-03-24 18:09, skrev Kobben, Barend (UT-ITC): The line TEMPLATE "empty" Should be TEMPLATE "" _-- _ _Barend Köbben_ On 24/03/2023, 17:48, "MapServer-users" wrote: Hi Users list! I'm trying to get getFeatureRequest to reply with a html template with pixel values from a geotiff raster image. I have my layer like this: LAYER NAME "Overview" STATUS ON TYPE raster TEMPLATE "empty" DATA METADATA "wms_title" "Overview" "wms_timeextent" "2021-08-27T13:20:48Z/2021-08-27T13:20:48Z" "wms_enable_request" "*" END FILTER (`[TIME]` = `2021-08-27T13:20:48Z`) END If I ask for the getcapabilities, the getfeatureinfo looks like this: text/html application/vnd.ogc.gml text/plain https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink=05%7C01%7Cb.j.kobben%40utwente.nl%7Ca71634c058d2421f20d508db2c879c59%7C723246a1c3f543c5acdc43adb404ac4d%7C0%7C0%7C638152733187323138%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=b1Um6UNYhoT5jVanlyPbiM4W3aHN7eIlSNMu3sVIuQM%3D=0; xlink:href="http://localhost:8080/mapserverapi?"/> https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink=05%7C01%7Cb.j.kobben%40utwente.nl%7Ca71634c058d2421f20d508db2c879c59%7C723246a1c3f543c5acdc43adb404ac4d%7C0%7C0%7C638152733187323138%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=b1Um6UNYhoT5jVanlyPbiM4W3aHN7eIlSNMu3sVIuQM%3D=0; xlink:href="http://localhost:8080/mapserverapi?"/> And if I ask for the getfeatureinfo I get: GetFeatureInfo results: Layer 'Overview' Feature 0: So far so good. But now I want to add a custom template to ultimately give me a html template with pixel values. but what ever I try to put in the TEMPLATE variable, I dont get any other than the results shown above. In my LAYER config I try with TEMPLATE "http://localhost:8080/.html" or TEMPLATE ".html" but nope. mapserver is v7.4.3 In the documentation there is something about getfeatureinfo here https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmapserver.org%2Fmapfile%2Fcluster.html%23handling-getfeatureinfo=05%7C01%7Cb.j.kobben%40utwente.nl%7Ca71634c058d2421f20d508db2c879c59%7C723246a1c3f543c5acdc43adb404ac4d%7C0%7C0%7C638152733187323138%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=uWdSh%2BNpt4m5Q2u8i39XtCWnsnbFzhrGP2DtvO1VRbA%3D=0, but that is for cluster so I dont think it applies here. Something more here https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmapserver.org%2Fogc%2Fwms_server.html%23how-does-a-wms-work=05%7C01%7Cb.j.kobben%40utwente.nl%7Ca71634c058d2421f20d508db2c879c59%7C723246a1c3f543c5acdc43adb404ac4d%7C0%7C0%7C638152733187323138%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=FhVwEX6uJgfDF7LXIiUei68dGgYM1kXP0laJ2s58m1Y%3D=0, but still I don't get it. Some lines after https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmapserver.org%2Fogc%2Fwms_server.html%23setup-a-mapfile-for-your-wms=05%7C01%7Cb.j.kobben%40utwente.nl%7Ca71634c058d2421f20d508db2c879c59%7C723246a1c3f543c5acdc43adb404ac4d%7C0%7C0%7C638152733187323138%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=KvCsFuN%2BE8sKZpxlGvf9X2vTPE6zWlJxGw2GuOzxSAs%3D=0 there is also Configuring for GetFeatureInfo Requests: Here I learned how to enable the getfeatureinfo. But the examples only gives the replies, not how I need to setup my map file. Also https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmapserver.org%2Fogc%2Fwms_server.html%23sample-wms-server-mapfile=05%7C01%7Cb.j.kobben%40utwente.nl%7Ca71634c058d2421f20d508db2c879c59%7C723246a1c3f543c5acdc43adb404ac4d%7C0%7C0%7C638152733187323138%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=8e9FKztuVma73pzpqXu8vKJtCwwtBSjdA7ndZedTjnM%3D=0 [3] is nice, But I still don't get it. Any advise is much appreciated. Trygve ___ MapServer-users mailing list MapServer-users@lists.osgeo.org
[MapServer-users] How to add templates(html) to be use with getFeatureInfo for raster data
Hi Users list! I'm trying to get getFeatureRequest to reply with a html template with pixel values from a geotiff raster image. I have my layer like this: LAYER NAME "Overview" STATUS ON TYPE raster TEMPLATE "empty" DATA METADATA "wms_title" "Overview" "wms_timeextent" "2021-08-27T13:20:48Z/2021-08-27T13:20:48Z" "wms_enable_request" "*" END FILTER (`[TIME]` = `2021-08-27T13:20:48Z`) END If I ask for the getcapabilities, the getfeatureinfo looks like this: text/html application/vnd.ogc.gml text/plain xmlns:xlink="http://www.w3.org/1999/xlink; xlink:href="http://localhost:8080/mapserverapi?"/> xmlns:xlink="http://www.w3.org/1999/xlink; xlink:href="http://localhost:8080/mapserverapi?"/> And if I ask for the getfeatureinfo I get: GetFeatureInfo results: Layer 'Overview' Feature 0: So far so good. But now I want to add a custom template to ultimately give me a html template with pixel values. but what ever I try to put in the TEMPLATE variable, I dont get any other than the results shown above. In my LAYER config I try with TEMPLATE "http://localhost:8080/.html" or TEMPLATE ".html" but nope. mapserver is v7.4.3 In the documentation there is something about getfeatureinfo here https://mapserver.org/mapfile/cluster.html#handling-getfeatureinfo, but that is for cluster so I dont think it applies here. Something more here https://mapserver.org/ogc/wms_server.html#how-does-a-wms-work, but still I don't get it. Some lines after https://mapserver.org/ogc/wms_server.html#setup-a-mapfile-for-your-wms there is also Configuring for GetFeatureInfo Requests: Here I learned how to enable the getfeatureinfo. But the examples only gives the replies, not how I need to setup my map file. Also https://mapserver.org/ogc/wms_server.html#sample-wms-server-mapfile is nice, But I still don't get it. Any advise is much appreciated. Trygve ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
[MapServer-users] Custom grayscale style on single band float32 geotiff looks strange
Hi So, I have a single band geotiff with float32 values. Opening it directly in eg. QGIS, this looks fine. I define various styles with fixed colors for pixels with defined value range for this looking as expected, but then I define a kind of grayscale style looking like this in mapfile: CLASS NAME "orig" GROUP "GRAYSCALE" STYLE RANGEITEM "pixel" COLORRANGE 0 0 0 255 255 255 DATARANGE -31.50 96.00 END # STYLE END # CLASS however the resulting image is partly grayscale and spottet with light blue pixels. Please see the attached image link how it looks: https://drive.google.com/file/d/1JfyCL047JngCJh44jpa7Ei7a5wqhihOM/view?usp=share_link So I think I do something wrong defining the grayscale style like this. I tried to ask for the SLD for to see what mapserver makes for me, but alas, no luck. If a do a GetStyles request I only get an empty SLD document: curl 'http://localhost:8000/?SERVICE=WMS=1.3.0=GetStyles=layer-name' xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd; xmlns="http://www.opengis.net/sld; xmlns:ogc="http://www.opengis.net/ogc; xmlns:se="http://www.opengis.net/se; xmlns:xlink="http://www.w3.org/1999/xlink; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;> So someone have an idea why my image looks spotty when expecting a grayscale image and why do I get an empty SLD? ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [MapServer-users] Mapserver and WMS time - could somebody have a look at my test server, please?
Hi Stafan Looking at you getCapabilities I see like nearestValue="0">2022-10-12T095941Z,2022-11-13T095149Z Look at the documentation you need the time to be formated like this: https://mapserver.org/ogc/wms_time.html#time-patterns Trygve Den 2022-11-17 09:11, skrev Stefan Gofferje: Hi all, as part of my learning mapserver, I set up a testserver to serve images with a time dimension. I was trying to verify the output with QGIS but the temporal panel does not show me the times the server offers. That's now too many moving parts for my poor newbie brain to troubleshoot: Is my mapserver config wrong, does QGIS simply not ask the server for available times or am I using QGIS wrong...? Could somebody have a quick look at the output of my testserver if the GetCapapilities output looks right and if the WMS-time works correctly? That would be awesome! I made my testserver public at https://mapserver.gofferje.net/?map=sat=WMS=1.3.0=GetCapabilities Thank you!!! Stefan ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
[MapServer-users] mapserver v8.0.0, ogcapi feature and datetime/time
_wfs/items?f=json=10=0","rel":"self","title":"Items for this collection as GeoJSON","type":"application/geo+json"},{"href":"http://localhost:8080/mapserverapi/test_mapfile/ogcapi/collections/li_spatialite_demo_wfs/items?f=html=10=0","rel":"alternate","title":"Items for this collection as HTML","type":"text/html"}],"numberMatched":0,"numberReturned":0,"type":"FeatureCollection"} If I hardcode in DATA for datetime I get one feature as expected: DATA "select ogc_fid as ID, * from li_spatialite_demo where epoch > unixepoch('2013-06-20T07:00:00Z')-1 and epoch <= unixepoch('2013-06-20T07:00:00Z')+1" curl -s 'http://localhost:8080/mapserverapi/test_mapfile/ogcapi/collections/li_spatialite_demo_wfs/items?f=json=0,40,20,60=0=10' {"features":[{"geometry":{"coordinates":[6.9066,49.8582],"type":"Point"},"id":"602","properties":{"ID":602,"epoch":1371711600.409},"type":"Feature"}],"links":[{"href":"http://localhost:8080/mapserverapi/test_mapfile/ogcapi/collections/li_spatialite_demo_wfs/items?f=json=10=0","rel":"self","title":"Items for this collection as GeoJSON","type":"application/geo+json"},{"href":"http://localhost:8080/mapserverapi/test_mapfile/ogcapi/collections/li_spatialite_demo_wfs/items?f=html=10=0","rel":"alternate","title":"Items for this collection as HTML","type":"text/html"}],"numberMatched":1,"numberReturned":1,"type":"FeatureCollection"} If I change the DATA to this: DATA "select ogc_fid as ID, * from li_spatialite_demo" I get expected features, but of course datetime is not used This got a bit long, but my question is how to use the datetime query parameter with mapserver ogcapi features. Trygve Aspenes ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [MapServer-users] Possible to pass sql dialect when querying a flatgeobuf?
Even, wow, thanks. I did had a look in the mapogr.cpp file and guessed some changes needed to be added. But the code is far too complicated for me to follow. I don't have a setup now to compile the mapserver, so I better try out Spatialite or GPKG. However I googled a bit and found a hint using virtual layer like this: CONNECTION " /data/mapserver/ select * from li_flatgeobuf_demo where unixepoch(TimeStamp) between unixepoch('%time%')-300 and unixepoch('%time%') " With this, mapserver works, at least no error messages are returned. But I only get an empty image in return. If a create a separate .ovf file to use with ogrinfo I get the same (working but no data returned): ogrinfo /flatgeobuf.ovf li_flatgeobuf_demo INFO: Open of `/flatgeobuf.ovf' using driver `OGR_VRT' successful. Layer name: li_flatgeobuf_demo Geometry: Point Feature Count: 0 Layer SRS WKT: GEOGCRS["WGS 84", ENSEMBLE["World Geodetic System 1984 ensemble", MEMBER["World Geodetic System 1984 (Transit)"], MEMBER["World Geodetic System 1984 (G730)"], MEMBER["World Geodetic System 1984 (G873)"], MEMBER["World Geodetic System 1984 (G1150)"], MEMBER["World Geodetic System 1984 (G1674)"], MEMBER["World Geodetic System 1984 (G1762)"], MEMBER["World Geodetic System 1984 (G2139)"], ELLIPSOID["WGS 84",6378137,298.257223563, LENGTHUNIT["metre",1]], ENSEMBLEACCURACY[2.0]], PRIMEM["Greenwich",0, ANGLEUNIT["degree",0.0174532925199433]], CS[ellipsoidal,2], AXIS["geodetic latitude (Lat)",north, ORDER[1], ANGLEUNIT["degree",0.0174532925199433]], AXIS["geodetic longitude (Lon)",east, ORDER[2], ANGLEUNIT["degree",0.0174532925199433]], USAGE[ SCOPE["Horizontal component of 3D system."], AREA["World."], BBOX[-90,-180,90,180]], ID["EPSG",4326]] Data axis to CRS axis mapping: 2,1 Geometry Column = GEOMETRY TimeStamp: String (0.0) with ovf file like this: /data/mapserver/ select * from li_flatgeobuf_demo where unixepoch(TimeStamp) between unixepoch('2013-06-20T07:00:00Z')-30 and unixepoch('2013-06-20T07:00:00Z')+60 Well almost there, but nope. Thanks for your time Trygve Aspenes Den 2022-10-19 21:35, skrev Even Rouault: Trygve, you may want to change - line https://github.com/MapServer/MapServer/blob/698a4407265cce9db322a34e21e279e57e9746f8/mapogr.cpp#L1265 from hLayer = OGR_DS_ExecuteSQL( hDS, pszLayerDef, NULL, NULL ); to hLayer = OGR_DS_ExecuteSQL( hDS, pszLayerDef, NULL, "SQLITE" ); and - line https://github.com/MapServer/MapServer/blob/698a4407265cce9db322a34e21e279e57e9746f8/mapogr.cpp#L2569 from psInfo->hLayer = OGR_DS_ExecuteSQL( psInfo->hDS, select, hGeom, NULL ); to psInfo->hLayer = OGR_DS_ExecuteSQL( psInfo->hDS, select, hGeom, "SQLITE" ); A processing option should be added to control this behavior in a clean way. The alternative is to convert your flatgeobuf file to Spatialite or GPKG, which natively speak the SQLITE dialect. Even Le 19/10/2022 à 20:48, Trygve Aspenes a écrit : Hi I have a flatgeobuf file ( or files) and need to filter by time using the time from the query. When I test on command line using ogrinfo I get something like this: ogrinfo -dialect SQLITE -sql "select * from li_flatgeobuf_demo where unixepoch(TimeStamp) between unixepoch('2013-06-20T17:00:29Z') and unixepoch('2013-06-20T17:00:29Z')+300" /data/mapserver/tile-index/* INFO: Open of `/data/mapserver/tile-index/points-2013062007.fgb' using driver `FlatGeobuf' successful. layer names ignored in combination with -sql. Layer name: SELECT Geometry: Point Feature Count: 17 Extent: (7.254900, -6.423300) - (58.263300, 51.656400) Layer SRS WKT: GEOGCRS["WGS 84", ENSEMBLE["World Geodetic System 1984 ensemble", MEMBER["World Geodetic System 1984 (Transit)"], MEMBER["World Geodetic System 1984 (G730)"], MEMBER["World Geodetic System 1984 (G873)"], MEMBER["World Geodetic System 1984 (G1150)"], MEMBER["World Geodetic System 1984 (G1674)"], MEMBER["World Geodetic System 1984 (G1762)"], MEMBER["World Geodetic System 1984 (G2139)"], ELLIPSOID["WGS 84",6378137,298.257223563, LENGTHUNIT["metre",1]], ENSEMBLEACCURACY[2.0]], PRIMEM["Greenwich",0, ANGLEUNIT["degree",0.0174532925199433]], CS[ellipsoidal,2], AXIS["geodetic latitude (Lat)",north, ORDER[1], ANGLEUNIT["degree",0.0174532925199433]], AXIS["geodetic longitude (Lon)",east, ORDER[2], ANGLEUN
[MapServer-users] Possible to pass sql dialect when querying a flatgeobuf?
Hi I have a flatgeobuf file ( or files) and need to filter by time using the time from the query. When I test on command line using ogrinfo I get something like this: ogrinfo -dialect SQLITE -sql "select * from li_flatgeobuf_demo where unixepoch(TimeStamp) between unixepoch('2013-06-20T17:00:29Z') and unixepoch('2013-06-20T17:00:29Z')+300" /data/mapserver/tile-index/* INFO: Open of `/data/mapserver/tile-index/points-2013062007.fgb' using driver `FlatGeobuf' successful. layer names ignored in combination with -sql. Layer name: SELECT Geometry: Point Feature Count: 17 Extent: (7.254900, -6.423300) - (58.263300, 51.656400) Layer SRS WKT: GEOGCRS["WGS 84", ENSEMBLE["World Geodetic System 1984 ensemble", MEMBER["World Geodetic System 1984 (Transit)"], MEMBER["World Geodetic System 1984 (G730)"], MEMBER["World Geodetic System 1984 (G873)"], MEMBER["World Geodetic System 1984 (G1150)"], MEMBER["World Geodetic System 1984 (G1674)"], MEMBER["World Geodetic System 1984 (G1762)"], MEMBER["World Geodetic System 1984 (G2139)"], ELLIPSOID["WGS 84",6378137,298.257223563, LENGTHUNIT["metre",1]], ENSEMBLEACCURACY[2.0]], PRIMEM["Greenwich",0, ANGLEUNIT["degree",0.0174532925199433]], CS[ellipsoidal,2], AXIS["geodetic latitude (Lat)",north, ORDER[1], ANGLEUNIT["degree",0.0174532925199433]], AXIS["geodetic longitude (Lon)",east, ORDER[2], ANGLEUNIT["degree",0.0174532925199433]], USAGE[ SCOPE["Horizontal component of 3D system."], AREA["World."], BBOX[-90,-180,90,180]], ID["EPSG",4326]] Data axis to CRS axis mapping: 2,1 Geometry Column = GEOMETRY TimeStamp: String (0.0) OGRFeature(SELECT):0 TimeStamp (String) = 2013-06-20T17:00:29Z POINT (11.3157 -5.3703) The trick is to use the SQLITE dialect. https://lists.osgeo.org/pipermail/gdal-dev/2022-October/056318.html But in my mapfile I have something like this: CONNECTIONTYPE OGR CONNECTION "/data/mapserver/" DATA "select * from flatgeobuf_demo where unixepoch(TimeStamp) between unixepoch('%time%')-300 and unixepoch('%time%')" But this does not work and I assume this is because OGR does not use the SQLITE dialect. So my question is: Is it possible the tell OGR to use the SQLITE dialect? My mapserver log is (from a docker container with mapserver v 7.6.x and GDAL 3.5.1) [Wed Oct 19 18:40:28 2022].5067, 12230.1280: GDAL: GDALOpen(/data/mapserver/, this=0x56387af83b60) succeeds as FlatGeobuf. [Wed Oct 19 18:40:28 2022].5068, 12230.1281: GDAL: GDALClose(/data/mapserver/, this=0x56387af83b60) 172.17.0.1 - - [19/Oct/2022:18:40:28 +] "GET /cgi-bin/mapserv?map=/mapfile/mapfile.map=WMS=1.3.0=GetMap=-20037508.34278924391,-39783385.7486210987,20037508.34278925508,44927335.42709603906=EPSG:3857=291=614=li_flatgeobuf_demo==2013-06-20T17:00:00Z=image/png=96_RESOLUTION=96_OPTIONS=dpi:96=TRUE HTTP/1.1" 200 802 "-" "curl/7.83.1" returning from a curl: curl 'http://localhost:8080/cgi-bin/mapserv?map=/mapfile/mapfile.map=WMS=1.3.0=GetMap=-20037508.34278924391,-39783385.7486210987,20037508.34278925508,44927335.42709603906=EPSG:3857=291=614=li_flatgeobuf_demo==2013-06-20T17:00:00Z=image/png=96_RESOLUTION=96_OPTIONS=dpi:96=TRUE' xmlns="http://www.opengis.net/ogc; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wms/1.3.0/exceptions_1_3_0.xsd;> msDrawMap(): Image handling error. Failed to draw layer named li_flatgeobuf_demo. msOGRFileOpen(): OGR error. ExecuteSQL() failed. Check server logs. Trygve Aspenes ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Mapserver projection, auto and extent
Thanks Jeff I have used the build in network logger available in new versions of QGIS ( I think you can activate it by pressing F12) a lot. That has been essential for me to understand whats going on, especially when I was debugging time dimension in some other setup. I revisited the wms-server doc you suggested and from that I added UNITS DD, and after that it seems to work. But the catch is I really don't understand why. But I guess mapserver needs to know the units of the original extent when requesting various other projections. And I love the 'AUTO' as I have tens of thousands of images, all with different projection! So even if it will cost me my sanity i think I will go with that :-) Trygve Den 2022-05-19 16:10, skrev Jeff McKenna: Hi Trygve, You can examine the problem QGIS GetMap request closely, through the Network Logger (it's really a saviour) https://github.com/mapserver/mapserver/wiki/Get-the-Raw-WMS-Request-Generated-by-QGIS Then you can go back to review the trusty WMS Server document, and make sure you have set the required metadata: https://mapserver.org/ogc/wms_server.html (which also means to remove all warnings from your GetCapabilities response) But that QGIS network logger is your lifeline :) Hope that gets you started, PS. I never use 'auto', ever, never, it's my own rule and that's how I keep my sanity and avoid these issues, ha. But others like it. I only speak for myself here. -jeff -- Jeff McKenna GatewayGeo: Developers of MS4W, MapServer Consulting and Training co-founder of FOSS4G http://gatewaygeo.com/ On 2022-05-19 10:26 a.m., Trygve Aspenes wrote: Hi I got a geotiff raster with a projection which is not an EPSG code, so in the mapfile I use AUTO in the layer projection. This also means I skip the extent and projection in map level in the mapfile. In one client this works fine ( this client request epsg:3857 and this looks fine to me) But in QGIS, this does not work nor any other projections. Then I add EXTENT and PROJECTION in my mapfile like this: MAP EXTENT -56.6378419 31.5007307 95.025531 84.6828537 PROJECTION "init=epsg:4326" END END And then EPSG:4326 works in QGIS also. But if I try to change the projection i qgis, eg to EPSG:3857, this does not work in QGIS, even if it still work in my other client. So what is it that I don't understand about EXTENT and PROJECTION. I have looked at the documentation https://mapserver.org/mapfile/projection.html#important-notes and and as far as I can understand from the second bullet point the projection definition at map level can be looked as the outgoing projection with the extent accordingly. What do I need to do to make QGIS be able to use other projections as well? I do have a link to my getcapabilities document, but hesitates to put it here. Trygve Aspenes ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Mapserver projection, auto and extent
Hi I got a geotiff raster with a projection which is not an EPSG code, so in the mapfile I use AUTO in the layer projection. This also means I skip the extent and projection in map level in the mapfile. In one client this works fine ( this client request epsg:3857 and this looks fine to me) But in QGIS, this does not work nor any other projections. Then I add EXTENT and PROJECTION in my mapfile like this: MAP EXTENT -56.6378419 31.5007307 95.025531 84.6828537 PROJECTION "init=epsg:4326" END END And then EPSG:4326 works in QGIS also. But if I try to change the projection i qgis, eg to EPSG:3857, this does not work in QGIS, even if it still work in my other client. So what is it that I don't understand about EXTENT and PROJECTION. I have looked at the documentation https://mapserver.org/mapfile/projection.html#important-notes and and as far as I can understand from the second bullet point the projection definition at map level can be looked as the outgoing projection with the extent accordingly. What do I need to do to make QGIS be able to use other projections as well? I do have a link to my getcapabilities document, but hesitates to put it here. Trygve Aspenes ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Mapserver: get map config file from remote url?
Hi Is it possible for mapserver to get the map configuration file from a remote url? like http://mapserver/map=http://map-file-host/map-file.map I have tried to look at the documentation, but could not find any hints that this is possible. I know I can use like vsicurl in the map file itself to get rasters from a remote url. Trygve Aspenes ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Mapcache disk cache gives unexpected paths to tiles
Ah, thanks Thomas! I did not catch that from the documentation. I also needed to add layout like this: /mapcache/{tileset}/{grid}/{dim:time}/{z}/{x}/{y}.{ext} to make it work ( both from testing and looking at the documentation) If you use the default this will be like tilecache as far as I understand. Do you have any idea what will be the fastest? To use default like: /mapcache or the solution above with template? ( As a lot of 000 directories will be created with the base one) Trygve Den 2022-02-09 12:24, skrev thomas bonfort: You should remove the /mapcache from the >cache> block, as it takes precedence over your -- thomas On Wed, Feb 9, 2022 at 12:10 PM Trygve Aspenes wrote: Hi I have a mapcache running using disk as cache method with config like this: /mapcache /mapcache/{tileset}#{grid}#{dim}/{z}/{x}/{y}.{ext} But here is what I get on disk: /mapcache//EPSG:3857/2022-02-05T00:12:00Z/05/000/000/038/000/000/043.png What I don't understand is below the zoom level (here 05) I get 000 followed by 000. Then the y followed by another double 000 before I get the x with my extension. Where does all these 000 sub directories comes from and what functions do they have? I don't think this affects the performance, but this must cause creating thousands and thousands of unnecessary sub directories? Thanks. Trygve ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Mapcache disk cache gives unexpected paths to tiles
Hi I have a mapcache running using disk as cache method with config like this: /mapcache /mapcache/{tileset}#{grid}#{dim}/{z}/{x}/{y}.{ext} But here is what I get on disk: /mapcache/name>/EPSG:3857/2022-02-05T00:12:00Z/05/000/000/038/000/000/043.png What I don't understand is below the zoom level (here 05) I get 000 followed by 000. Then the y followed by another double 000 before I get the x with my extension. Where does all these 000 sub directories comes from and what functions do they have? I don't think this affects the performance, but this must cause creating thousands and thousands of unnecessary sub directories? Thanks. Trygve ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] wms_timeextent from time elements in postgres in mapserver map file
Thanks again Dave Yeah, that's what I did. But the client I'm using is actually using this so the client makes the data "available" into the future which is quite annoying for the user. So I have to come up with a better solution. So a dirty fix I came up with is to make a template map file with environment variable name for the time extent (updated by some script) and then generate the map file using envsubst (from gettext package). (Maybe jinja2 also could be used, I have to think about it) This works, but it does not feel like an elegant solution. But I think I will go for this if no better solution comes up. Trygve Den 2022-01-19 22:41, skrev David Hoese: Possibly unhelpful, but since you haven't gotten a response from anyone else: I just have mine set to the first available time and a time in the year 2040. I don't have data past the current date/time, but wms_timeextent isn't wrong either. Dave On 1/19/22 03:47, Trygve Aspenes wrote: Hi all My problem is I have new data every 5 minutes updateing a postgres db with, among others columns, one timestamp column. Thats easy. But its not easy to automatically update my mapserver map file for the wms_timeextent element with the same information. Is it possible to use this time information from my db in the wms_timeextent definition in my map file? Filling the actual available time extent dynamically? Thanks Trygve ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] wms_timeextent from time elements in postgres in mapserver map file
Hi all My problem is I have new data every 5 minutes updateing a postgres db with, among others columns, one timestamp column. Thats easy. But its not easy to automatically update my mapserver map file for the wms_timeextent element with the same information. Is it possible to use this time information from my db in the wms_timeextent definition in my map file? Filling the actual available time extent dynamically? Thanks Trygve ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Mapcache time dimension default value; and 'tearing down pooled connection' message
Hi there! Slowly I'm getting mapserver/mapcache up running and looks now how to improve things. First: When I load a mapcache tileset with time dimension from a pg db the oldest image is displayed in my client. Is it possible to somehow get the newest image as default? My tileset dimension look something like this: time="true" unit="ISO8601"> host=mapserver-db user=$PGSQ_USERNAME password=$PGSQ_PASSWORD dbname=mapserver port=5432 SELECT to_char(time, '-MM-DD"T"HH24:MI:SS"Z"') FROM products where product_name='product>' order by Id SELECT to_char(time,'-MM-DD"T"HH24:MI:SS"Z"') FROM products WHERE time = to_timestamp(:start_timestamp) AND time = to_timestamp(:end_timestamp) AND product_name='' ORDER BY time DESC I saw the `d1` default value in the documentation, but don't understand of that is a dummy or an actual selector. I have grepped around the source code, but could not see anything obvious. Second: My client updates/fetch the getCapabilities of my mapcache server every minute. Each time this is fetched the mapcache log is filled with messages like: mod_mapcache.c(164): [client ] tearing down pooled connection (dim_product>_time) to make room, referer: I dont understand why these connections is teared down every time getCapabilites is requested. I have looked in the documentation, but could not see how to control this. But in the mapcache.xml.sample the connection pool config is described. But adding this to my mapcache config does not remove these tear downs. 2000 12000 Any suggestions why this connection tear down is happening and if there is something to do about it. It slows down the getCapabilities request a bit, but if I add to many tileset I guess this will even further slow down. Thanks Trygve Aspenes ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] mapcache behind nginx with ssl
OK So I will answer my self then after a major hint from a mapcache user. In the mapcache.xml.sample file there is a section https://github.com/MapServer/mapcache/blob/11f7713c5efb730a1699dfd35bbf7300b38c8e06/mapcache.xml.sample#L7-L14 Where you can do exactly what I want. This solves my problem Den 2021-09-27 22:40, skrev Trygve Aspenes: Hi there I have put up a mapserver behind nginx with ssl and a curl like this curl -s "https://mapserver/cgi-bin/mapserv?map=/data/mapserver/map-files/mapserver-8505ad3e-f9e3-4de3-a080-8253443ac954-20210908T120432Z.map=WMS=GetCapabilities; | grep OnlineResource Gives me like: http://www.w3.org/1999/xlink; xlink:href="https://mapserver/cgi-bin/mapserv?map=/data/mapserver/map-files/mapserver-8505ad3e-f9e3-4de3-a080-8253443ac954-20210908T120432Z.map"/> http://www.w3.org/1999/xlink; xlink:href="https://mapserver/cgi-bin/mapserv?map=/data/mapserver/map-files/mapserver-8505ad3e-f9e3-4de3-a080-8253443ac954-20210908T120432Z.map"/> http://www.w3.org/1999/xlink; xlink:href="https://mapserver/cgi-bin/mapserv?map=/data/mapserver/map-files/mapserver-8505ad3e-f9e3-4de3-a080-8253443ac954-20210908T120432Z.map"/> http://www.w3.org/1999/xlink; xlink:href="https://mapserver/cgi-bin/mapserv?map=/data/mapserver/map-files/mapserver-8505ad3e-f9e3-4de3-a080-8253443ac954-20210908T120432Z.map"/> http://www.w3.org/1999/xlink; xlink:href="https://mapserver/cgi-bin/mapserv?map=/data/mapserver/map-files/mapserver-8505ad3e-f9e3-4de3-a080-8253443ac954-20210908T120432Z.map"/> Yeah you get the idea. Everything perfect with https in the href link. Thanks! So I put up a mapcache which I intend to put up i front of mapserver. When I do a similar curl like: curl -s "https://mapcache/mapcache?Overview=/data/mapserver/map-files/mapserver-8505ad3e-f9e3-4de3-a080-8253443ac954-20210908T120432Z.map=WMS=GetCapabilities; | xmllint --format - | grep OnlineResource I get: http://www.w3.org/1999/xlink; xlink:href="http://mapcache:8090/mapcache?"/> http://www.w3.org/1999/xlink; xlink:href="http://mapcache:8090/mapcache?"/> http://www.w3.org/1999/xlink; xlink:href="http://mapcache:8090/mapcache?"/> http://www.w3.org/1999/xlink; xlink:href="http://mapcache:8090/mapcache?"/> I here starts the problems. If I do this in eg QGIS, QGIS are told to go to the http address with port 8090(mapcache is setup to run on port 8090 behind the scenes) which is not reachable. It should return https (with no specified port, ie. using standard https port) if I understands correctly. And I just cant figure put why. The configuration for the two are almost identical and I have double and tripple check my config. Any idea what I should check next? If it could be of any help I could open access to my mapcache server running. Thanks Trygve PS: when I test mapcache and mapserver setup locally without ssl and nginx in front it works fine. ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] mapcache behind nginx with ssl
Hi there I have put up a mapserver behind nginx with ssl and a curl like this curl -s "https://mapserver/cgi-bin/mapserv?map=/data/mapserver/map-files/mapserver-8505ad3e-f9e3-4de3-a080-8253443ac954-20210908T120432Z.map=WMS=GetCapabilities; | grep OnlineResource Gives me like: http://www.w3.org/1999/xlink; xlink:href="https://mapserver/cgi-bin/mapserv?map=/data/mapserver/map-files/mapserver-8505ad3e-f9e3-4de3-a080-8253443ac954-20210908T120432Z.map"/> xmlns:xlink="http://www.w3.org/1999/xlink; xlink:href="https://mapserver/cgi-bin/mapserv?map=/data/mapserver/map-files/mapserver-8505ad3e-f9e3-4de3-a080-8253443ac954-20210908T120432Z.map"/> xmlns:xlink="http://www.w3.org/1999/xlink; xlink:href="https://mapserver/cgi-bin/mapserv?map=/data/mapserver/map-files/mapserver-8505ad3e-f9e3-4de3-a080-8253443ac954-20210908T120432Z.map"/> xmlns:xlink="http://www.w3.org/1999/xlink; xlink:href="https://mapserver/cgi-bin/mapserv?map=/data/mapserver/map-files/mapserver-8505ad3e-f9e3-4de3-a080-8253443ac954-20210908T120432Z.map"/> xmlns:xlink="http://www.w3.org/1999/xlink; xlink:href="https://mapserver/cgi-bin/mapserv?map=/data/mapserver/map-files/mapserver-8505ad3e-f9e3-4de3-a080-8253443ac954-20210908T120432Z.map"/> Yeah you get the idea. Everything perfect with https in the href link. Thanks! So I put up a mapcache which I intend to put up i front of mapserver. When I do a similar curl like: curl -s "https://mapcache/mapcache?Overview=/data/mapserver/map-files/mapserver-8505ad3e-f9e3-4de3-a080-8253443ac954-20210908T120432Z.map=WMS=GetCapabilities; | xmllint --format - | grep OnlineResource I get: http://www.w3.org/1999/xlink; xlink:href="http://mapcache:8090/mapcache?"/> http://www.w3.org/1999/xlink; xlink:href="http://mapcache:8090/mapcache?"/> http://www.w3.org/1999/xlink; xlink:href="http://mapcache:8090/mapcache?"/> http://www.w3.org/1999/xlink; xlink:href="http://mapcache:8090/mapcache?"/> I here starts the problems. If I do this in eg QGIS, QGIS are told to go to the http address with port 8090(mapcache is setup to run on port 8090 behind the scenes) which is not reachable. It should return https (with no specified port, ie. using standard https port) if I understands correctly. And I just cant figure put why. The configuration for the two are almost identical and I have double and tripple check my config. Any idea what I should check next? If it could be of any help I could open access to my mapcache server running. Thanks Trygve PS: when I test mapcache and mapserver setup locally without ssl and nginx in front it works fine. ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users