ThinkGeo.com    |     Documentation    |     Premium Support

V10 - Rendering WmsRasterLayer at same projection as ShapeFIleFeatureLayer

MapSuite Team,

I have an existing application that only uses ShapeFileFeatureLayer with a MapUnit of Feet and a projection of: NAD_1983_StatePlane_Illinois_East_FIPS_1201_Feet.

I am now implementing a WmsRasterLayer and the WMS Server has projections such as EPSG:3857, EPSG:3785, and others.

I’ve attempted code like this, but an exception is encountered.

An unhandled exception of type ‘System.TypeInitializationException’ occurred in ThinkGeo.MapSuite.Wpf.dll
Additional information: The type initializer for ‘fSQ=.3UU=’ threw an exception.

        Proj4Projection proj4Projection = new Proj4Projection();
        proj4Projection.InternalProjectionParametersString = Proj4Projection.ConvertPrjToProj4(the projection string from below);

        proj4Projection.ExternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(3857);

        TheAssetsStatic.aTheMapLayerItemWmsRasterNearMap.TheWmsRasterLayer.ImageSource.Projection = proj4Projection;
        TheAssetsStatic.aTheMapLayerItemWmsRasterNearMap.TheWmsRasterLayer.ImageSource.Projection.Open();

How can the WmsRasterLayer be projected the same as all the existing ShapeFileFeatureLayer?

Thanks,
Dennis

The full Projection File–>
PROJCS[“NAD_1983_StatePlane_Illinois_East_FIPS_1201_Feet”,GEOGCS[“GCS_North_American_1983”,DATUM[“D_North_American_1983”,SPHEROID[“GRS_1980”,6378137.0,298.257222101]],PRIMEM[“Greenwich”,0.0],UNIT[“Degree”,0.0174532925199433]],PROJECTION[“Transverse_Mercator”],PARAMETER[“False_Easting”,984250.0],PARAMETER[“False_Northing”,0.0],PARAMETER[“Central_Meridian”,-88.33333333333333],PARAMETER[“Scale_Factor”,0.999975],PARAMETER[“Latitude_Of_Origin”,36.66666666666666],UNIT[“Foot_US”,0.3048006096012192]]

Hi Dennis,

We don’t suggest you assign Proj4Projection to WmsRasterLayer.

You should double check whether the server support your projection and set the projection in the parameter for example CRS. Then you can get the correct tile image from server.

The Google, Bing layer can support Proj4Projection is because we did special optimize for them.

Regards,

Ethan

Ethan,

Why are you suggesting not to use Proj4Projection for WMS? Are you saying that MapSuite does not support Proj4Projection for WMS?

From what I can tell so far the WMS server I must integrate does not have the projection I require.

Does MapSuite have any on-the-fly projection for WMS?

Does MapSuite support on-the-fly projection for MrSid, TIFF, and JPEG2000 rasters?

Thanks,
Dennis

Dennis,

I think there’s some confusion. As your post is in WPF Desktop Edition section, our guys must have thought you mean getting a plain image from WMS server and do the reprojection on client side. However I guess what you meant is to support projection on server side and return images with different projections according to the request parameters, is that right? The exception it raised is from wpf map which is just the client consuming the server.

One quick thing I can think of is that RasterProjection needs some dependencies to work properly, please install the following installer on your server:

Development Branch: (if you are using Map Suite 9.0.X.0)
https://files.thinkgeo.com:5001/sharing/AtuHMyWXf

Release Branch: (if you are using Map Suite 9.0.0.X)
https://files.thinkgeo.com:5001/sharing/A4bAeDXra

Thanks,

Ben

hi Ben,

Actually I did intend to do the reprojection on the client side. Reprojection using Proj4Projection works with ShapeFileFeatureLayer on the client side so assumed it would also work for a WmsRasterLayer.

I’m actually going thru two stages in my development of WMS integration.

The first is to have the client consume WmsRasterLayer directly from a cloud based WMS provider of raster images. This is not a WMS Server that I am developing. Hence the need to use reprojection on the client side.

The second stage is then to develop a MapSuite based WMS Server that sits between the cloud based WMS server and my clients. During this stage I could have the MapSuite WMS Server do the reprojection of what it gets from the cloud.

Does this make sense? And is it possible to do WmsRasterLayer reprojection within the client?

Thanks,
Dennis

Dennis,

After working with you the other day on your WMS server, I kept thinking all the features you requested are for Server side. You know if you got a hammer, everything looks like a nail.

