I want to add an image to my win form app using DotSpatial. I use the code below (it works):

private void Form1_Load(object sender, EventArgs e)

But I see "Invalid or Missing Projection" window to choose a projection. How can I set projection in code and remove the window above?


See the DotSpatial Documentation or https://stackoverflow.com/questions/29122130/raster-data-loading-from-filepath-in-dotspatial to remove the "Invalid or Missing Projection" window.

I do this with a .tiff not .png. Add code below:

 IRaster r = Raster.Open(@"C:\image.tiff");
        DotSpatial.Projections.ProjectionInfo dest = default(DotSpatial.Projections.ProjectionInfo);
        dest = DotSpatial.Projections.ProjectionInfo.FromEpsgCode(4326); 
        r.Projection = dest;
        IMapRasterLayer myLayer = map1.Layers.Add(r);

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.