-
Notifications
You must be signed in to change notification settings - Fork 56
Fixed reading of SHP with degenerated polygons, NullShape class added. #48
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
base: master
Are you sure you want to change the base?
Conversation
Nazz78
commented
Aug 6, 2018
- Added null object (ESRI's 0 according to specs - page 4) when polygons have no outer face definition (clockwise).
puts 'Failed to find polygon for inner ring!' | ||
end | ||
end | ||
geometry = GeoRuby::SimpleFeatures::MultiPolygon.from_polygons(outer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [81/80]
# TODO - what to do here? technically the geometry is | ||
# not well formed (or our above assumption does not | ||
# hold). | ||
puts 'Failed to find polygon for inner ring!' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
if outer_poly | ||
outer_poly << inner_ring | ||
else | ||
# TODO - what to do here? technically the geometry is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/CommentAnnotation: Annotation keywords like TODO should be all upper case, followed by a colon, and a space, then a note describing the problem.
# We make the assumption that all vertices of holes are | ||
# entirely contained. | ||
inner.each do |inner_ring| | ||
outer_poly = outer.find {|outer_poly| outer_poly[0].contains_point?(inner_ring[0])} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/CollectionMethods: Prefer detect over find.
Layout/SpaceInsideBlockBraces: Space between { and | missing.
Lint/ShadowingOuterLocalVariable: Shadowing outer local variable - outer_poly.
Metrics/LineLength: Line is too long. [97/80]
Layout/SpaceInsideBlockBraces: Space missing inside }.
else | ||
# Make polygons from the outer rings so we can concatenate | ||
# them with inner rings. | ||
outer.map! {|ring| GeoRuby::SimpleFeatures::Polygon.from_linear_rings([ring])} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/SpaceInsideBlockBraces: Space between { and | missing.
Metrics/LineLength: Line is too long. [90/80]
Layout/SpaceInsideBlockBraces: Space missing inside }.
# polygons. | ||
class NullShape < Geometry | ||
# Return empty coordinates and type when called as_json. | ||
def as_json(_options = {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/Tab: Tab detected.
Layout/IndentationWidth: Use 2 (not 1) spaces for indentation.
# Represents Null Shape. This might come handy when dealing with degenerated | ||
# polygons. | ||
class NullShape < Geometry | ||
# Return empty coordinates and type when called as_json. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/Tab: Tab detected.
module SimpleFeatures | ||
# Represents Null Shape. This might come handy when dealing with degenerated | ||
# polygons. | ||
class NullShape < Geometry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/Tab: Tab detected.
Layout/IndentationWidth: Use 2 (not 1) spaces for indentation.
module GeoRuby | ||
module SimpleFeatures | ||
# Represents Null Shape. This might come handy when dealing with degenerated | ||
# polygons. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/Tab: Tab detected.
|
||
module GeoRuby | ||
module SimpleFeatures | ||
# Represents Null Shape. This might come handy when dealing with degenerated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/Tab: Tab detected.
Hello @Nazz78 , sorry couldnt be of much help lately, added you as collaborator. |
Hi @nofxx, no problem - thank you for sharing georuby with us. It's a great lib, I've tweaked some parts so that it works with GIS data I have... I'm no geo or programming expert, so please take what you think works and reject else.... |