ThinkGeo.com    |     Blog    |     Wiki    |     Support

Nearmap.com support

MapSuite Team,

I know this is an old topic, but I am just now about to begin this effort.

What I would like to do is have a WpfDesktopEdition client make a request via WMS to a local WMS(s). In turn that local WMS(s) would then make a WMS to nearmap. Is this possible with the ThinkGeo WMS? Another way of explaining this is that the WpfDesktopEdition clients would not make a WMS request directly to nearmap, but would make their request to a WMS that is in the middle of the client and nearmap. So the request is from the client to local WMS(s), local WMS to nearmap. The response would then come back to the local WMS and that WMS would then forward it on to the client.

I want to do it this way as there is more control over the clients for load sharing and our clients are not permitted to have Internet access.

Any ideas or suggestions you might provide is appreciated.

Thanks,
Dennis

Hi Dennis,

I think your project looks like below:

  1. Clients send request to a local WMS
  2. Local WMS send request to nearmap.
  3. Client has limitation to access the internet access.

Base on the requirements, I can say ThinkGeo WMS can support that.

And we have another simple solution for you:

  1. Base on our researching, nearmap can be supported by WMS, instead of WMS server, you can consider use WMSLayer/WMSOverlay to request the nearmap, you no need build your local WMS server.
  2. To access the nearmap, you can set the proxy on WMS layer/overlay. This proxy can be your server which can access internet.

If you need any information, please feel free to contact us.

Thanks
Mark

Mark_Lee,

Thanks very much for your response.

I prefer the simple solution, but unfortunately I am not able to use because we are in a secure environment and our client workstations are allowed no Internet access even via a proxy server. I also think is would be nice to have the WMS because I have plans to use it to provide a single source for other spatial layers .

This means I have to use the more complicated method, but I don’t think it should be that much more complicated.

I would like to incorporate the WMSLayer at the client, which would then come into a local WMS Server. Somewhere in the local WMS Server the request would be intercepted and then sent on to the nearmap WMS Server. I’m thinking that the WMSLayer request would be intercepted in GetMapConfigurationCore and/or GetMapOverride.

Do you have any ideas on how the WMSLayer request might be passed-thru the local WMS to nearmap WMS?

Thanks,
Dennis

Hi Dennis,

Here is one WMS integration guide from nearmap support:
https://support.nearmap.com/hc/en-us/articles/213707968-WMS-integration

Below is sample code for how to use WMSLayer:

