ThinkGeo.com    |     Documentation    |     Premium Support

WMS -- GetMap Request

hi Mark,

Yes, long conversation and hopefully nearing a solution. We’re putting a lot of knowledge out there though.

I’ll respond to each of your points.

  1. SendingWebRequest - There is no requirement to get the TIME information from other tiles. The TIME parameter is associated with a request, not tiles per se.

  2. Sending Request URL - The TIME parameter is placed in the request at the client in the SendingWebRequest event. In the Local WmsServer that TIME parameter is then found in ProcessRequestCore and GetMapCore. The Local WmsServer does not put the TIME parameter in the request at either ProcessRequestCore or GetMapCore because it is already there from the client. The private class you mention is where the TIME parameter is being removed. I think the solution is to modify that private class and allow the TIME parameter to pass thru to SendingWebRequest.

3a. Options I: Are you saying that if GetMapCore sets the public static property for a given client request that before execution reaches SendingWebRequest another client request may come in and overwrite the value from the first client request? I should mention that as it is now implemented the logic in my SendingWebRequest only adds TIME to the request if the public static property is not empty. Once a TIME is added to the request then the public static property is set to empty.

3b. Options II: I don’t understand what the point is of using DateTime.Now as it’s a prior time that the client wants to see.

3c. Options III: This is certainly an option to consider and in fact I already have a collection in place with each object corresponding to a client. So I can easy enough place the TIME in the object corresponding to the client in GetMapCore. The issue is how to identify the client in SendingWebRequest. As far as I can see there is no identifiable information within the arguments for SendingWebRequest that identify the client in any way, either thru IP Address, SessionId, etc. Sure a GUID can be used as the key, but how does SendingWebRequest get that GUID out of the SendingWebRequest arguments?

I feel the most solid solution is to modify the private class to detect the presence of a TIME parameter and if present include it in the formatted request that is then passed to SendingWebRequest.

Thanks,
Dennis
OriStar Mapping, Inc.

Hi Dennis,

Thanks for your detail information.

I can understand that the best solution for you is modify the private class to support TIME parameter, but this parameter is not good option for WMS service, if we added that, it maybe confuse other WMS server users. So I think we don’t want to modify that for now. The WMS API and parameter is based on WMS specification: http://www.opengeospatial.org/standards/wms

Here is one new solution, you can use WMS layer custom parameters to parse TIME parameter. I think that will approach your requirement. Belos is main code for parsing TIME parameter.

  1. Add TIME parameter from Client:

  2. Parse TIME parameter in Server Layer:

We already created one sample for your requirements, please refer below attachment for details:
NearMapWMSSample.zip (2.3 MB)
Before running this sample, please update all the projects references.

If there is any more questions, please feel free let us know that.


PS: Ben had one meeting with you yesterday, he discuss with me for this issue today. If above solution still cannot approach your requirements, you can send more information to Ben, we will check that with high priority.

Thanks
Mark

hi Mark,

Yes, I can appreciate your hesitation to change the private class due to adverse effects it might have.

I believe I now understand your suggestion of using DateTime.Now.

I’ll attempt to integrate this into my application and see how it works.

Thanks very much for your assistance.

I’ll let you know the outcome.

Dennis
OriStar Mapping, Inc.

Hi Dennis,

Thanks for your update, any question please let us know.

Regards,

Ethan

Hi Ethan & Mark,

I’ve implemented a solution, based on the code snippets you provided, as outlined below. This appears to work rather well and is a very clean implementation. I’ve done a fair amount of testing including requests coming in from two different workstations at the same time and it appears to work.

After all this time it turned out to be a rather simple and straightforward solution, which is great.

A big thank you to Ethan, Mark, & Ben for staying with me on this to find the solution.

Regards,
Dennis
OriStar Mapping, Inc.

  1. All the work has been done within the Local WmsServer.

  2. The TIME Parameter is not added when the layer is created as that did not serve a purpose.

  3. All coding was done in WmsLayerPlugin.GetMapCore.

  4. The TIME Parameter, if it already exists, must be removed because it is either not needed for the request or a new one is going to be added.

  5. If TIME is found within the request from the client then add the TIME Parameter to the layer.

  6. All references to TIME in other code has been removed.

    protected override Bitmap GetMapCore(GetMapRequest TheGetMapRequest, MapConfiguration TheMapConfiguration, HttpContext TheContext)
    {
        string TheTimeValue;
    
        // get the layer
        var TheLayer = (WmsRasterLayer)TheMapConfiguration.Layers["NearMap"];
    
        // Remove any existing TIME Parameter because either it is not needed or to prevent Duplicate Exception during Parameters.Add
        bOutCome = TheLayer.Parameters.TryGetValue("TIME", out TheTimeValue);
        if (bOutCome == true)
        {
            TheLayer.Parameters.Remove("TIME");
        }
    
        // check if Time(Date) present in Client RequestString and if so Parameters.Add
        TheTimeValue = TheContext.Request.QueryString["TIME"];
        if ((TheTimeValue != null) && (TheTimeValue != string.Empty))
        {
            switch (TheContext.Request.QueryString["REQUEST"].ToUpper())
            {
                case "GETMAP":
                    TheLayer.Parameters.Add("TIME", TheTimeValue);
                    break;
                case "GETFEATUREINFO":
                case "GETCAPABILITIES":
                    break;
                default:
                    break;
            }
        }
    
        // get BitMap and return
        return base.GetMapCore(TheGetMapRequest, TheMapConfiguration, TheContext);
    }

Hi Dennis,

Thanks for share your summary about this question, that’s should be helpful if anybody met the same problem, and we are glad to help you on your problem.

Regards,

Ethan