the_geom_geojson 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +6 -0
- data/lib/the_geom_geojson/examples.rb +4 -4
- data/lib/the_geom_geojson/version.rb +1 -1
- data/spec/the_geom_geojson/active_record_spec.rb +13 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 340ff888874bd866f745932b2866111f8accd642
|
4
|
+
data.tar.gz: 3fe225b6c9398d9a15aa5e1a641b07c03ff046b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82eaa293691910f7bceaa17edcad2cf1b26bc22d429c82648bbeafb76f370093cf105ac75c75a5f8f0dba26012e26cffa8e8d6d3a37fb6c6dbe1546cf76075a6
|
7
|
+
data.tar.gz: 910e318ce9138eb46a4207450ab7fa124d123c6a59892eb417d32090e2e53c794573a7fbb89a765dc032ed1d7f8f8264bf209345fb1f5e13a92c86c7391ce903
|
data/CHANGELOG
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
module TheGeomGeoJSON
|
2
2
|
EXAMPLES = {
|
3
|
-
burlington: '{"type":"Polygon","coordinates":[[[-73.223,44.491],[-73.
|
3
|
+
burlington: '{"type":"Polygon","coordinates":[[[-73.223,44.491],[-73.171,44.49],[-73.146,44.447],[-73.211,44.439],[-73.229,44.462],[-73.223,44.491]]]}',
|
4
4
|
burlington_point: '{"type":"Point","coordinates":[-73.193,44.477]}',
|
5
|
-
burlington_downtown: '{"type":"Polygon","coordinates":[[[-73.218,44.487],[-73.
|
5
|
+
burlington_downtown: '{"type":"Polygon","coordinates":[[[-73.218,44.487],[-73.203,44.482],[-73.203,44.475],[-73.211,44.466],[-73.22,44.473],[-73.218,44.487]]]}',
|
6
6
|
burlington_downtown_point: '{"type":"Point","coordinates":[-73.21,44.476]}',
|
7
|
-
south_burlington: '{"type":"Polygon","coordinates":[[[-73.175,44.474],[-73.
|
7
|
+
south_burlington: '{"type":"Polygon","coordinates":[[[-73.175,44.474],[-73.169,44.473],[-73.158,44.466],[-73.162,44.456],[-73.182,44.46],[-73.175,44.474]]]}',
|
8
8
|
south_burlington_point: '{"type":"Point","coordinates":[-73.17,44.467]}',
|
9
9
|
montpelier: '{"type":"Polygon","coordinates":[[[-72.228,44.426],[-72.367,44.204],[-72.442,44.128],[-72.588,44.16],[-72.683,44.013],[-72.916,44.071],[-72.91,44.281],[-72.804,44.451],[-72.653,44.398],[-72.596,44.479],[-72.49,44.425],[-72.433,44.506],[-72.228,44.426]]]}',
|
10
10
|
montpelier_point: '{"type":"Point","coordinates":[-72.486,44.185]}',
|
11
11
|
vermont: '{"type":"Polygon","coordinates":[[[-71.494,45.02],[-71.551,44.58],[-72.03,44.306],[-72.047,44.093],[-72.397,43.542],[-72.466,42.729],[-73.253,42.751],[-73.241,43.542],[-73.423,44.079],[-73.291,44.449],[-73.353,45.009],[-71.494,45.02]]]}',
|
12
|
-
montreal_canada: '{"type":"Polygon","coordinates":[[[-74.064,45.694],[-
|
12
|
+
montreal_canada: '{"type":"Polygon","coordinates":[[[-74.064,45.694],[-73.641,45.775],[-73.256,45.614],[-73.234,45.325],[-73.674,45.228],[-74.069,45.34],[-74.064,45.694]]]}',
|
13
13
|
northampton_ma_point: '{"type":"Point","coordinates":[-72.638,42.318]}',
|
14
14
|
}
|
15
15
|
end
|
@@ -61,17 +61,17 @@ end
|
|
61
61
|
|
62
62
|
describe TheGeomGeoJSON do
|
63
63
|
describe 'ActiveRecord' do
|
64
|
-
# #
|
64
|
+
# # SELECT ST_SetSRID(ST_GeomFromGeoJSON('{"type":"Point","coordinates":[-73.193,44.477]}'), 4326);
|
65
65
|
# st_setsrid
|
66
66
|
# ----------------------------------------------------
|
67
|
-
#
|
67
|
+
# 0101000020E61000003108AC1C5A4C52C0931804560E3D4640
|
68
68
|
# (1 row)
|
69
69
|
let(:the_geom_expected) { '0101000020E61000003108AC1C5A4C52C0931804560E3D4640' }
|
70
70
|
|
71
|
-
# #
|
71
|
+
# # SELECT ST_Transform(ST_SetSRID(ST_GeomFromGeoJSON('{"type":"Point","coordinates":[-73.193,44.477]}'), 4326), 3857);
|
72
72
|
# st_transform
|
73
73
|
# ----------------------------------------------------
|
74
|
-
#
|
74
|
+
# 0101000020110F0000C22156DFD7145FC10858288EB9215541
|
75
75
|
# (1 row)
|
76
76
|
let(:the_geom_webmercator_expected) { '0101000020110F0000C22156DFD7145FC10858288EB9215541' }
|
77
77
|
|
@@ -181,6 +181,15 @@ describe TheGeomGeoJSON do
|
|
181
181
|
end
|
182
182
|
it_behaves_like 'different states of persistence'
|
183
183
|
end
|
184
|
+
end
|
184
185
|
|
186
|
+
describe '::EXAMPLES' do
|
187
|
+
TheGeomGeoJSON::EXAMPLES.each do |name, geojson|
|
188
|
+
it "[:#{name}] respects the right-hand-rule" do
|
189
|
+
pet = Pet.create the_geom_geojson: geojson
|
190
|
+
rhr_geom = Pet.connection.execute("SELECT ST_ForceRHR(the_geom) FROM pets WHERE id = '#{pet.id}'").getvalue(0,0)
|
191
|
+
expect(pet.the_geom).to eq(rhr_geom)
|
192
|
+
end
|
193
|
+
end
|
185
194
|
end
|
186
195
|
end
|