23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/gb_mapfish_appserver/core_extensions.rb', line 23
def to_geojson(options = {})
if any? && first.respond_to?('geojson_srid')
crs = first.geojson_srid
options.merge!({:skip_feature_crs => true})
end
geojson = '{"type": "FeatureCollection", "features": ['
geojson << collect {|e| e.to_geojson(options) }.join(',')
geojson << ']'
unless crs.blank?
geojson << ', "crs": '
geojson << {
:type => 'name',
:properties => {
:name => crs
}
}.to_json
end
geojson << '}'
geojson
end
|