[mapguide-users] MapGuide WMS Requests are Always in ESSG:4326 ?

Crispin Hoult (TrueViewVisuals) crispin at trueviewvisuals.com
Wed Jun 5 04:50:45 PDT 2024


OK,

It was the configuration document that was required – I'm sure MGAuthor used to create one for you, but it was a long time ago and I'm a bit rusty on this!  Found the guidance PDF and added the following as a configuration document to my .DataSource

For an ArcGIS Server I had to remove the <timestamp> from the default schema mapping template to prevent a different server-side error being returned but with the <SpatialContext> override my requests are all EPSG:27700

I hope this is helpful to the next person searching for this.

 Crispin


<?xml version="1.0" encoding="UTF-8"?>
<DataStore xmlns:fdo="http://fdo.osgeo.org/schemas" xmlns:gml="http://www.opengis.net/gml" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://fdo.osgeo.org/schemas" xsi:schemaLocation="http://fdo.osgeo.org/schemas&#xD;&#xA;FdoDocument.xsd">
  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://fdo.osgeo.org/schemas/feature/WMS" xmlns:fdo="http://fdo.osgeo.org/schemas" xmlns:WMS="http://fdo.osgeo.org/schemas/feature/WMS" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:element name="BGS_50k_Bedrock" type="WMS:BGS_50k_BedrockType" abstract="false" substitutionGroup="gml:_Feature">
      <xs:key name="BGS_50k_BedrockKey">
        <xs:selector xpath=".//BGS_50k_Bedrock" />
        <xs:field xpath="Id" />
      </xs:key>
    </xs:element>
    <xs:complexType name="BGS_50k_BedrockType" abstract="false">
      <xs:complexContent>
        <xs:extension base="gml:AbstractFeatureType">
          <xs:sequence>
            <xs:element name="Id">
              <xs:simpleType>
                <xs:restriction base="xs:string">
                  <xs:maxLength value="256" />
                </xs:restriction>
              </xs:simpleType>
            </xs:element>
            <xs:element name="Image" type="fdo:RasterPropertyType" fdo:defaultImageXSize="800" fdo:defaultImageYSize="600">
              <xs:annotation>
                <xs:appinfo source="http://fdo.osgeo.org/schemas">
                  <fdo:DefaultDataModel organization="Row" bitsPerPixel="32" tileSizeX="100" tileSizeY="100" />
                </xs:appinfo>
              </xs:annotation>
            </xs:element>
          </xs:sequence>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:schema>
  <SchemaMapping provider="OSGeo.WMS.3.1" name="WMS" xmlns="http://fdowms.osgeo.org/schemas">
    <complexType name="BGS_50k_Bedrock">
      <RasterDefinition name="Image">
        <Format>PNG</Format>
        <Transparent>true</Transparent>
        <BackgroundColor>0xFFFFFF</BackgroundColor>
        <Elevation>0</Elevation>
        <SpatialContext>EPSG:27700</SpatialContext>
        <Layer name="BGS.50k.Bedrock">
          <Style />
        </Layer>
      </RasterDefinition>
    </complexType>
  </SchemaMapping>
</DataStore>

________________________________
From: Crispin Hoult (TrueViewVisuals) <crispin at trueviewvisuals.com>
Sent: 04 June 2024 4:34 PM
To: MapGuide Users Mail List <mapguide-users at lists.osgeo.org>
Cc: Jackie Ng <jumpinjackie at gmail.com>
Subject: Re: [mapguide-users] MapGuide WMS Requests are Always in ESSG:4326 ?

Thanks Jackie,

.MGP attached (no config.xml in the .FeatureSource... is this where I could "fix" it?)

GetCapabilities here:
map.bgs.ac.uk/arcgis/services/BGS_Detailed_Geology/MapServer/WMSServer?service=WMS&version=1.3.0&request=GetCapabilities<https://map.bgs.ac.uk/arcgis/services/BGS_Detailed_Geology/MapServer/WMSServer?service=WMS&version=1.3.0&request=GetCapabilities>

Images showing CMD prompt with SET HTTP_PROXY settings and resultant capture from Fiddler when previewing the .WebLayout ... showing the GetMap image request.

As I say, in this example instance there IS a map returned because the underlying WMS supports EPSG:4326 which is passed in the request, even though the map is set to British National Grid 27700.

My actual problem is with a private WMS that only supports EPSG:27700 and so when MGServer forms the WMS request with 4326 in it, the WMS returns the InvalidSRS (correctly as it does not advertise support for that CRS)

My local machine has MG4 preview, but I don't think anything significant has changed in WMS since 3.1.2

Hope all is well - Crispin

________________________________
From: mapguide-users <mapguide-users-bounces at lists.osgeo.org> on behalf of Jackie Ng via mapguide-users <mapguide-users at lists.osgeo.org>
Sent: 04 June 2024 11:06 AM
To: MapGuide Users Mail List <mapguide-users at lists.osgeo.org>
Cc: Jackie Ng <jumpinjackie at gmail.com>
Subject: [mapguide-users] MapGuide WMS Requests are Always in ESSG:4326 ?

Hi Crispin,

Could you attach or send me a .mgp of the WMS feature source and its current configuration document so we have a baseline from which to determine who/what is at fault and what can be done? I want to eliminate the possibility that following your setup steps results in a different feature source + config doc combination.

- Jackie

You wrote:

Hi,

I have a client with Map and MapGuide connecting to a WMS service for UK maps. AutoCAD Map makes a request OK using similar FDO WMS provider ... but the MG logs showed a InvalidCRS message when MGServer makes a map request.

I realised (via a public WMS and a helpful blog on using Fiddler) that the issue is that MG is requests always using EPSG:4326 within the Request=GetMap.

When I set my .MapDefinition up I used a British EPSG:27700 that is listed as supported in the GetCapabilities but the request does not use this native projection.
In the  case of the problem service it ONLY published on EPSG:27700 and a few others and NOT on the most common EPSG:4326 – and as such returns an InvalidSRS response when MG sends it's converted request in using 4326.

A solution, obvs, is to get the provider to add the CRS into the GetCapabilities, however I think this is a bug (is there a workaround with the configuration document?) as there is no obvious requirement for this when working with projected maps and the projection is published in the WMS.

Example:

  1.
Create a new WMS .FeatureSource to https://map.bgs.ac.uk/arcgis/services/BGS_Detailed_Geology/MapServer/WMSServer?service=WMS&version=1.3.0


  1.
Create a new layer to "BGS 50k Bedrock" (a Maestro bug does not list all layers, edit XML by hand)
  2.
Create a New Map, using EPSG:27700, add the layer
  3.
Create a New layout and set initial view to centre on 300000,600000 and zoom scale 40000
  4.
Map will preview OK but the underlying request shows similar to below

https://map.bgs.ac.uk/arcgis/services/BGS_Detailed_Geology/MapServer/WmsServer?version=1.3.0&service=WMS&REQUEST=GetMap&EXCEPTIONS=XML&LAYERS=BGS.50k.Bedrock&STYLES=&CRS=EPSG:4326&SRS=EPSG:4326&FORMAT=image/png&BBOX=56.211896,-3.973780,56.281919,-3.810279&HEIGHT=782&WIDTH=1032&TRANSPARENT=FALSE&BGCOLOR=0xFFFFFF



 Many thanks,

  Crispin

Crispin Hoult
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapguide-users/attachments/20240605/121928c9/attachment.htm>


More information about the mapguide-users mailing list