[MapServer-users] Inconsistent support for template substitution

Seth G sethg at geographika.co.uk
Thu Oct 19 08:26:51 PDT 2023


Hi,

This seems like a bug - there is a check to see if the Map projection is a geographic coordinate system [1], and if it is then it skips all the [maplon], [maplat], [minlon] etc. substitutions. If it is in another projection then the point and extent are reprojected to latlon and included in the template. 

Seth


[1] https://github.com/MapServer/MapServer/blob/main/src/maptemplate.c#L4273

--
web:https://geographika.net & https://mapserverstudio.net
twitter: @geographika

On Thu, Oct 19, 2023, at 3:50 PM, Andrew Harfoot via MapServer-users wrote:
> Hi list,
> 
> I am setting up a WMS server using Mapserver 7.6.2 and want to return a html response to a GetFeatureInfo request where the response contains the coordinates of the GFI click. The WMS supports multiple coordinate systems, so ideally I'd like to have the coordinates in a CRS that I can predetermine.
> 
> I have a test template file as follows:
> 
> <!-- MapServer Template --> 
> <p>
> Map X/Y : [mapx],[mapy]<br>
> Map LL : [maplon],[maplat]
> </p>
> If I configure an 'old style' TEMPLATE in the map file, directly referencing the html template as follows:
> 
> LAYER
>   TEMPLATE "coord_comp.html"
> With a GFI request specifying a CRS of EPSG:27700:
> 
> ...&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetFeatureInfo
>   &BBOX=379766.9556955648586154,58602.32640402266406454,405538.15569556411355734,94300.79913129436317831
>   &CRS=EPSG:27700&WIDTH=649&HEIGHT=899&LAYERS=test&STYLES=&FORMAT=image/jpeg&QUERY_LAYERS=test
>   &INFO_FORMAT=text/html&I=268&J=647&FEATURE_COUNT=50
> 
> 
> 
> the output of is as follows:
> 
> 
> Map X/Y : 390428.846605,68589.162768
> Map LL : 50.516415,-2.135015
> 
> When a similar requests are made specifying a CRS of EPSG:4326:
> 
> ...&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetFeatureInfo
>   &BBOX=50.33460688675980776,-2.28814701603231718,50.84060858090575863,-1.92285769511938809
>   &CRS=EPSG:4326&WIDTH=649&HEIGHT=899&LAYERS=test&STYLES=&FORMAT=image/jpeg&QUERY_LAYERS=test
>   &INFO_FORMAT=text/html&I=298&J=579&FEATURE_COUNT=50
> 
> the output is as follows:
> 
> 
> 
> 
> Map X/Y : 50.514437,-2.120136
> Map LL : [maplon],[maplat]
> 
> The maplat and maplon templates are not substituted.
> 
> Mapserver has been compiled with PROJ support and a PROJECTION has been defined for the layer in the map file.
> 
> The CRS of the source data is EPSG:27700
> 
> I was hoping that the maplat and maplon templates would provide me with a consistent source of coordinate information, independent of the request CRS. Can anybody shed any light on the observed behaviour?
> 
> Thanks,
> Andy
> 
> -- 
> Andy Harfoot
> 
> Skype: gdi_ajph
> Teams: ajph at soton.ac.uk
> Phone: +44 2380 590566
> 
> GeoData Institute
> University of Southampton
> Southampton
> SO17 1BJ
> 
> www.geodata.soton.ac.uk
> _______________________________________________
> MapServer-users mailing list
> MapServer-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20231019/caebdf82/attachment-0001.htm>


More information about the MapServer-users mailing list