<code c#>
WmsRasterLayer wmsImageLayer = new WmsRasterLayer(new Uri(“http://howdoiwms.thinkgeo.com/WmsServer.aspx”));
wmsImageLayer.UpperThreshold = double.MaxValue;
wmsImageLayer.LowerThreshold = 0;

        wmsImageLayer.Open();
        foreach (string layerName in wmsImageLayer.GetServerLayerNames())
        {
            wmsImageLayer.ActiveLayerNames.Add(layerName);
            wmsImageLayer.ActiveStyleNames.Add("Simple");
        }
        // this parameter is just optional.
        wmsImageLayer.Exceptions = "application/vnd.ogc.se_xml";

        LayerOverlay staticOverlay = new LayerOverlay();
        staticOverlay.Layers.Add("wmsImageLayer", wmsImageLayer);

Hope that’s helpful.

Thanks
Mark

hi Mark,

I had previously read the nearmap documentation and it seems pretty straightforward. Thanks for the sample code for the WMSLayer.

The area I’m still a bit vague on is how to use the ThinkGeo WMS as an intermediate server. When the WMSLayer from the client makes a request to the ThinkGeo WMS how can I forward that request on to nearmap?

Thanks,
Dennis

Hi Dennis,

Here are some information for you maybe can help you to more clear when ThinkGeo WMS integration with nearmap:

  1. WMS server quick start guide, with this guide, you can easy to create one WMS server for shape file resource.
    http://wiki.thinkgeo.com/wiki/map_suite_wms_server_edition_quick_start_guide
    after this, you can find more sample from http://wiki.thinkgeo.com/wiki/map_suite_wms_server_edition_all_samples
  2. You need to update the logic in GetMapCongurationCore to make sure it load the WMS layer for nearmap, I have pasted the code before.
  3. Create client to request your local WMS server, here is some sample code:
    <code c#>
    WmsOverlay wmsOverlay = new WmsOverlay(“WMS Overlay”);
    wmsOverlay.Parameters.Add(“LAYERS”, “Map Suite World Map Kit”);
    wmsOverlay.Parameters.Add(“STYLES”, “DEFAULT”);
    //Here you add your WMS Server uri
    wmsOverlay.ServerUris.Add(new Uri(“http://localhost:62626/WmsHandler.axd”));
    Map1.CustomOverlays.Add(wmsOverlay);

If you still have any question for this, we can provider one professional service for you. you can contact our sales for details.

Thanks
Mark

hi Mark,

Thanks very much for making this clear to me. I was over-thinking the issue and now see just how easy this is to do.

Regards,
Dennis

Hi Dennis,

It is great that’s helpful to you. If you meet any questions when using MapSuite, please feel free to contact us.

Thanks
Mark

MapSuite Team,

I am finally at the point in my WMS development to incorporate my local WMS Server implementing a layer from a third-party WMS Server (nearmap) and would like to clarify how to do this with you.

Instead of my WpfDesktopEdition clients getting a raster layer directly from the nearmap WMS Server they will request the raster layer from my local WMS Server, which will then in turn request the layer from the nearmap WMS Server.

Previously in this thread the MapSuite team said this was possible.

I wanted to clarify that I would create a WMS Handler and in method GetMapConfigurationCore I would create a WmsRasterLayer, similar to how any other layer would be created, for example, a ShapeFileFeatureLayer, that will in turn be loaded from the nearmap WMS Server? The only difference is that the data for the layer would not be stored on a local drive, but rather the data would come from the nearmap WMS Server via the Internet.

Do you understand what I attempting to do here? I will have client request WmsRasterLayer from locally networked ThinkGeo based WMS Server, then the ThinkGeo Based WMS Server makes the request to the nearmap WMS Server.

Your assistance is appreciated.

Thanks,
Dennis

Hi Dennis,

I think you want to use “Your user” - > “Your WMS server” - > “NearMap” - > “Your WMS server” -> “Your user” instead of “Your user” - > “NearMap” -> “Your user”, right?

But I don’t know what’s the problem you met, have you tried the code from the reply of Mark? Whether this solution don’t works?

Regards,

Ethan

hi Ethan,

Yes, my goal is ***“Your user” - > “Your WMS server” - > “NearMap” - > “Your WMS server” -> “Your user”***.

I’m going to begin coding this today.

I will let you know how it goes.

Thanks,
Dennis

hi Ethan,

I’ve made some progress in this endeavor. However, there appears to be an issue with the data within the UriRequest being sent to the NearMap WMS Server from My WMS Server. The issue is that the ApiKey field is missing from the UriRequest when doing a GetMap request, which results in an error being returned from the NearMap WMS Server. The ApiKey field does appear in the UriRequest when requesting GetCapabilities.

The UriRequest data when sent from my WpfDesktopEdition V10.2 client directly to the NearMap WMS Server has the ApiKey present as part of the data for all requests.

I sent an email to support@ThinkGeo.com with an attached text file which shows a log of the UriRequest strings when sent from client directly to NearMap WMS Server and when sent from My WMS Server to the NearMap WMS Server. You will be able to see that the ApiKey field does not appear on GetMap when sending from My WMS Server to the NearMap WMS Server.

Another anomaly that I noticed is that the sequence of the individual fields within the UriRequest string are in a different order when sending to NearMap from my client as opposed to sending to NearMap from My WMS Server. The order itself does not matter, but indicates to me that the string is being manipulated differently between these two cases. Maybe the ApiKey field is inadvertently being omitted.

I believe this is occurring somewhere within MapSuite because you’ll notice that the https Web Address is there, but the ApiKey is missing.

My WpfDesktopEdition is V10.2, MY WMS Server is using V9.0.0.856.

Your thoughts?

Thanks,
Dennis

Hi Dennis,

For the missing ApiKey field, please make sure your parse the parameter in your WMS server side and add it to your request to the NearMap server. I think this progress should be handled by your custom code, please double check your code to make sure what’s the exactly problem, for example you cannot get the sent parameter from client side. If you parse the received request(from client side), then add them as parameter to the new WMS layer in your WMS server side, the new request URL should be built by the WMS layer, so the order should be related with the the inner logic of WMS layer, you should want to make sure you had passed the ApiKey field as parameter into the WMS layer here.

And I think the server side version and client side version is not important, because their communication is only via the http request.

If you want to get our assistant about here, please show us the code how your parse in server side and pass them into the new request as parameter, so we can try to reproduce it.

Regards,

Ethan

hi Ethan,

Based on your response I’ve made progress. I added the following line of code to My WMS Server resulting in imagery being returned and displayed:

        TheWmsRasterLayer.Parameters.Add("ApiKey", "ApiKeyRemovedForSecurityReasons");

It’s odd because I do not need this line of code in my client application when the client sends directly to the NearMap WMS Server. But if this is what it takes then I’m fine with it.

Whether I’m sending to NearMap from the client or My WMS Server I create the layer with:

TheWmsRasterLayer = new WmsRasterLayer(TheUri);

Where the value of TheUri has the web address as well as the ApiKey.

So, on to another issue…

The entire imagery that I’m expecting is not being displayed. As shown below part of the image is missing.

What is odd is that if a zoom out is done the area that is missing in the above picture actually appears at the next ZoomOut Level. The two pictures below are an example:

The below picture shows the imagery prior to a ZoomOut:

The below picture shows the imagery as a result of a ZoomOut. Notice how the sections that were not there at the prior zoom level appear after a ZoomOut.

When the client sends the request directly to the NearMap WMS Server I don’t see that above described issue. All of the image is there.

And in fact the last picture is missing the entire left side of the image. The map should be entirely filled with imagery.

Whichever way the request is made one thing I’ve noticed is that there is a lot of flashing on and off and back on of tiles during Zoom In or Out. I sent an email to support @ThinkGeo.com with a video showing how the tiles flash on/off/on.

Your thoughts?

Dennis

Hi Dennis,

Our developer build a sample, but we don’t have the key of NearMap, we had register an account today, so maybe we can get the key after tomorrow.

Because without the key, so we render a shape file in the sample, it works well and without the blank area.

You can test the sample with your key, and let us know if it still don’t works.

Any question please let us know.

8190.zip (2.4 MB)

Regards,

Ethan

Hi Ethan,

Thank you for the sample WMS application. I took your application and modified NearMapPlugin.cs to load the proper nearmap layer. Also modified MapModel.cs to load the layer as defined in the plugin. I uploaded a zip of the project to my ThinkGeo FileStation at OriStarMapping/home/applications/ThinkGeoThinkGeoWMS-8190.zip…

After I made my changes your sample worked just fine.

While changing your application I got to thinking that maybe the issue I’m having is related to the BoundingBox. I looked at my code and discovered in My WMS Server that the BoundingBox that was specified corresponded to a small portion of the whole layer. I changed the BoundingBox so that it corresponds to the RectangleShape of the entire layer. Once I did that my application also worked.

While I was debugging I noticed that the GetConfigurationCore was invoked 4-5 times. I understood that it should be invoked only once.

Let me know if you were successful in getting an ApiKey for nearmap.

Thanks very much again for your assistance.
Dennis

Hi Dennis,

Thanks for let us know your status, our developer still hadn’t get the key from nearmap.

If we got that we will did some further test based on sample.

Regards,

Ethan

Hi Dennis,

We still hadn’t get the key from NearMap, we don’t know the reason, but it looks we cannot do further research for this problem.

Does your problem get any update?

Regards,

Ethan

hi Ethan,

I actually did solve my issue. I had the BoundingBox defined incorrectly.

What I’ve done is to totally rely on the BoundingBox that is returned in the Capabilities from the WMS Provider. I’m not following the paradigm in the ThinkGeo example of hard-coding BoundingBox as it is too prone to errors and too difficult to maintain.

In order to use the BoundingBox from Capabilities I have designed my application such that the Capabilities are requested and layers loaded prior to the WMS Server PlugIn being loaded. This allows for all data to be verified and loaded before any attempted use. My design also negates the need to hard-code layer names. Everything is contained in configuration.

As far as the nearmap ApiKey is concerned they will not give you a key as their service has to be purchased. I have arranged with nearmap that if I need your assistance again in the future where you will need an ApiKey you will be provided with one for the time it takes to offer assistance.

Thanks,
Dennis

Hi Dennis,

Thanks to let us know that.

Any question please feel free to let us know.

Regards

Ethan