5

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!

nmtoken
  • 13,355
  • 5
  • 38
  • 87
malloc
  • 51
  • 2
  • 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 http://gis.stackexchange.com/questions/21256/how-to-easily-shift-all-features-in-a-vector-dataset – Mike T Mar 30 '12 at 00: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 00: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 09:40
  • @MikeToews - Thanks, I missed that topic somehow. The shape files are distributed on the auto-steer units attached to each tractor rather than managed centrally, so a spatial database isn't really appropriate. – malloc Mar 30 '12 at 09:44
  • 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. – RyanKDalton Mar 30 '12 at 16:06
  • Admittedly I don't know how the relationship works between base station and data, but personally I'd be concerned whether an X/Y offset on the base station equates to a similar X/Y offset for all the vertices on a feature. It sounds simplistic in a way that spatial data doesn't often seem to be. That would be my concern. But as to projection (or coordinate system) I don't think that's as much a problem. Presumably the offset is in the same projection, so it isn't an issue. In fact you could probably just reuse the prj file from the original dataset for the new ones. – Mark Ireland May 29 '12 at 17:51

2 Answers2

1

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.

James Milner
  • 1,932
  • 18
  • 22
0

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

klewis
  • 7,475
  • 17
  • 19