SORMAS-Foundation / SORMAS-Project

SORMAS (Surveillance, Outbreak Response Management and Analysis System) is an early warning and management system to fight the spread of infectious diseases.
https://sormas.org
GNU General Public License v3.0
292 stars 142 forks source link

Exception when a union of two polygons return a multipolygon #2286

Open aalih opened 4 years ago

aalih commented 4 years ago

Bug Description

To simplify the geo shapes, SORMAS union polygons that have a common border, but the union of two polygons can return a Multipolygon and SORMAS expect a Polygon. This throws a ClassCastExecption stopping the server.

Expected Behavior

If the union of two polygons returns a multipolygon the server should capture the exception and continue working

multipolygon-error-diff.txt

MateStrysewske commented 4 years ago

@aalih Can you tell me how exactly this can be reproduced?

aalih commented 4 years ago

Hi @MateStrysewskeSym, I had the problem while incorporating the Cuba shapefiles, I can send them to you to reproduce the error, just tell me how.

BTW, i think it will be better if the shapefiles can be provided without recompiling the code, using the sormas.properties file to point to the shapefiles directory and document the expected layout and file names. I can open a new issue with this suggestion if you want.

MateStrysewske commented 4 years ago

@aalih Yes, that would be great! However, instead of specifying them in the sormas.properties file, I'd probably prefer to have a shape file import directly in the system because that would be a lot more user-friendly. We actually have this on our radar, but haven't had the opportunity to implement it yet.

aalih commented 4 years ago

Hi @MateStrysewskeSym you can find the cuba shapefiles here: https://github.com/aalih/SORMAS-Project/tree/infomed_fixes/sormas-backend/src/main/resources/shapefiles/cuba

Your solution to add the shapefiles to the system is definitely better than mine ;)