|     Blog    |     Wiki    |     Support

Shapefile prj-file incorrect


we create a shapefile in MapSuite V10 from an FeatureLayer. To create the prj-file we use the following Code:

                var cul = System.Threading.Thread.CurrentThread.CurrentCulture;
                System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
                string c = Proj4Projection.ConvertProj4ToPrj(p4.InternalProjectionParametersString);
                string filename = Path.Combine(Path.GetDirectoryName(editShapefileFeatureLayer.ShapePathFilename), Path.GetFileNameWithoutExtension(editShapefileFeatureLayer.ShapePathFilename));
                filename = filename + ".prj";
                System.IO.File.WriteAllText(filename, c, System.Text.Encoding.UTF8);
                System.Threading.Thread.CurrentThread.CurrentCulture = cul;

The variable “p4” is from type Proj4Projection and will create by a given ProjectionParametersString. For the ProjectionParametersString we use the static method “GetEpsgParametersString”. If we use WGS84 (4326) ther are no Problems, but if we use CRS with EPSG-Code 25832 or 25833 (often used in Germany) the prj-file will no accepted from ArcMap.

Any suggetions? (6.3 KB)Regards Torsten

Hi Torsten,

It looks the ConvertProj4ToPrj API is based on 3rd part library, I tested the UnmanagedProj4Projection it also get the same result.

We cannot directly modfiy the value of the 3rd part library, so I think maybe you need to hard code the prj value for 25832 or 25833, you can query the value for prj file here:

Wish that’s helpful.