I'm hoping you can help me. I have the a fairly complex object that represents geoJson data. The class was generated by placing some of the geojson into the converter found here.
The code that is generated works fine when I'm de-serialising for conversion and storing into a database, however when I come to retrieve the data and re-serialise it I am getting some very strange behaviour.
Here is a brief snippet of my json:
{"type":"FeatureCollection",
"crs": {"type":"name",
"properties":{ "name":"urn:ogc:def:crs:OGC:1.3:CRS84"}},
"features":[
{"type":"Feature",
"properties":{"name":"AB","color":"#0E0299"},
"geometry":{"type":"MultiPolygon",
"coordinates":[[[[56.8860559718878,-2.21295884939764],
[-2.22418043724705,56.8874548172591],
[56.8873756021234,-2.22608015201419],
[-2.24113736145235,56.8942204769533],
[56.8953863168858,-2.24940218298088],
[-2.25140561654796,56.8950015957031],
[56.8950244655219,-2.25393237467251],
[-2.26499735012973,56.8885090148966],
[56.8827985864266,-2.28369393347917]]]]}}]}
Rather than putting this in twice I will explain what is wrong. Every other entry in the coordinates list is reversed. So the second pair of values is back to front.
However when I look at the data in the original class before serialisation they are in the correct order (i.e. 56.8874... comes first then, -2.2241....)
If you put that json into the class generator I linked it basically creates the classes I'm using.
It is the following property that is resulting in the issues:
public List<List<List<List<double>>>> coordinates { get; set; }
Firstly, I think it is hideous, but that aside it makes it hard to see what exactly is going on.
My question is:
How can I maintain the order of my coordinates within my list as these coordinates represent steps along a path. By reversing every other coordinate when I plot them on my world map it jumps between two sides of the world, which is completely wrong.
If you need more information or my question isn't clear please let me know.