Skip to content

Conversation

Nazz78
Copy link

@Nazz78 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)
Copy link
Collaborator

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!'
Copy link
Collaborator

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
Copy link
Collaborator

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])}
Copy link
Collaborator

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])}
Copy link
Collaborator

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 = {})
Copy link
Collaborator

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.
Copy link
Collaborator

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
Copy link
Collaborator

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.
Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/Tab: Tab detected.

@nofxx
Copy link
Owner

nofxx commented Aug 19, 2018

Hello @Nazz78 , sorry couldnt be of much help lately, added you as collaborator.
Swear I'll help soon ;)

@Nazz78
Copy link
Author

Nazz78 commented Aug 19, 2018

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....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants