Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/blacklight/maps/geometry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ def find_center
center
end

# Returns 2d array of latitude and longitude values for bounding box
def to_latlng
return [[@south, @west], [@north, @east]]
end

# Creates a new bounding box from from a string of points
# "-100 -50 100 50" (south west north east)
def self.from_lon_lat_string(points)
Expand Down
4 changes: 4 additions & 0 deletions spec/lib/blacklight/maps/geometry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@
it "should return correct dateline bounding box" do
expect(bbox_dateline.find_center).to eq([-183.5, 5])
end

it "should return 2d array of latitude longitude" do
expect(bbox_dateline.to_latlng).to eq([[30, 165], [-20, -172]])
end
end