Sha256: 70428f0909f81f6f06692a1e11c0a4ecfcca5096a43c84297f9e7dfc457151c9
Contents?: true
Size: 425 Bytes
Versions: 3
Compression:
Stored size: 425 Bytes
Contents
module CartoJson class Polygon < LineString type :polygon def to_wkt "#{type.to_s.upcase} ((#{@points.dup.push(@points.first).collect {|p| "#{p.send(LNG)} #{p.send(LAT)}"}.join(', ')}))" end protected def validate if @points.length < 3 raise InsufficientPointsError, "a minimum of 3 points is required to make a polygon, you provided #{@points.length}" end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
carto_json-0.0.9 | lib/carto_json/polygon.rb |
carto_json-0.0.8 | lib/carto_json/polygon.rb |
carto_json-0.0.7 | lib/carto_json/polygon.rb |