ncssar / sartopo_python

Python calls for the caltopo / sartopo API
GNU General Public License v3.0
14 stars 2 forks source link

addAssignment should be LineString-vs-Polygon-agnostic #15

Open caver456 opened 3 years ago

caver456 commented 3 years ago

right now, the downstream tool needs to remember the assignment style, so it can call either addAreaAssignment or addLineAssignment as needed. When editing an assignment it would be great to just leave the style as-is.

caver456 commented 3 years ago

Should probably just make a root function addAssignment where line-vs-polygon is an argument; hopefully the argument can be ignored when making a call to edit the assignment / if existingId is specified; will have to see if the sartopo API allows this.

tkdiff shows that the only differences are:

line assignment: geometry->type = LineString geometry->coordinates = points (a list of coord pairs)

area assignment: geometry->type = Polygon geometry->coordinates = [points] (a list of coord pairs, wrapped as a one-element list)

caver456 commented 3 years ago

see comment in #116 - the full json must be specified when editing. That doesn't really affect the need to write the wrappers for addAssignment.