AnsweredAssumed Answered

SetViewpoint to zoom to several layers

Question asked by waldekn on Aug 27, 2018
Latest reply on Aug 27, 2018 by waldekn

I have several layers:

  1. Base layer from mapbox.com "satellite-streets-v10" with SRID=3857
  2. Operational layer "A" with SRID=2230
  3. Operational layer "B" with SRID=2229

I can zoom to one layer (e.g. "A") using the code:

MyMapView.SetViewpoint(new Viewpoint(layerA.FullExtent));

How can I zoom to all operational layers (A and B in this example)?

According to documentaiton when I add layers to the map they should be automatically reprojected to the SRID of the first added layer. However, this does not seem to be true, as they still keep original SRID in layer.SpatialReference property. 

I tried to create envelope as union of all layers:

envelopeBuilder.UnionOf(layerB.FullExtent);

This generates exception: "The input spatial reference is not equivalent to the owning spatial reference." This proves that layers are not reprojected and they don't have the same coordinate system on the map. 

Any suggestions how to get full extent of union of a few layers?

 

Regards,

Waldek

Outcomes