1

I am using MapWinGIS with c#. I am trying to create a buffer for a polygon that has WGS84 decimal degree reference system, but it never get displayed.
Here is my code:

// Form load
var gp = new GeoProjection();
gp.SetWgs84Projection(tkWgs84Projection.Wgs84_UTM_zone_40N);
axMap1.GeoProjection = gp; //set map projection to projected mercator
...
if (sfAOI.Open(fileName, null) ) //open shapefile wgs84 lat long RS
{
    axMap1.RemoveLayer(aoiHandler);
    aoiHandler = axMap1.AddLayer(sfAOI, true); //Lat Long

    //till here, all data loaded are in lat long coordinate system

    //create aoi buffer 
    sfAOIBuffer = new Shapefile();
    sfAOIBuffer = sfAOI.BufferByDistance(500, 20, true, false);
    aoiBufferHandler = axMap1.AddLayer(sfAOIBuffer, true);
    axMap1.MoveLayerTop(aoiBufferHandler);  //does not appear.
}

Which suppose to create a buffer after successfully loading area of interest. Having all data are in WGS84, I need to be able to create buffer on the fly in meters regardless to data reference system.

I am not sure if projection will really solve the problem because that deals only with data display. What am I missing?

4
  • 1
    because your buffer is in map units (degrees) and 500 degrees is the whole world? – Ian Turton Mar 15 '20 at 12:01
  • Ok. So how can I convert on the fly from degree to meter? – Hilal Al-Rajhi Mar 16 '20 at 3:56
  • I tried DegreesToProj() but could not manage filling parameters. I need to supply full are of interest not coordinates – Hilal Al-Rajhi Mar 16 '20 at 4:05
  • The only way I could pass this issue temporary is to use arcmap to change Reference system of the shapefile. But this does not answer the question. User sometimes may select shapefile that is in geographic reference system where problem resides – Hilal Al-Rajhi Mar 22 '20 at 5:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.