Hi ThinkGeo
Could you please hint on how to place CAD drawing within given extent if projection is not supplied?
For example:
private void AddCADLayer(MapView wpfMap)
{
CadFeatureLayer cadFeatureLayer = new CadFeatureLayer(@“Cad_data.dwg”);
LayerOverlay layerOverlay2 = new LayerOverlay();
wpfMap.Overlays.Add(layerOverlay2);
layerOverlay2.Layers.Add(cadFeatureLayer);
cadFeatureLayer.FeatureSource.Open();
var pc = new ProjectionConverter()
{
ExternalProjection = new Projection(Projection.GetBingMapProjString()),
InternalProjection = new Projection(Projection.ConvertEpsgToProjString(???)) // <<< Which projection to use?
};
pc.Open();
cadFeatureLayer.FeatureSource.ProjectionConverter = pc;
RectangleShape cadExtent = cadFeatureLayer.FeatureSource.GetBoundingBox();
cadFeatureLayer.FeatureSource.Close();
wpfMap.CurrentExtent = cadExtent;
wpfMap.Refresh();
}
Problem is:
if, for example, the cad drawing has native (internal projection) bound to Paris (3949), then placing CAD drawing to the new projection 3068 (Berlin) will offset drawing beyond Berlin area (since all points in the drawing are related to the native Paris-projection). If user try to specify global projection - it will not help either, placing drawing in the ocean.
There could be several strategies, but what would be a “right” way of placing drawing into the specified extent?
With kind regards,
Alexey