Class: GeoRuby::SimpleFeatures::Geometry
- Inherits:
-
Object
- Object
- GeoRuby::SimpleFeatures::Geometry
- Defined in:
- lib/georuby-ext/georuby/geometry.rb
Class Method Summary collapse
Instance Method Summary collapse
- #inspect ⇒ Object
- #srid_instance ⇒ Object
- #to_geometry ⇒ Object
- #to_google ⇒ Object
- #to_wgs84 ⇒ Object
- #wgs84? ⇒ Boolean
Class Method Details
.srid!(geometries) ⇒ Object
25 26 27 28 29 |
# File 'lib/georuby-ext/georuby/geometry.rb', line 25 def self.srid!(geometries) geometries.first.srid.tap do |srid| raise "SRIDs are not uniq in #{geometries.inspect}" if geometries.any? { |geometry| geometry.srid != srid } end unless geometries.blank? end |
.to_kml(*geometries) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/georuby-ext/georuby/geometry.rb', line 38 def self.to_kml(*geometries) <<EOF <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Document> <Placemark> <MultiGeometry> #{geometries.map(&:kml_representation).join("\n")} </MultiGeometry> </Placemark> </Document> </kml> EOF end |
Instance Method Details
#inspect ⇒ Object
3 4 5 |
# File 'lib/georuby-ext/georuby/geometry.rb', line 3 def inspect "#<#{self.class}:#{object_id} \"#{to_ewkt}>\"" end |
#srid_instance ⇒ Object
31 32 33 |
# File 'lib/georuby-ext/georuby/geometry.rb', line 31 def srid_instance @srid_instance ||= GeoRuby::SimpleFeatures::Srid.new(srid) end |
#to_geometry ⇒ Object
21 22 23 |
# File 'lib/georuby-ext/georuby/geometry.rb', line 21 def to_geometry self end |
#to_google ⇒ Object
17 18 19 |
# File 'lib/georuby-ext/georuby/geometry.rb', line 17 def to_google project_to 900913 end |
#to_wgs84 ⇒ Object
13 14 15 |
# File 'lib/georuby-ext/georuby/geometry.rb', line 13 def to_wgs84 project_to 4326 end |
#wgs84? ⇒ Boolean
9 10 11 |
# File 'lib/georuby-ext/georuby/geometry.rb', line 9 def wgs84? srid == 4326 end |