Hi Poul,
it’s possible to access the provided WMS service with ThinkGeo Blazor UI control, with few changes of “Blazor Sample OGC Service Sample”. Here are the demo codes of MapView:
<MapView Id="map" @ref="map"
Center="@(new PointShape(19.41710,51.57224))"
Zoom="15"
MapUnit="@ThinkGeo.Core.GeographyUnit.DecimalDegree"><OverlaysSetting>
<WmsTileOverlay Id="WmsOverlay" Parameters="@parameters"
ServerUris="@serverUris"
TileHeight="512" TileWidth="512"></WmsTileOverlay>
</OverlaysSetting>
<MapToolsSetting>
<MapTools>
<ZoomBarMapTool />
</MapTools>
</MapToolsSetting>
</MapView>
@code {
MapView map;
Collection<Uri> serverUris = new Collection<Uri> { new Uri("http://mapy.geoportal.gov.pl/wss/service/img/guest/ORTO/MapServer/WMSServer") };
Dictionary<string, string> parameters = new Dictionary<string, string>
{
{ "layers", "Raster"},
{ "STYLE", "default"},
{ "CRS","EPSG:4326"}
};
}
Now it should work, but after the map is loaded, it shows the blank map with following error:
Access to image at 'http://mapy.geoportal.gov.pl/wss/service/img/guest/ORTO/MapServer/WMSServer?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&layers=Raster&STYLE=default&CRS=EPSG%3A4326&WIDTH=512&HEIGHT=512&STYLES=&BBOX=51.56982421875%2C19.40185546875%2C51.591796875%2C19.423828125' from origin 'http://localhost:64632' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Even enabled “crossOrigin:‘anonymous’” to allow “Crossing Domain Access”, still got the same error, could you please help check if the service supports “Access-Control-Allow-Origin”? If yes, we can check if any issues on my side. Sorry for the inconvenience.
If we paste the request URL of one tile, such as http://mapy.geoportal.gov.pl/wss/service/img/guest/ORTO/MapServer/WMSServer?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&layers=Raster&STYLE=default&CRS=EPSG%3A4326&WIDTH=512&HEIGHT=512&STYLES=&BBOX=51.56982421875%2C19.40185546875%2C51.591796875%2C19.423828125, a satellite image should show up in the browser, it’s proved the codes above is correct, the only problem is “Access-Control-Allow-Origin”. Here is the URL of this WMS service capabilities http://mapy.geoportal.gov.pl/wss/service/img/guest/ORTO/MapServer/WMSServer?request=GetCapabilities&version=1.3.0&SERVICE=WMS.
Thanks,
Johnny