ThinkGeo.com    |     Documentation    |     Premium Support

ThinkGeo v12 How to place CAD drawing within given extent

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

Thanks Alexey,
We need specify the project then the mapsuite know where to put each feature on the map. Just force put the drawing to some extent may not precise for each feature. Like you mentioned the best way may need pre-convert all your drawings to global projection(3857). Then we don’t need specify the projection for the drawing layer. we just need specify “Meter” as map’s unit. You will get better performance since you don’t convert the feature on the command.

Let me know if this is help for you.

Thanks

Frank