This project has moved and is read-only. For the latest updates, please go here.

Is it possible to associate a coordinate system to a shapefile?

Topics: Algorithms
May 7, 2007 at 9:32 AM
Hi there, I've a shapefile without a related coordinate system. Is it possible to associate a coordinate system to a shapefile?Thanks
May 8, 2007 at 3:38 AM
All shapefiles already have a coordinate system. It wouldn't be a shapefile without it.
May 8, 2007 at 9:12 AM
Sorry, but my shapefile hasn't a related coordinate system. Anyway I've done in this way:

ShapeFile shp = new ShapeFile(...);
shp.CoordinateSystem = CreateCoordSys();

where CreateCoordSys() is a method that create a system coordinate.

However thanks a lot for your message.
May 8, 2007 at 9:45 AM
You need to create a .prj file with the name of the shapefile, as example myshape.shp with myshape.shx, myshape.dbf and myshape.prj.
myshape.prj is a simple text files that contains the WKT of the CRS that defines the shp data.
Jul 14, 2007 at 9:25 PM
D_Guidi, you mention that i have to create a prj-file as it is not naturally part of the file collection.

Would you mind giving me a hint as to where to start? I have a shapefile using a swedish projection called RT90, but I don't know how to find its related WKT-file.

Help is greatly appreciated!
Jul 17, 2007 at 6:52 AM
Edited Jul 17, 2007 at 6:53 AM
Try and create a .prj file with the following text in it:
PROJCS["RT90",GEOGCS["G_Bessel_1841",DATUM["D_Bessel_1841",SPHEROID["Bessel_1841", 6377397.155,299.1528153513233],TOWGS84[419.383579 ,99.333477,591.345126,-0.850389,-1.817277,7.862238,-0.994959]],PRIMEM["Greenwich",0],UNIT["degree",0.01745329251994328]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",10],PARAMETER["scale_factor",0.9999],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1]]

The above text is not tested and there might be some typos in there. It's based on values I found on the net, so you might want to confirm these values with Lantmäteriverket. They might even have the full correct text for you. See also: and
Especially the TOWGS84, falseeasting and centralmeridian values are probably not correct.