magellan
magellan copied to clipboard
Support Parsing of MultiPolygon in WKT Format
Executing WKTParser.parseAll("MULTIPOLYGON (((-72.40704336 41.9571927, -72.4070466 41.95713969, -72.4071366 41.95329372, -72.40790556 41.95300077, -72.40704336 41.9571927)))")
results in java.lang.RuntimeException: Extra(...704336 41.9571927))), [traced - not evaluated])
Is this a limitation of the parser of project-wide?
Thanks.
WKT parser does not support multipolygons yet Neither does Shapefile format. Only GeoJSON does right now It's not prioritized, happy to accept contributions :)
I have no problem working on it but just need to know if it's just a parser issue or if support for MultiPolygons is problematic in other areas of the project. I would not want to implement in the WKTParser only to find that more work is needed in other, more "complicated" areas of the project that may take more time to address.
Thanks.
Multipolygons are in general not fully supported in parsing. But once parsed they will be treated as one polygon per row essential flatmapping them. The rest of the processing then is identical
Excellent. Thanks!
@mdbuck if you are implementing this, it might be good to follow the same approach as GeoJSON where one line of multi polygon results in multiple rows, one per polygon. This might require slightly generalizing the WKT expression. I can help with this, let me know if you'd want a skeleton PR that you can extend
Since I do not know what "generalizing the WKT expression" means any help is appreciated :)
@mdbuck fair enough :), will create a PR with some tests and missing pieces for you to add in for this functionality... I should have time to put something together this weekend and will ping you on the PR so you can work off it Thanks for contributing!
@harsha2010 is there some progress regarding this issue?
I have created a pull request. It isn't exactly what was discussed above, but you may find it useful until a full solution working the same as GeoJson is implemented.
https://github.com/harsha2010/magellan/pull/195