Hi,
I have a problem with applying projection to a InMemoryFeatureLayer that select in OnDragEnded event of TrackInteractiveOverlay:
we have attached a sample to this post , and in our sample we describe two senario :
1. if we select an area on my map by OnDragEnded event ,and then apply bingMap to it , sample works fine.
2. if we apply bingMap at first and then select an area on map by OnDragEnded event , nothing is selected .
===============================
in out sample , we create a mapControl that inherit from wpfMap and implement 4 action on it :
- AddSource
- ApplyMap
- DeleteMap
- Select area on map ( OnDragEnded ) . we need to work this operations on my map .
can any one help me on this problem ?
thanks alot
Problem with Applying projection to a InMemoryfeaturelayer on OnDragEnded event
Hi Maryam,
I checked your sample and we don’t need to apply the projection on the selectionLayer in the DragEnded events. Comment out the below codes should fix the issue:
//if (MapType != MapTypes.None)
//selectionLayer.FeatureSource.Projection = new Proj4Projection
//{
// InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(27700),
// ExternalProjectionParametersString = Proj4Projection.GetBingMapParametersString()
//};
Actually, the selectionLayer projection is always the same as the base map like here Mercator as all the features in it are from TrackShapeLayer. In your layers, only the shape file under EPSG 27700 should do the projection and you have done that I saw.
Hope it helps.
Regards,
Troy
thanks for your response .
I did what you recommended , and this problem was resolved,
but follow this :
=====================
1. select use bing map
2. select area on map
3. unselect use bing map
============================
you see that my selection disappears .
would you help me on this new problem !
thanks a lot
Hi Maryam,
Okay, the reason of the problem is still caused by the projection. In this case, when we unselect the bing map, we zoom the map to the extend which is under EPSG 27700, however, the select layer is still under the Bing projection by default. So, in the deleteMap Method, we need to apply the EPSG 27700 to the select layer to fit the current extent changed.
Personally, it is not a regular way to make the all kinds of layers to fit the shape file projection like your sample unless you have a special scenario, as that would bring a lot of projection conversions. The common way is we set a basic map projection like as Bing’s and then we only need to apply the corresponding projection on the other layers. For instance, the Bing or Google and the TrackShapeLayer are using the same projection and only the shape file is using the ESPS 27700. So we only do the projection conversion on the shape file at the first. Then we don’t need to do the projection any more.
I also attached the modified sample to show what I am saying and I also did some enhancements like using only one select layer instance rather insert a new layer in each drag end events.
If there is any thing confused on the explanation or the sample, please feel free to let us know.
Regards,
Troy
post11824.txt (5.28 KB)