v.generalize: incorrect handling of wrap at 180 meridian
I am running GRASS 7.1.svn on Mac OS X.
GRASS 7.1.svn (global_lonlat):~ > g.version -g version=7.1.svn date=2014 revision=62762 build_date=2014-11-17 build_platform=x86_64-apple-darwin10.8.0
I am having a problem with the behavior of v.generalize when attempting to generalize a vector feature - lines or polygons it does not seem to matter - that crosses the 180 meridian, using a location that is EPSG:4326 with global extents.
The problem is probably best illustrated with a picture, which I have attached to this ticket, but can also be viewed here:
In the picture two line vector features are displayed. The black-lined feature is the original vector line feature (test1). The red-lined feature is produced from test1 using the following command:
v.generalize input=test1 output=test2 method=sliding_averaging look_ahead=5 slide=1 threshold=1
It appears that v.generalize, when smoothing between vertices that are very close to the 180 meridian, results in the incorrect identification of the “next" point, hence the long horizontal lines connecting points “the wrong way around” the earth. The behavior is the same when using any of the generalization or smoothing tools.
I have tested this with a simpler vector containing points farther away from the 180 meridian and it doesn’t appear to show the same behavior.
I would very much appreciate any help anyone could give me to solve this problem.
Thank you in advance!
If you would like to download the original lines file and try my procedure yourself, I have also attached a test vector file to this ticket. It can also be downloaded here:
Assuming you have OGR support for GMT in your version of GRASS, you can import the vector using this command:
v.in.ogr dsn=GRASS_wrap_problem_samplevector.gmt output=test1