activerecord-postgis 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 85a0e8ab2ce4078be403c88613a3f3cbd5e75b5eb10513c17a4bd907a32f3932
|
|
4
|
+
data.tar.gz: f742b5aea859d34e0ecb5886e14e29dc5e0741aba3203436d92bcf41f5fb4f8a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 72576fb86dcbecf612b6e887b797ca6da99f8a7d48f53c6f5428e55bd93650f6b51d9166a948fe3ad8cde910da4a1f69ad34751ee17d0b1a8c513d6434a386c8
|
|
7
|
+
data.tar.gz: ce5ce36d298aa6532284bf0c5b01f6f2ec5a395559a08bc4114c8dff9cf8f47b9a9079edab5edee896eaece08b506b67a813756f6e2d8ac800ee8d6846cc9f1f
|
|
@@ -15,13 +15,6 @@ module ActiveRecord
|
|
|
15
15
|
@has_z = has_z
|
|
16
16
|
@has_m = has_m
|
|
17
17
|
@geographic = geographic
|
|
18
|
-
@factory = RGeo::ActiveRecord::SpatialFactoryStore.instance.factory(
|
|
19
|
-
geo_type: @geo_type.underscore,
|
|
20
|
-
srid: srid,
|
|
21
|
-
has_z: has_z,
|
|
22
|
-
has_m: has_m,
|
|
23
|
-
sql_type: (@geographic ? "geography" : "geometry")
|
|
24
|
-
)
|
|
25
18
|
end
|
|
26
19
|
|
|
27
20
|
def type
|
|
@@ -40,6 +33,18 @@ module ActiveRecord
|
|
|
40
33
|
|
|
41
34
|
private
|
|
42
35
|
|
|
36
|
+
# Not memoized: types are frozen for Ractor sharing, and factories
|
|
37
|
+
# hold mutexes/procs. SpatialFactoryStore already caches them.
|
|
38
|
+
def factory
|
|
39
|
+
RGeo::ActiveRecord::SpatialFactoryStore.instance.factory(
|
|
40
|
+
geo_type: @geo_type.underscore,
|
|
41
|
+
srid: @srid,
|
|
42
|
+
has_z: @has_z,
|
|
43
|
+
has_m: @has_m,
|
|
44
|
+
sql_type: (@geographic ? "geography" : "geometry")
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
|
|
43
48
|
def cast_value(value)
|
|
44
49
|
case value
|
|
45
50
|
when ::RGeo::Feature::Instance
|
|
@@ -56,11 +61,11 @@ module ActiveRecord
|
|
|
56
61
|
def parse_wkt(string)
|
|
57
62
|
if binary_string?(string)
|
|
58
63
|
# Parse WKB (Well-Known Binary) format
|
|
59
|
-
wkb_parser = RGeo::WKRep::WKBParser.new(
|
|
64
|
+
wkb_parser = RGeo::WKRep::WKBParser.new(factory, support_ewkb: true, default_srid: @srid)
|
|
60
65
|
wkb_parser.parse(string)
|
|
61
66
|
else
|
|
62
67
|
# Parse WKT (Well-Known Text) format
|
|
63
|
-
wkt_parser = RGeo::WKRep::WKTParser.new(
|
|
68
|
+
wkt_parser = RGeo::WKRep::WKTParser.new(factory, support_ewkt: true, default_srid: @srid)
|
|
64
69
|
wkt_parser.parse(string)
|
|
65
70
|
end
|
|
66
71
|
rescue RGeo::Error::ParseError
|
|
@@ -74,7 +79,7 @@ module ActiveRecord
|
|
|
74
79
|
def parse_hash(hash)
|
|
75
80
|
# Support GeoJSON-style hash
|
|
76
81
|
if hash["type"] && hash["coordinates"]
|
|
77
|
-
RGeo::GeoJSON.decode(hash.to_json, geo_factory:
|
|
82
|
+
RGeo::GeoJSON.decode(hash.to_json, geo_factory: factory)
|
|
78
83
|
else
|
|
79
84
|
nil
|
|
80
85
|
end
|