Quantcast
Channel: MapWinGIS ActiveX Map and GIS Component
Viewing all articles
Browse latest Browse all 2341

New Post: how to use GeoProjection or how can I change the projection of a shapefile

$
0
0
Hi all,
In my project, I open .shp files converted by Universal Translator from MapInfo Tab,
Everything is good,
But There is a problem that has troubled me for a long time:
In higher latitude places the gis map looks Flat...
I guess this is the geo projection Problem, so i tried the GeoProjection operations of Shapefile:

my code is here, It doesn't work, however i try~~
(I'm using MapWinGis.ocx 4.8.6,)
Shapefile sf = new Shapefile();
if (sf.Open("D:\demoshp.shp", null))
{
    GeoProjection proj = new GeoProjection();
    bool bset = proj.ImportFromESRI("PROJCS[\"WGS_1984_Web_Mercator_Auxiliary_Sphere\",GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137,298.257223562997]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.0174532925199433]], PROJECTION[\"Mercator_Auxiliary_Sphere\"],PARAMETER[\"False_Easting\",0],PARAMETER[\"False_Northing\",0],PARAMETER[\"Central_Meridian\",0],PARAMETER[\"Standard_Parallel_1\",0],PARAMETER[\"Scale_Factor\",1],PARAMETER[\"Latitude_Of_Origin\",0],PARAMETER[\"Auxiliary_Sphere_Type\",0.0],UNIT[\"Meter\",1]]");
    if(bset)
    {
      sf.GeoProjection = proj;
      int hnd = mapControl.AddLayer(sf, true);
    }
          
}
I also used ReprojectInPlace function, it doesn't work either...
// 
sf.StartEditingShapes(true, null);
int ct =0;
sf.ReprojectInPlace(proj, ref ct);//always return false
Any way out?
thanks a lot

Viewing all articles
Browse latest Browse all 2341

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>