the card is loaded with distorted proportion

May 5, 2012 at 5:04 AM
Edited May 5, 2012 at 5:08 AM

hello

Uploading a file with a script

private void loadShpAuto()
        {
 
            //add layer to first map
            FeatureSet featureSet1 = new FeatureSet();

            string sT = @"D:\GISSampleData\tul\tul-city-a.shp";
 
            featureSet1 = (FeatureSet)DotSpatial.Data.FeatureSet.Open(sT);
 
 
            featureSet1.Reproject(map1.Projection);

            map1.Layers.Add(featureSet1);
            map1.ZoomToMaxExtent();
        }

 



And the card is loaded with distorted proportions.


http://kardioter.net/files/dotspatialquest.png

By reference image displaying the same file *. Shp.
Option A - Playing Quantum GIS (QGIS) is made.
Option B - obtained by loading me with the script shown above.

Please answer why the distortion of the map and what should be done so that it was not?

Thank you in advance for your reply.

All you good, respectful, Alexander
  V. Kravchenko.

May 5, 2012 at 4:03 PM

It's clearly to me that's a projection problem - from the code you provide, it's unclear to me, if the layer you are trying to load, is the first on the map.

You have to set the map control with the projection your layers use before you start loading them - if not all your layers use the same projection, then you should reproject them...

 

George J.

May 6, 2012 at 2:45 PM
Edited May 6, 2012 at 2:50 PM

thank you

in drawing all is loaded about 18 layers, with identical distortion


"You have to set the map control with the projection your layers use before you start loading them"..........can write a little in more detail?

May 6, 2012 at 7:18 PM

Let's say that your Map control is called uxMap:

            uxMap.Projection = KnownCoordinateSystems.Projected.World.WebMercator;
            uxMap.BackColor = Color.FromArgb(181, 208, 208);

            MapPointLayer vesselsLayer = new MapPointLayer();
            vesselsLayer.Projection = KnownCoordinateSystems.Projected.World.WebMercator;
            uxMap.MapFrame.Add(vesselsLayer);

            uxMap.ViewExtents = new Extent();

Map control projection by default is KnownCoordinateSystems.Geographic.World.WGS1984 - if your layers do not use this projection, you have to change it...

 

George J.

May 7, 2012 at 5:35 AM
Edited May 7, 2012 at 5:38 AM

thank you

but

GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223562997]],PRIMEM["Greenwich",0],UNIT["Degree",0.0174532925199433]]

entry in the file *.prj indicates that the coordinate system GCS_WGS_1984.

GCS_WGS_1984 is WGS1984, is not it?
WGS1984 is WGS84, is not it?

map1.Projection specified WGS84.

and

I rewrote the code, but the changes did not happen.

 

        private void loadShpLayer(int nLayer)
        {
 
            FeatureSet featureSet1 = new FeatureSet();
            string sT = @"D:\GISSampleData\tul\" + textLayres[nLayer, nColNamLayer] + ".shp";
            map1.Projection = KnownCoordinateSystems.Projected.World.WebMercator;

            featureSet1 = (FeatureSet)DotSpatial.Data.FeatureSet.Open(sT);
 
            featureSet1.Projection = KnownCoordinateSystems.Projected.World.WebMercator;

            map1.Layers.Add(featureSet1);
         }

 
 

What do you say in this situation? Thank you in advance for your reply. All you good, respectful, Alexander V. Kravchenko.

May 7, 2012 at 6:56 AM

Hi,

The code given was an example - the correct projection for WGS84 is KnownCoordinateSystems.Geographic.World.WGS1984.

 

George J.

May 7, 2012 at 7:44 AM

private void loadShpLayer(int nLayer)
        {
 
            FeatureSet featureSet1 = new FeatureSet();
            string sT = @"D:\GISSampleData\tul\" + textLayres[nLayer, nColNamLayer] + ".shp";
            map1.Projection = KnownCoordinateSystems.Geographic.World.WGS1984;

            featureSet1 = (FeatureSet)DotSpatial.Data.FeatureSet.Open(sT);

            featureSet1.Projection = KnownCoordinateSystems.Geographic.World.WGS1984;
       
            map1.Layers.Add(featureSet1);
        }

 

the changes did not happen.

May 7, 2012 at 9:34 PM
Edited May 7, 2012 at 9:35 PM

 

I think that DotSpatial is working correctly, when you add the shapefiles in Quantum they are reprojected for that reason they look different.. You must change the Map projection, for example:

 map1.Projection= KnownCoordinateSystems.Projected.World.WebMercator;  
and, then  you can add the shapefiles


May 10, 2012 at 9:07 AM

    private void loadShpLayer(int nLayer)
    {
        FeatureSet featureSet1 = new FeatureSet();

        string sT = @"D:\GISSampleData\tul\" + textLayres[nLayer, nColNamLayer] + ".shp";

        map1.Projection = KnownCoordinateSystems.Projected.World.WebMercator;

        featureSet1 = (FeatureSet)DotSpatial.Data.FeatureSet.Open(sT);

        featureSet1.Reproject(map1.Projection);

        map1.Layers.Add(featureSet1);
    }

 

This code helped.  

thank you all