Last issue of the week after a great course in Montpelier with 12 people working on Biodiversity and landscape conservation :-)
We face a bug using geoshape.
When people are saving the geoshape after 2 points (they see a line on the widget), the object created is not a line (that's normal with geoshape) but the created polygon is a invalid polygon, with 3 nodes (node 1 and node 3 are the same one) and no interior.
Actually we use a workaround in PostGIS : if the line contains 3 node and if it is closed, we create a line instead of a polygon.
I reported another issue about storing geo data into WKT format and about the size of the column created by aggregate.
Thanks for reporting this! If you have the technical capacity to address it, a pull request would be very much appreciated. Otherwise, there are some ongoing improvements to the geo widgets happening and this will eventually be addressed.
This is also somewhat related to #1028
I'm sorry but I don't have necessary skills to do that. I found this file https://github.com/opendatakit/collect/blob/v1.7.x/collect_app/src/main/java/org/odk/collect/android/widgets/GeoShapeWidget.java.
I understand what it does but that's all :-(
I'm optimist since I red it about the WKT generation :-) in the getAnswer() function.
I think it is an interesting issue. But I'm a bit confused about what is your expected behavior. As my understanding, you want to remove the unnecessary point which is overlapped (e.g, point1 or point3 )? and only save two points when drawing a line ? @mathieubossaert @lognaturel
Hi huangyz0918,
With the Geoshape widget you can only create polygons, so we need in fact at least three points.
In GIS databases (PostGIS in our case), valid geometries must not have duplicated nodes. So a valid polygon should be made with at least 3 different nodes. Geoshape widget should avoid to validate shape when only to points are drawn by the user.
I will take a look at this issue, thank you 馃槉 @mathieubossaert
@opendatakit-bot claim
Thanks to you !
valid geometries must not have duplicated nodes.
I found every geometry has duplicated nodes, whatever how many points it has.
This is my tests:
//Two points, note1 and note3 are duplicated
37.04014527453826 89.59821428571429 0.0 0.0;//note1
42.66397254960217 120.83705357142856 0.0 0.0;//note2
37.04014527453826 89.59821428571429 0.0 0.0;//note3
//Three points, note1 and note4 are duplicated
34.390074413373064 93.515625 0.0 0.0;//note1
39.29058236772298 110.08928571428571 0.0 0.0;//note2
30.188548455057692 107.27678571428571 0.0 0.0;//note3
34.390074413373064 93.515625 0.0 0.0;//note4
// The same with other cases:
38.90080485615609 90.60267857142856 0.0 0.0;
37.95657349860099 112.70089285714285 0.0 0.0;
34.803494210753584 116.96986607142856 0.0 0.0;
29.622585468269065 112.60044642857144 0.0 0.0;
38.90080485615609 90.60267857142856 0.0 0.0;
Now I have removed the duplicated nodes, @mathieubossaert do you think we should add a dialog to remind user when user selected only one or two points (which cannot make up a valid geometry)?
Please review in my PR #2162 @mathieubossaert , thanks.
Hello @huangyz0918, you have been unassigned from this issue because you have not updated this issue or any referenced pull requests for over 10 days.
You can reclaim this issue or claim any other issue by commenting @opendatakit-bot claim on that issue.
Thanks for your contributions, and hope to see you again soon!
@huangyz0918 @mathieubossaert You can see at https://opendatakit.github.io/xforms-spec/#data-types that in the form specification a shape is defined as having the same points at start and end. If that's not desired for downstream analysis tools, a trace should be collected rather than a shape.
It sounds like the issue then is that lines with 1 point and shapes with 2 points can be saved. A solution to that would be:
How does that sound?
It sounds good to me! @lognaturel
@opendatakit-bot claim
disable the buttons may confuse users since they don't know how to enable them. How about sending a toast and do not return? @lognaturel
it's a version waiting for your review #2162
You're right, @huangyz0918, and I like your counter proposal! @mathieubossaert, what do you think?
Good morning.
The only problem is that a polygon must have at list 3 different edges and a line at least 2 different vertices. @lognaturel solution sounds good to me.
Sorry for my silence during past weeks.