Map Suite does support on-the-fly projection for MrSid, TIFF, JPEG2000 and other raster sources, and WMS Server too. Raster projection is heavier than Vector projection and that’s why usually if a raster base map has a different projection than a vector shape file, we always recommended to project the vector data to the raster projection. I think that’s what Ethan worries about.

For your issue, can you first try SingleTile mode on wpf map to avoid any potential multi-threading issue, any raised the SendingWebRequest event in WMS Layer and check the request URI there, and try the URI in a browser and see if it can get a valid image from your WMS server. I guess the server couldn’t return a valid image so it blew up the projection later, and most likely it’s because the data on server side doesn’t match the projection in the projection file.

If it doesn’t work and you need further assistance, please create a simple demo consuming your WMS server, it would be easier for us to locate the issue and reduce a lot of back and forth.

Thanks,

Ben

Ben,

Thanks for your input.

For the issue about not being able to do on the fly projection - is this because of my recent post of the BoundingBox of the layer not being correctly returned? Refer to this post – V10 - WmsRasterLayer BoundingBox Discrepency

You recommend doing on the fly project for the shape file so it matches the Raster as projection for shape/vector layer are more efficient. Does that hold when my application has nearly 80 shape/vector layers plus very heavy InMemoryFeatureLayer?

Thanks
Dennis

Hi Dennis,

Our developer make further research about it, for now it can support convert between 3857 and 4326. The other projection need your test, we random choose some epsg number, most of them don’t works.

Please view this sample:

8753.zip (2.4 MB)

Regards,

Ethan

hi Ethan,

I am finally getting back to this projection/transformation issue that I am faced with. I would appreciate your thoughts on how to deal with this.

As you know I am integrating the nearmap WMS layers into my existing WpfDesktopEdition application. All of the layers in the current application have projection information as shown below. These layers include 70 ShapefileFeatureLayer, 10 SQLiteFeatureLayer, 20 MrSid, 16 JPEG2000, 12 InMemoryFeatureLayer. The MapUnit is set to Feet.

The available CRS values for nearmap are shown below.

Previously in this thread Ben had mentioned that it is possible to do transformation within My WMS Server on the nearmap layers. He posted some links, but those links have expired.

What do you think the best way would be to handle all these layers? I’m also concerned about user response times so from that perspective it has to be efficient.

I believe it is possible to convert the Shape, SQLite, and InMemoryFeatureLayer to EPSG:3857 using SaveToProjection, but what about the MrSid’s and JPEG2000’s?

Thanks,
Dennis

PROJCS[“NAD_1983_StatePlane_Illinois_East_FIPS_1201_Feet”,
GEOGCS[“GCS_North_American_1983”,
DATUM[“D_North_American_1983”,
SPHEROID[“GRS_1980”,6378137.0,298.257222101]],
PRIMEM[“Greenwich”,0.0],
UNIT[“Degree”,0.0174532925199433]],
PROJECTION[“Transverse_Mercator”],
PARAMETER[“False_Easting”,984250.0],
PARAMETER[“False_Northing”,0.0],
PARAMETER[“Central_Meridian”,-88.33333333333333],
PARAMETER[“Scale_Factor”,0.999975],
PARAMETER[“Latitude_Of_Origin”,36.66666666666666],
UNIT[“Foot_US”,0.3048006096012192]]

nearmap CRS:
EPSG:26916
EPSG:26915
EPSG:26914
EPSG:26913
EPSG:4269
EPSG:4326
EPSG:3857
EPSG:3785

Hi Dennis,

In our product the raster layer also support projection, I think you can build a demo to see whether your raster layer(mrsid, jpeg2000) can works well.

And it looks the first link in Ben’s works well, please let me know if you require the other one.

Regards,

Ethan

Ethan,

Yes, I need the second link for the Production Build.

I will do some experimentation with my various layers.

Thanks for your advice.

Dennis

Hi Dennis,

I think this file is what you want: https://ap.thinkgeo.com:5001/sharing/YF8Z27FPW

Regards,

Ethan

hi Ethan,

If you can I’d prefer to download the individual DLL’s that are contained within this msi file. I prefer to know exactly what I am installing and with an MSI unfortunately one is installing blindly. I have MapSuite V9 products installed and what to make sure I do not adversely effect those products.

If you would provide the individual DLL’s that would be appreciated.

Thanks,
Dennis

Hi Dennis,

If your OS is x64, please delete this folder “C:\Windows\SysWOW64\Map Suite 9.0” and then install the msi again.

Then you can copy everything under “C:\Windows\SysWOW64\Map Suite 9.0”

And copy the 5 files under “C:\Windows\SysWOW64”.

That’s all from the installer.

Wish that’s helpful.

Regards,

Ethan