From: Harry Wood Date: Fri, 15 May 2009 16:24:55 +0000 (+0000) Subject: label changesets as (big) based on their bbox area X-Git-Tag: live~7413 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/3415aa468908abbc4c3c4787acb4ef05a0f73d53 label changesets as (big) based on their bbox area --- diff --git a/app/models/changeset.rb b/app/models/changeset.rb index a1162b323..5c961a064 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.rb @@ -89,6 +89,16 @@ class Changeset < ActiveRecord::Base def has_valid_bbox? not bbox.include? nil end + + ## + # returns area of the changset bbox as a rough comparitive quantity for use of changset displays + def area + if has_valid_bbox? + (max_lon - min_lon) * (max_lat - min_lat) + else + 0 + end + end ## # expand the bounding box to include the given bounding box. also, diff --git a/app/views/changeset/_changeset.rhtml b/app/views/changeset/_changeset.rhtml index c5b3c7a88..2a5356450 100644 --- a/app/views/changeset/_changeset.rhtml +++ b/app/views/changeset/_changeset.rhtml @@ -38,8 +38,14 @@ maxlon = changeset.max_lon/GeoRecord::SCALE.to_f maxlat = changeset.max_lat/GeoRecord::SCALE.to_f %> - (<%= format("%0.3f",minlon) -%>,<%= format("%0.3f",minlat) -%>,<%= format("%0.3f",maxlon) -%>,<%= format("%0.3f",maxlat) -%>) - <% end %> + <%= format("%0.3f",minlon) -%>,<%= format("%0.3f",minlat) -%>,<%= format("%0.3f",maxlon) -%>,<%= format("%0.3f",maxlat) -%> + + <% if changeset.area > 1500000000000 %> + (big) + <% + end + end + %> diff --git a/config/database.yml b/config/database.yml index c6fe06fdd..cc3f9a1a5 100644 --- a/config/database.yml +++ b/config/database.yml @@ -11,10 +11,10 @@ # And be sure to use new-style password hashing: # http://dev.mysql.com/doc/refman/5.0/en/old-client.html development: - adapter: postgresql + adapter: mysql database: openstreetmap -# username: openstreetmap -# password: openstreetmap + username: openstreetmap + password: openstreetmap host: localhost encoding: utf8 @@ -22,17 +22,17 @@ development: # re-generated from your development database when you run 'rake'. # Do not set this db to the same as development or production. test: - adapter: postgresql + adapter: mysql database: osm_test -# username: osm_test -# password: osm_test + username: osm_test + password: osm_test host: localhost encoding: utf8 production: - adapter: postgresql + adapter: mysql database: osm -# username: osm -# password: osm + username: osm + password: osm host: localhost encoding: utf8