ThinkGeo.com    |     Blog    |     Wiki    |     Support

WmsRasterLayer from WmsRasterSource

MapSuite Team,

The SendingWebRequest event has a sender of WmsRasterSource. How does one get the corresponding WmsRasterLayer from the WmsRasterSource?

Thanks,
Dennis

Hi Dennis,

In fact the layer implement its function via the corresponding source, so if you want to do anything for the layer, you can find the API in source.

And you can also directly get the wmslayer from map=>overlay=>layer.

Wish that’s helpful.

Regards,

Ethan

Ethan,

I’m afraid it is not clear to me how to get the WmsRasterLayer when only the WmsRasterSource is known.

Here’s a code snippet of the event. I have the source, what’s the code required to get its layer?

I can’t see any properties of the source that correspond to layer. Nor does casting work.

Is it possible to get the layer from its source?

Thanks,
Dennis

    private static void SendingWebRequest(object sender, SendingWebRequestEventArgs TheEventArgs)
    {
        WmsRasterLayer  TheWmsRasterLayer;
        WmsRasterSource TheWmsRasterSource;

        // get WmsRasterSource
        TheWmsRasterSource = (WmsRasterSource)sender;

        // get WmsRasterLayer
        TheWmsRasterLayer = ???;
    }

Hi Dennis,

It’t not possible to get layer from source, but just like I mentioned, all the functions in layer in fact is implemented in its source, so could you please let us know your scenario about why you have to get the layer in the function? So we can see how to make it work for you.

Regards,

Ethan

hi Ethan,

In any type of unsolicited event one needs to have access to various data structures in order to properly handle the event. In my specific case I need the SendingWebRequest to set the timer that correspond to the layer as each of my layers has it own timer. Keep in mind that this event is used for each layer. I do not have any event per layer as my application is generically data driven.

I have decided that I can use WmsRasterSource.ActiveLayerNames to search my data structures. Once I have that data structure the timer is accessible.

It would have been helpful if the WmsRasterSource had a Name property or a Tag Property. These properties are always helpful in searching ones data structures.

Thanks,
Dennis

Hi Dennis,

I think you can use Uri property to adjust which layer it is.

Regards,

Ethan

Ethan,

I do find it a bit odd that the source upon entry to the SendingWebRequest event is the WmsRasterSource when the event is created with the WmsRasterLayer.

I suggest providing a means to get back to the WmsRasterLayer from the WmsRasterSource, also I’d add a Name and Tag properties. This would give developers much more flexibility.

In the meantime I will make this work.

Thanks,
Dennis
OriStar Mapping, Inc.

Hi Dennis,

Thanks for your suggestion, I will let our developer know it.

Regards,

Ethan