I am working on adding additional projections to our mapping app.
I have converted the app the V12.0 because there seemed to be a lot of new features there.
I am having trouble both with keeping a consistent Zoom between projections and projecting Image data.
I am working with projections 4326 and 3857 right now.
When I use 4326 I get this, just a basic countries layer in this view.
When I switch to 3857 I get this:
But then if I zoom out a lot I get a more reasonable image:
If I switch back to 4326 no issue it appears fine without zooming.
What am I missing here.
I will show my code snippet:
SetLayerProjections(4326, 3857);
private void SetLayerProjections(int internalProj, int externalProj)
{
ProjectionConverter projConverter = new ProjectionConverter(internalProj, externalProj);
SetLayerProjections(projConverter);
}
private void SetLayerProjections(ProjectionConverter projConverter)
{
if (projConverter != null)
{
foreach (LayerOverlay overlay in OnyxMap.Overlays)
{
foreach (FeatureLayer layer1 in overlay.Layers)
{
layer1.Open();
layer1.FeatureSource.ProjectionConverter = projConverter;
layer1.FeatureSource.ProjectionConverter.Open();
}
}
}
OnyxMap.Refresh();
}
I also get exceptions thrown if I have NativeImageRasterLayers added to the map, as they cannot be casted to FeatureLayers. How do I project RasterLayers between the different projections? I noticed that Projection.CanConvertRasterToExternalProjection returned false for these projections. Is there a list of projections I could use that can convert rasters?
Thanks!