Skip to content

How to get coordinate system of shapefile? #33

Description

@kjeremy

I am reading in a shape file using to test my code:

           var reader = new ShapeDataReader(path);
            var bounds = reader.ShapefileBounds;
            foreach (var thing in reader.ReadByMBRFilter(bounds))
            {
                var attrs = thing.Attributes;
                var geo = thing.Geometry;
                if (geo != null)
                {
                    var coords = geo.Coordinates;
                }
            }

path is the path to the .shp file. Is this correct? Or should I be using ShapefileDataReader? I've seen examples online of both.

One thing is that I can't figure out how to get the coordinate system via code. I need to project it to WGS84. The srid on the geometry is 0 so I'm not sure how to get the information I need. Do I need to do something special to read the .prj file to get the information I need?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions