Class: Charta::Factory::SridProvider
- Inherits:
-
Object
- Object
- Charta::Factory::SridProvider
- Defined in:
- lib/charta/factory/srid_provider.rb
Constant Summary collapse
- SRS =
{ WGS84: 4326, CRS84: 4326, RGF93: 2143 }.freeze
Class Method Summary collapse
Instance Method Summary collapse
- #find(srname_or_srid) ⇒ Object
-
#initialize(srs) ⇒ SridProvider
constructor
A new instance of SridProvider.
Constructor Details
#initialize(srs) ⇒ SridProvider
Returns a new instance of SridProvider.
18 19 20 |
# File 'lib/charta/factory/srid_provider.rb', line 18 def initialize(srs) @srs = srs end |
Class Method Details
.build ⇒ Object
13 14 15 |
# File 'lib/charta/factory/srid_provider.rb', line 13 def build new(SRS) end |
Instance Method Details
#find(srname_or_srid) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/charta/factory/srid_provider.rb', line 22 def find(srname_or_srid) if srname_or_srid.to_s =~ /\Aurn:ogc:def:crs:.*\z/ x = srname_or_srid.split(':').last.upcase.to_sym @srs[x] || x elsif srname_or_srid.to_s =~ /\AEPSG::?(\d{4,5})\z/ srname_or_srid.split(':').last elsif srname_or_srid.to_s =~ /\A\d+\z/ srname_or_srid.to_i else @srs[srname_or_srid] || srname_or_srid end end |