zellige / hs-geojson

GeoJSON parsing library [Haskell]
BSD 3-Clause "New" or "Revised" License
23 stars 13 forks source link

MultiPolygon formed not correctly? #9

Closed achirkin closed 9 years ago

achirkin commented 9 years ago

MultyPolygon coordinates are represented by array of Polygon objects; however, according to the standard, they should be represented as array of arrays of polygon coordinates.

For example, yours:

{   "type": "MultiPolygon",
    "coordinates":  [
        { "type": "Polygon",
          "coordinates":  [[[0.0,0.0,0.0],[1,0.0,0.0],[3,0.0,2],[2,0.0,1],[-4,0.0,-1],[0.0,0.0,0.0]]]
         }
    ]
}

Should be:

{   "type": "MultiPolygon",
    "coordinates":  [
         [[[0.0,0.0,0.0],[1,0.0,0.0],[3,0.0,2],[2,0.0,1],[-4,0.0,-1],[0.0,0.0,0.0]]]
    ]
}

http://geojson.org/geojson-spec.html#polygon http://geojson.org/geojson-spec.html#id7

Am I correct? My mate has another generator of geojson, and it produces the second variant, that is why I try to understand, which variant should we use.

I do not mind fixing it on my own and pulling, if it is ok

domdere commented 9 years ago

Ugh I think you are correct, I might be doing the same thing with the multi line and multi point objects, (I'm not at a computer atm).

I'd be happy if you pulled and fixed them up however I think you will find most of the time will be spent fixing up doctests, it will be a lot if iterations of running tests and cutting and pasting the output back into the code... Sorry to out you through the bother.

Sorry I was going through a doctests phase at the time I wrote this, I've since moved back to raw quickcheck code cos I find it too tempting to flood my test suites with unit tests rather than property tests. Makes them a pain to maintain.

I should probably go through remove them and replace then with props

Sorry again, I'll try to make the library easier to work with

domdere commented 9 years ago

Fixed in #7

achirkin commented 9 years ago

Thanks, great! I am continuing testing it in my app :)