Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrict PointsType to a well defined format #80

Open
cipriandinu opened this issue Oct 14, 2022 · 2 comments
Open

Restrict PointsType to a well defined format #80

cipriandinu opened this issue Oct 14, 2022 · 2 comments
Labels
Milestone

Comments

@cipriandinu
Copy link
Member

This topic is derived from #49. On previous issue we focus on changing documentation and announce PointsType restrictions, and on this topic we will have the discussion regarding restrictions implementation, for version 5.0

@mittagessen
Copy link
Contributor

The most common form of PointsType, as well as the one in all of the examples, seems to be of the x1 y1 x2 y2 ... x_n y_n. As such I'd suggest standardizing to this format and explicitly define it as a string containing an even number of floats with a regex like this (non-functional, just a sketch):

([0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\s+[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+

It might also be advantageous to split PointsType into two different types, one for simple points sequences such as BASELINE that require at least two points, and one for Polygon that requires at least three points.

@cipriandinu
Copy link
Member Author

I propose following - a bit more complex, but looks it works (should handle numbers as integer or floating point expressed as 2.4 or .5 or 1.832e-5 or 1.322E-5 or 3.4e+3 or 2.3E+3 or 2.4E5 or 8.9e2, comma separated inside a pair, or space separated inside a pair and at least two pairs - this is useful for basic baseline, not for poly shape). This would match with what we stated into version 4.4

(\d?\d*(.\d+([eE][-+]?\d+)?)?\s*[,\s]\s*\d?\d*(.\d+([eE][-+]?\d+)?)?\s+)+\d?\d*(.\d+([eE][-+]?\d+)?)?\s*[,\s]\s*\d?\d*(.\d+([eE][-+]?\d+)?)?

cipriandinu added a commit that referenced this issue Jan 15, 2024
Restrict PointsType according with 4.4. documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants