I have a friend with a bit of a problem. He has 1000+ shapefiles mapping paddocks and being used for precision agriculture. He's recently discovered the base station positions used to create these maps were incorrect.

The base stations are being updated, which means each shapefile needs an x and y offset applied to all features. The offsets vary but are typically small (~1-2 meters). The correction needs to be applied with sub-centimetre accuracy.

I've been brought on board to automate the process. I've written a C# application that can accurately calculate the offsets to apply to each file. What I'm looking for is something to apply these offsets for me. Either a C# library or an external command line application would be ideal. I could implement something myself but I don't want to re-invent the wheel.

Does anyone have a suggestion for achieving this?

I've read that I can use ogr2ogr and specify a different false easting/northing for the source SRS, although I'm not sure if this will provide the accuracy I require. I also don't know what projection the files are using.

Any help would be greatly appreciated!

  • How are the base stations being updated? Some algorithm or statistics being applied to the coordinates? Somebody going out with a GPS and collecting new coordinates? Or are the updates literally up 0.5 meters, left 0.38 meters? – Baltok Mar 29 '12 at 17:48
  • Take a look at gis.stackexchange.com/questions/21256/… – Mike T Mar 30 '12 at 0:51
  • While you are at it, convince your friend to stop managing 1000+ shapefiles, and start learning how to use a spatial database, such as PostGIS. – Mike T Mar 30 '12 at 0:56
  • @RyanDalton - Yep, someone has surveyed each base station with a GPS to collect the new coordinates. I'm converting the difference in positions to an x any y offset in meters to apply at the paddock. – malloc Mar 30 '12 at 9:40
  • 1
    malloc- I might have to agree with @MikeToews about storing all that data in a centralized spatial database. It seems like having all of the data located in one central source could be advantages not only for recordkeeping, but any kind of analysis of overall effectiveness. There is no reason you couldn't associate each "route" (a current shapefile) with a tractor ID, then export the shapefiles to the tractors as needed. It's likely a much more elegant (better?) long-term solution that can acheive the same short-term results. – RyanDalton Mar 30 '12 at 16:06

You can probably apply the offsets using OGR (GDLA) for C# (http://trac.osgeo.org/gdal/wiki/GdalOgrInCsharp)

You'd have to write a C# script that loads the shapefile, gets the x and y coordinates (ORGPoint class has this), offsets it using your algorithm and then set x and y coordinates (OGRPoint.setX and OGRPoint.setY i believe). Im not sure if you'd have to the output to a new shapefile or if you can just edit it and it will save the changes, try testing it on a single shapefile first.


This recent post "how-to-easily-shift-all-features-in-a-vector-dataset" is very similiar to your question. You might find it useful.

shift all features

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.