Opened 13 years ago

#364 new enhancement

Allow ANUGA to read gis shapefiles to define the bounding polygon

Reported by: fountain Owned by: ole
Priority: normal Milestone: ANUGA enhancements
Component: Functionality and features Version:
Severity: normal Keywords:
Cc:

Description

From Gareth Davies:

At present in the code, the user inputs polygons by typing something like

Bounding_polygon = anuga.read_polygon(‘my_extent.csv’)

where ‘my_extent.csv’ is a file with xy coordinate pairs (and no header), like this:

x1, y1 x2, y2 x3, y3 x4, y4

What we would like is for the user to be able to type:

bounding_polygon = anuga.read_polygon_shapefile(‘myshapefile.shp’)

[where ‘myshapefile.shp’ is a polygon shapefile which ONLY contains a single polygon, which the user wants to use as a bounding polygon],

and for the above command to have the same effect as the previous command.

## Things to consider are:

1) Should we support shapefiles with multiple polygons in them? I suggest no, because it will make it more complex to code and there is more potential for user error. However, this could be done. Perhaps better to have a warning or error if there is more than 1 polygon in the shapefile.

2) Should we check the orientation of the polygon? At present, I believe that ANUGA can have errors if all polygons are not oriented in the same way (i.e. clockwise or counter-clockwise). We could potentially ensure that the polygon was oriented clockwise (using a simple test like this one: http://paulbourke.net/geometry/clockwise/index.html, and re-ordering if needed). I suggest that this should either not be done, or optionally be done, with a warning if the vertices are being re-ordered. The reason is that one could imagine a situation where a user entered some polygons as csv files in a counterclockwise fashion, and then entered another polygon using a shapefile which had been ordered counter-clockwise – and the user would not wish for this polygon to be automatically re-ordered without a warning.

3) Should we support shapefiles that are not polygons (e.g. lines or points)? I think we should do this with a warning, however, we must assume that the ordering of the points is the same as it would be for a polygon.

Change History (0)

Note: See TracTickets for help on using tickets.