I need to take an uploaded polygon shapefile and extract some information from it, including the lat/long positions of the centroids of the features.

Using DotSpatial I attempt to Reproject the shapefile into WGS 1984 to get latitude and longitude

if (!shapefile.Projection.IsLatLon)

but the coordinates I get out land in South Dakota when they should be in Colorado.

Some centroids prior to reprojection:

{(3118274.90587493, 1458696.3665899)}
{(3118274.90587493, 1458696.3665899)}

The coordinates in South Dakota that I get after running the code above:

{(-104.040689162766, 43.4531513926421)}
{(-104.040690516737, 43.4529967532427)}

Am I missing a step?

EDIT: Contents of .prj file PROJCS["NAD_1983_HARN_StatePlane_Colorado_North_FIPS_0501_Feet",GEOGCS["GCS_North_American_1983_HARN",DATUM["D_North_American_1983_HARN",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",3000000.000316083],PARAMETER["False_Northing",999999.999996],PARAMETER["Central_Meridian",-105.5],PARAMETER["Standard_Parallel_1",39.71666666666667],PARAMETER["Standard_Parallel_2",40.78333333333333],PARAMETER["Latitude_Of_Origin",39.33333333333334],UNIT["Foot_US",0.3048006096012192]],VERTCS["NAD_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PARAMETER["Vertical_Shift",0.0],PARAMETER["Direction",1.0],UNIT["Meter",1.0]]

  • What is the crs of your source data? Did you specify it somewhere in your code? Is there a correctly defined .prj file with the shapefile? – FSimardGIS Dec 19 '18 at 17:42
  • @FSimardGIS I am not specifying the source CRS in my code but the shapefile includes a .prj, the contents of which I have put in the question. – Nick Dec 19 '18 at 17:55

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.