Closed caver456 closed 2 years ago
'size' and 'incremental' are in the response from the POST request used to create the new line (sartopo_python.addLine rjr) - 'size' is equal to the number of points in the payload, and incremental is what it is - no need to change it until/unless it is understood.
So - what happens if an incorrect / stale size value is passed to the edit request? Should it be updated in the request? Omitted? Or does it matter / is it OK to send the stale value, if the host revises it based on payload anyway? Take a look at the response from the edit request.
The response from the edit request still contains the stale size.
A separate getFeature afterwards (with forceImmediate=True) does not contain the size or incremental keys at all.
So this is kind of a dilemma. Not sure what if anything makes use of the size value.
Probably the best choice here is to just make sure that whenever size is sent, that it's accurate. So, inside editFeature, if geometry is specified, then size should also be recalculated and the new value should be used. If the host later decides to drop it, o well.
Fixed by adding these lines in editFeature:
if isinstance(geometry,dict) and 'coordinates' in geometry.keys():
geometry['size']=len(geometry['coordinates'])
# logging.info('geometry specified (size was recalculated if needed):\n'+json.dumps(geometry))
Noticed during debug of a failed crop which is due to bad return value from fourify:
'size' and 'incremental' keys are only referenced during addAppTrack, but a logging line in that command confirms that the function is never called (and this is a shape anyway, not an apptrack) - AB102f in the training map
'size' and 'incremental' do not exist in the original json. How the heck are they getting there?
The fourify question is a separate issue; bypassing fourify and just using the coordinates from the shapely result gives a clean correctly cropped line and looks like this in the log: