Fails to load data from geography column... Why?
Closed this issue · 3 comments
With 9 of 78 neighborhoods I am having issues retrieving the data from postgres. The column is updated, but then if you reload the record the column is fails to load. Default factories are in use.
Source data from: https://github.com/blackmad/neighborhoods/blob/master/denver.geojson
A was column with the following in a migration:
add_column :neighborhoods, :feature, :multi_polygon, geographic: true, srid: 4326
To confirm this:
# \d+ neighborhoods;
Table "public.neighborhoods"
Column | Type | Modifiers | Storage | Stats target | Description
----------------------------------+---------------------------------+------------------------------------------------------------+----------+--------------+-------------
feature | geography(MultiPolygon,4326) | | main | |
Here is an example:
neighborhood = Neighborhood.find_by(name: 'Berkeley')
=> #<Neighborhood id: 232, name: "Berkeley", feature: nil>
data = JSON.load(File.read(path_to_file))
=> [parsed json]
feature = data['features'].detect {|f| f['properties']['name'] == 'Berkeley'}
=> {"type"=>"Feature", "properties"=>{"name"=>"Berkeley", "cartodb_id"=>65, "created_at"=>"2013-02-10T03:12:09.376Z", "updated_at"=>"2013-02-10T03:12:09.662Z"}, "geometry"=>{"type"=>"MultiPolygon", "coordinates"=>[[[[-105.025192, 39.784385], [-105.025191, 39.78431], [-105.025191, 39.78431], [-105.025186, 39.783917], [-105.025193, 39.782989], [-105.025241, 39.782572], [-105.025242, 39.782145], [-105.025245, 39.780947], [-105.025188, 39.780263], [-105.02525, 39.779832], [-105.025257, 39.779044], [-105.025268, 39.777854], [-105.025223, 39.776644], [-105.025287, 39.775767], [-105.025286, 39.774713], [-105.025287, 39.773441], [-105.02523, 39.772937], [-105.025292, 39.772434], [-105.025294, 39.772045], [-105.025299, 39.771136], [-105.025299, 39.770841], [-105.025238, 39.770223], [-105.025238, 39.769759], [-105.025239, 39.769289], [-105.025954, 39.769311], [-105.02761, 39.76936], [-105.029969, 39.769403], [-105.031537, 39.769452], [-105.032301, 39.769472], [-105.033073, 39.769488], [-105.033644, 39.76951], [-105.034045, 39.769525], [-105.034643, 39.769548], [-105.035238, 39.76954], [-105.035805, 39.769533], [-105.036411, 39.769523], [-105.036987, 39.769513], [-105.037579, 39.769488], [-105.038156, 39.769463], [-105.038741, 39.769448], [-105.039338, 39.769433], [-105.039918, 39.769445], [-105.040499, 39.769457], [-105.041086, 39.769452], [-105.041675, 39.769447], [-105.042265, 39.769415], [-105.042309, 39.769413], [-105.042856, 39.769383], [-105.043433, 39.769373], [-105.044013, 39.769363], [-105.045149, 39.769382], [-105.045717, 39.769381], [-105.046286, 39.769381], [-105.047442, 39.769366], [-105.047973, 39.769364], [-105.048598, 39.769361], [-105.048809, 39.769366], [-105.049761, 39.769365], [-105.050336, 39.76936], [-105.050917, 39.769355], [-105.051495, 39.769345], [-105.052079, 39.769334], [-105.052656, 39.769334], [-105.053241, 39.769334], [-105.053243, 39.776568], [-105.053244, 39.783672], [-105.053234, 39.783675], [-105.052971, 39.783749], [-105.052614, 39.783885], [-105.052386, 39.783993], [-105.051743, 39.78432], [-105.050918, 39.784742], [-105.050709, 39.784817], [-105.050315, 39.784948], [-105.049842, 39.785046], [-105.049697, 39.78507], [-105.049418, 39.785115], [-105.048863, 39.785149], [-105.048538, 39.785138], [-105.048249, 39.785113], [-105.047986, 39.78507], [-105.04771, 39.785026], [-105.047404, 39.78493], [-105.047092, 39.784825], [-105.046816, 39.784724], [-105.046486, 39.784562], [-105.046097, 39.784388], [-105.045253, 39.783973], [-105.044745, 39.7838], [-105.044236, 39.78369], [-105.044034, 39.783656], [-105.043786, 39.783624], [-105.043541, 39.783599], [-105.043308, 39.783589], [-105.04101, 39.783582], [-105.038282, 39.783598], [-105.037215, 39.783593], [-105.036626, 39.783582], [-105.03627, 39.78358], [-105.035561, 39.783533], [-105.034549, 39.783448], [-105.033752, 39.783421], [-105.033378, 39.783406], [-105.033132, 39.7834], [-105.032847, 39.783429], [-105.032657, 39.783443], [-105.032442, 39.783466], [-105.03211, 39.783517], [-105.031703, 39.783585], [-105.030055, 39.783861], [-105.02809, 39.78413], [-105.027313, 39.784236], [-105.026595, 39.784299], [-105.026018, 39.784335], [-105.025655, 39.784366], [-105.025373, 39.78438], [-105.025336, 39.784381], [-105.025192, 39.784385]]]]}}
parsed = RGeo::GeoJSON.decode(feature['geometry'].to_json, json_parser: :json)
=> #<RGeo::Geos::CAPIMultiPolygonImpl:0x3fc6fd80033c "MULTIPOLYGON (((-105.025192 39.784385, -105.025191 39.78431, -105.025191 39.78431, -105.025186 39.783917, -105.025193 39.782989, -105.025241 39.782572, -105.025242 39.782145, -105.025245 39.780947, -105.025188 39.780263, -105.02525 39.779832, -105.025257 39.779044, -105.025268 39.777854, -105.025223 39.776644, -105.025287 39.775767, -105.025286 39.774713, -105.025287 39.773441, -105.02523 39.772937, -105.025292 39.772434, -105.025294 39.772045, -105.025299 39.771136, -105.025299 39.770841, -105.025238 39.770223, -105.025238 39.769759, -105.025239 39.769289, -105.025954 39.769311, -105.02761 39.76936, -105.029969 39.769403, -105.031537 39.769452, -105.032301 39.769472, -105.033073 39.769488, -105.033644 39.76951, -105.034045 39.769525, -105.034643 39.769548, -105.035238 39.76954, -105.035805 39.769533, -105.036411 39.769523, -105.036987 39.769513, -105.037579 39.769488, -105.038156 39.769463, -105.038741 39.769448, -105.039338 39.769433, -105.039918 39.769445, -105.040499 39.769457, -105.041086 39.769452, -105.041675 39.769447, -105.042265 39.769415, -105.042309 39.769413, -105.042856 39.769383, -105.043433 39.769373, -105.044013 39.769363, -105.045149 39.769382, -105.045717 39.769381, -105.046286 39.769381, -105.047442 39.769366, -105.047973 39.769364, -105.048598 39.769361, -105.048809 39.769366, -105.049761 39.769365, -105.050336 39.76936, -105.050917 39.769355, -105.051495 39.769345, -105.052079 39.769334, -105.052656 39.769334, -105.053241 39.769334, -105.053243 39.776568, -105.053244 39.783672, -105.053234 39.783675, -105.052971 39.783749, -105.052614 39.783885, -105.052386 39.783993, -105.051743 39.78432, -105.050918 39.784742, -105.050709 39.784817, -105.050315 39.784948, -105.049842 39.785046, -105.049697 39.78507, -105.049418 39.785115, -105.048863 39.785149, -105.048538 39.785138, -105.048249 39.785113, -105.047986 39.78507, -105.04771 39.785026, -105.047404 39.78493, -105.047092 39.784825, -105.046816 39.784724, -105.046486 39.784562, -105.046097 39.784388, -105.045253 39.783973, -105.044745 39.7838, -105.044236 39.78369, -105.044034 39.783656, -105.043786 39.783624, -105.043541 39.783599, -105.043308 39.783589, -105.04101 39.783582, -105.038282 39.783598, -105.037215 39.783593, -105.036626 39.783582, -105.03627 39.78358, -105.035561 39.783533, -105.034549 39.783448, -105.033752 39.783421, -105.033378 39.783406, -105.033132 39.7834, -105.032847 39.783429, -105.032657 39.783443, -105.032442 39.783466, -105.03211 39.783517, -105.031703 39.783585, -105.030055 39.783861, -105.02809 39.78413, -105.027313 39.784236, -105.026595 39.784299, -105.026018 39.784335, -105.025655 39.784366, -105.025373 39.78438, -105.025336 39.784381, -105.025192 39.784385)))">
neighborhood.update! feature: parsed
(0.3ms) BEGIN
Neighborhood Exists (0.8ms) SELECT 1 AS one FROM "neighborhoods" WHERE ("neighborhoods"."geojson_given_name" = 'Berkeley' AND "neighborhoods"."id" != 232 AND "neighborhoods"."city_id" = 1) LIMIT 1
SQL (1.4ms) UPDATE "neighborhoods" SET "feature" = $1, "updated_at" = $2 WHERE "neighborhoods"."id" = $3 [["feature", "0020000006000000000000000100000000030000000100000076c05a419cbee807bc4043e466ba493c8ac05a419cbab649d44043e4644523f67fc05a419cbab649d44043e4644523f67fc05a419ca5bd944b4043e457646ae3a4c05a419cc319c5a44043e438fbca105ac05a419d8c6d612c4043e42b51bd61f6c05a419d909f1f154043e41d53cddd6ec05a419d9d3458cd4043e3f612407464c05a419cae21101b4043e3dfa871a3b1c05a419db22d0e564043e3d188f42fe8c05a419dcf893faf4043e3b7b6bb1290c05a419dfdac68a94043e390b8498809c05a419d40ee06d94043e3691212513bc05a419e4d5d80e54043e34c55432874c05a419e492bc2fc4043e329cbab649dc05a419e4d5d80e54043e3001d5c3159c05a419d5e4a38324043e2ef99806f26c05a419e6256366d4043e2df1e0828c3c05a419e6ab9b23e4043e2d25edd0529c05a419e7fb267c74043e2b4959e6256c05a419e7fb267c74043e2aaeafab53dc05a419d7fd827744043e296aad1d042c05a419d7fd827744043e2877681669dc05a419d8409e55c4043e2780fdc1616c05a41a93af74cd34043e278c868b9fec05a41c45cbbc2b94043e27a63736cdfc05a41eb0318b9344043e27bcc2938dec05a4204b3c3e74b4043e27d6733ebc0c05a42113836a8334043e27e0ef99807c05a421dde37585c4043e27e9531550dc05a42273929ed394043e27f4dbdf8f4c05a422dcb1465e94043e27fcb923a2ac05a4237974602434043e2808c8259e2c05a424156e264e54043e28049667b5fc05a424aa10e02214043e2800eae18adc05a42548ecd8dbd4043e27fbacb4289c05a425dfeb8d8234043e27f66e86c66c05a4267b1c0010c4043e27e9531550dc05a427125dd095b4043e27dc37a3db4c05a427abb8800eb4043e27d45a5fc7ec05a42848387df5d4043e27cc7d1bb49c05a428e043a21644043e27d2c7b890dc05a4297891e21534043e27d912556d2c05a42a1272c94b44043e27d6733ebc0c05a42aacd9e83e44043e27d3d4280aec05a42b4784230fd4043e27c30d306a3c05a42b530ced4e54043e27c200c0f02c05a42be27179bfe4043e27b24638c97c05a42c79b34a44c4043e27ad080b674c05a42d11be6e6544043e27a7c9de050c05a42e3b8a19c9d4043e27b1c0010c7c05a42ed06fef7c24043e27b139c94f7c05a42f6598e10cf4043e27b139c94f7c05a43094a2b9d3d4043e27a95c853c1c05a4311fd5885d34043e27a85015c21c05a431c3ac929aa4043e27a6bd6e8b0c05a431fafc8b0084043e27a95c853c1c05a432f48c2e7714043e27a8d64d7f1c05a4338b47c73ef4043e27a63736cdfc05a4342396073de4043e27a398201cdc05a434bb1af3a154043e279e59f2baac05a4355432873bd4043e2798958d9b6c05a435eb7457c0b4043e2798958d9b6c05a43684cf0739b4043e2798958d9b6c05a43685553ef6b4043e36694898f60c05a43685985ad544043e44f5d35653dc05a43682f9442424043e44f765fd8aec05a4363e07a28bb4043e451e321a2e8c05a435e071c53f44043e45657fb6998c05a435a4acf312b4043e459e1f3a57fc05a434fc1df33014043e4649906cca3c05a43423d9231c64043e4726d04e619c05a433ed0f627394043e474e22a2c23c05a43385c67dfe34043e4792d1287c2c05a43309c7ffde74043e47c6327ed85c05a432e3c536d654043e47d2c7b890dc05a4329aa1d755c4043e47ea5f84cadc05a43209246bf014043e47fc32ebe59c05a431b3f20a73f4043e47f66e86c66c05a431682f944244043e47e9531550dc05a431233df2a9d4043e47d2c7b890dc05a430dae3e6c4c4043e47bbb62413ec05a4308aac96cc64043e4789613d31cc05a43038e29f9cf4043e47525460aa6c05a42ff08893b7e4043e471d6063172c05a42f9a06a6e334043e46c8711d799c05a42f340d4dc664043e466d373affbc05a42e56cd6c2f04043e4593a2df938c05a42dd1a21ea364043e4538ef34d6ac05a42d4c33b53934043e44ff43419e3c05a42d173fb7a5f4043e44ed6fda837c05a42cd63cb81734043e44dca8e2e2cc05a42c96030c2404043e44cf8d716d3c05a42c58eeae9ee4043e44ca4f440afc05a429fe86833c64043e44c6a3bddfdc05a4273365881a14043e44cf0739b02c05a4261bb05faec4043e44cc6822ff1c05a425814940bbb4043e44c6a3bddfdc05a42523f67f4dc4043e44c5974e65cc05a4246a1a500d64043e44acf312b1bc05a42360d0247024043e44806290eedc05a4228fe260b2d4043e44723aafff3c05a4222dd7a99fa4043e446a5d6bebec05a421ed5ae1cde4043e4467381d7dcc05a421a2a4db1644043e44766c6de76c05a42170d62bf124043e447dc37a3dbc05a4213879c41144043e4489d27c393c05a420e1719f7f94043e44a48f96e16c05a42076c050bd84043e44c8366516ec05a41ec6bce85344043e4558ea7ce10c05a41cc39ffd60f4043e45e5f30e7ffc05a41bf7f06705d4043e461d8622c45c05a41b3bb83cf2d4043e463e8dda48bc05a41aa4766c6de4043e46516db0dd8c05a41a454de7ea64043e4661ae70c13c05a419fb6134ce44043e4669057d178c05a419f1ae2da554043e46698bb4d49c05a419cbee807bc4043e466ba493c8a"], ["updated_at", "2015-12-09 17:10:17.790004"], ["id", 232]]
(0.7ms) COMMIT
=> true
neighborhood
=> #<Neighborhood id: 232, name: "Berkeley", feature: #<RGeo::Geos::CAPIMultiPolygonImpl:0x3fc6fd80033c "MULTIPOLYGON (((-105.025192 39.784385, -105.025191 39.78431, -105.025191 39.78431, -105.025186 39.783917, -105.025193 39.782989, -105.025241 39.782572, -105.025242 39.782145, -105.025245 39.780947, -105.025188 39.780263, -105.02525 39.779832, -105.025257 39.779044, -105.025268 39.777854, -105.025223 39.776644, -105.025287 39.775767, -105.025286 39.774713, -105.025287 39.773441, -105.02523 39.772937, -105.025292 39.772434, -105.025294 39.772045, -105.025299 39.771136, -105.025299 39.770841, -105.025238 39.770223, -105.025238 39.769759, -105.025239 39.769289, -105.025954 39.769311, -105.02761 39.76936, -105.029969 39.769403, -105.031537 39.769452, -105.032301 39.769472, -105.033073 39.769488, -105.033644 39.76951, -105.034045 39.769525, -105.034643 39.769548, -105.035238 39.76954, -105.035805 39.769533, -105.036411 39.769523, -105.036987 39.769513, -105.037579 39.769488, -105.038156 39.769463, -105.038741 39.769448, -105.039338 39.769433, -105.039918 39.769445, -105.040499 39.769457, -105.041086 39.769452, -105.041675 39.769447, -105.042265 39.769415, -105.042309 39.769413, -105.042856 39.769383, -105.043433 39.769373, -105.044013 39.769363, -105.045149 39.769382, -105.045717 39.769381, -105.046286 39.769381, -105.047442 39.769366, -105.047973 39.769364, -105.048598 39.769361, -105.048809 39.769366, -105.049761 39.769365, -105.050336 39.76936, -105.050917 39.769355, -105.051495 39.769345, -105.052079 39.769334, -105.052656 39.769334, -105.053241 39.769334, -105.053243 39.776568, -105.053244 39.783672, -105.053234 39.783675, -105.052971 39.783749, -105.052614 39.783885, -105.052386 39.783993, -105.051743 39.78432, -105.050918 39.784742, -105.050709 39.784817, -105.050315 39.784948, -105.049842 39.785046, -105.049697 39.78507, -105.049418 39.785115, -105.048863 39.785149, -105.048538 39.785138, -105.048249 39.785113, -105.047986 39.78507, -105.04771 39.785026, -105.047404 39.78493, -105.047092 39.784825, -105.046816 39.784724, -105.046486 39.784562, -105.046097 39.784388, -105.045253 39.783973, -105.044745 39.7838, -105.044236 39.78369, -105.044034 39.783656, -105.043786 39.783624, -105.043541 39.783599, -105.043308 39.783589, -105.04101 39.783582, -105.038282 39.783598, -105.037215 39.783593, -105.036626 39.783582, -105.03627 39.78358, -105.035561 39.783533, -105.034549 39.783448, -105.033752 39.783421, -105.033378 39.783406, -105.033132 39.7834, -105.032847 39.783429, -105.032657 39.783443, -105.032442 39.783466, -105.03211 39.783517, -105.031703 39.783585, -105.030055 39.783861, -105.02809 39.78413, -105.027313 39.784236, -105.026595 39.784299, -105.026018 39.784335, -105.025655 39.784366, -105.025373 39.78438, -105.025336 39.784381, -105.025192 39.784385)))">>
And of course the issue (neighborhood.reload does the same of course):
neighborhood = Neighborhood.find_by(name: 'Berkeley')
=> #<Neighborhood id: 232, name: "Berkeley", feature: nil>
Furthermore, the string saved on the SQL update (above) differs from what is retrieved from the postgres, as you can see from the first few characters:
SELECT feature FROM neighborhoods WHERE id = 232;
0106000020E61000000100000001030000000100000076000000BC07E8BE9C415AC08A3C49BA66E44340D449B6BA9C415AC07FF6234564E44340D449B6BA9C415AC07FF6234564E443404B94BDA59C415AC0A4E36A6457E44340A4C519C39C415AC05A10CAFB38E443402C616D8C9D415AC0F661BD512BE44340151F9F909D415AC06EDDCD531DE44340CD58349D9D415AC064744012F6E343401B1021AE9C415AC0B1A371A8DFE34340560E2DB29D415AC0E82FF488D1E34340AF3F89CF9D415AC09012BBB6B7E34340A968ACFD9D415AC0098849B890E34340D906EE409D415AC03B51121269E34340E5805D4D9E415AC0742843554CE34340FCC22B499E415AC09D64ABCB29E34340E5805D4D9E415AC059315C1D00E3434032384A5E9D415AC0266F8099EFE243406D3656629E415AC0C328081EDFE243403EB2B96A9E415AC02905DD5ED2E24340C767B27F9E415AC056629E95B4E24340C767B27F9E415AC03DB5FAEAAAE243407427D87F9D415AC042D0D1AA96E243407427D87F9D415AC09D66817687E243405CE509849D415AC01616DC0F78E24340D34CF73AA9415AC0FEB968C878E24340B9C2BB5CC4415AC0DF6C73637AE2434034B91803EB415AC0DE3829CC7BE243404BE7C3B304425AC0C0EB33677DE2434033A8363811425AC00798F90E7EE243405C5837DE1D425AC00D5531957EE2434039ED293927425AC0F4F8BD4D7FE24340E96514CB2D425AC02A3A92CB7FE243404302469737425AC0E259828C80E24340E564E25641425AC05F7B664980E2434021020EA14A425AC0AD18AE0E80E24340BD8DCD8E54425AC08942CBBA7FE2434023D8B8FE5D425AC0666CE8667FE243400C01C0B167425AC00D5531957EE243405B09DD2571425AC0B43D7AC37DE24340EB0088BB7A425AC07EFCA5457DE243405DDF878384425AC049BBD1C77CE2434064213A048E425AC00D897B2C7DE2434053211E8997425AC0D25625917DE24340B4942C27A1425AC0C0EB33677DE24340E4839ECDAA425AC0AE80423D7DE24340FD304278B4425AC0A306D3307CE24340E5D4CE30B5425AC0020F0C207CE24340FE9B1727BE425AC0978C63247BE243404CA4349BC7425AC074B680D07AE2434054E6E61BD1425AC050E09D7C7AE243409D9CA1B8E3425AC0C710001C7BE24340C2F7FE06ED425AC0F7949C137BE24340CF108E59F6425AC0F7949C137BE243403D9D2B4A09435AC0C153C8957AE24340D38558FD11435AC0215C01857AE24340AA29C93A1C435AC0B0E8D66B7AE2434008B0C8AF1F435AC0C153C8957AE2434071E7C2482F435AC0F1D7648D7AE24340EF737CB438435AC0DF6C73637AE24340DE73603942435AC0CD0182397AE24340153AAFB14B435AC0AA2B9FE579E24340BD73284355435AC0B6D9588979E243400B7C45B75E435AC0B6D9588979E243409B73F04C68435AC0B6D9588979E243406BEF535568435AC0608F899466E3434054AD855968435AC03D65355D4FE443404242942F68435AC0AED85F764FE44340BB287AE063435AC0E8A221E351E44340F4531C075E435AC09869FB5756E443402B31CF4A5A435AC07FA5F3E159E443400133DFC14F435AC0A3CC069964E44340C631923D42435AC019E6046D72E443403927F6D03E435AC0232C2AE274E44340E3DF675C38435AC0C287122D79E44340E7FD7F9C30435AC085ED27637CE44340656D533C2E435AC00D897B2C7DE443405C751DAA29435AC0AD4CF8A57EE4434001BF469220435AC059BE2EC37FE443403FA7203F1B435AC0666CE8667FE443402444F98216435AC00D5531957EE443409D2ADF3312435AC00D897B2C7DE443404C6C3EAE0D435AC03E4162BB7BE44340C66CC9AA08435AC01CD3139678E44340CFF9298E03435AC0A60A462575E443407E3B8908FF425AC0723106D671E44340336E6AA0F9425AC099D711876CE4434066DCD440F3425AC0FBAF73D366E44340F0C2D66CE5425AC038F92D3A59E4434036EA211ADD425AC06A4DF38E53E4434093533BC3D4425AC0E31934F44FE443405F7AFB73D1425AC037A8FDD64EE443407381CB63CD425AC02C2E8ECA4DE4434040C23060C9425AC0D316D7F84CE44340EEE9EA8EC5425AC0AF40F4A44CE44340C63368E89F425AC0FDDD3B6A4CE44340A181583673425AC0029B73F04CE44340ECFA05BB61425AC0F12F82C64CE44340BB0B941458425AC0FDDD3B6A4CE44340DCF4673F52425AC05CE674594CE44340D600A5A146425AC01B2B31CF4AE443400247020D36425AC0ED0E290648E443402D0B26FE28425AC0F3FFAA2347E44340FA997ADD22425AC0BEBED6A546E44340DE1CAED51E425AC0DCD7817346E4434064B14D2A1A425AC076DEC66647E4434012BF620D17425AC0DBA337DC47E4434014419C8713425AC093C3279D48E44340F9F719170E425AC0166EF9484AE44340D80B056C07425AC06E5166834CE443403485CE6BEC415AC010CEA78E55E443400FD6FF39CC415AC0FFE7305F5EE443405D70067FBF415AC0452C62D861E443402DCF83BBB3415AC08BA4DDE863E44340DEC66647AA415AC0D80DDB1665E44340A67EDE54A4415AC0130CE71A66E44340E44C13B69F415AC078D1579066E4434055DAE21A9F415AC0494DBB9866E44340BC07E8BE9C415AC08A3C49BA66E44340
Please note, the WKT generated by postgres equals that generated by rgeo (from above parsed.to_s):
SELECT ST_AsText(feature) FROM neighborhoods WHERE id = 232;
MULTIPOLYGON(((-105.025192 39.784385,-105.025191 39.78431,-105.025191 39.78431,-105.025186 39.783917,-105.025193 39.782989,-105.025241 39.782572,-105.025242 39.782145,-105.025245 39.780947,-105.025188 39.780263,-105.02525 39.779832,-105.025257 39.779044,-105.025268 39.777854,-105.025223 39.776644,-105.025287 39.775767,-105.025286 39.774713,-105.025287 39.773441,-105.02523 39.772937,-105.025292 39.772434,-105.025294 39.772045,-105.025299 39.771136,-105.025299 39.770841,-105.025238 39.770223,-105.025238 39.769759,-105.025239 39.769289,-105.025954 39.769311,-105.02761 39.76936,-105.029969 39.769403,-105.031537 39.769452,-105.032301 39.769472,-105.033073 39.769488,-105.033644 39.76951,-105.034045 39.769525,-105.034643 39.769548,-105.035238 39.76954,-105.035805 39.769533,-105.036411 39.769523,-105.036987 39.769513,-105.037579 39.769488,-105.038156 39.769463,-105.038741 39.769448,-105.039338 39.769433,-105.039918 39.769445,-105.040499 39.769457,-105.041086 39.769452,-105.041675 39.769447,-105.042265 39.769415,-105.042309 39.769413,-105.042856 39.769383,-105.043433 39.769373,-105.044013 39.769363,-105.045149 39.769382,-105.045717 39.769381,-105.046286 39.769381,-105.047442 39.769366,-105.047973 39.769364,-105.048598 39.769361,-105.048809 39.769366,-105.049761 39.769365,-105.050336 39.76936,-105.050917 39.769355,-105.051495 39.769345,-105.052079 39.769334,-105.052656 39.769334,-105.053241 39.769334,-105.053243 39.776568,-105.053244 39.783672,-105.053234 39.783675,-105.052971 39.783749,-105.052614 39.783885,-105.052386 39.783993,-105.051743 39.78432,-105.050918 39.784742,-105.050709 39.784817,-105.050315 39.784948,-105.049842 39.785046,-105.049697 39.78507,-105.049418 39.785115,-105.048863 39.785149,-105.048538 39.785138,-105.048249 39.785113,-105.047986 39.78507,-105.04771 39.785026,-105.047404 39.78493,-105.047092 39.784825,-105.046816 39.784724,-105.046486 39.784562,-105.046097 39.784388,-105.045253 39.783973,-105.044745 39.7838,-105.044236 39.78369,-105.044034 39.783656,-105.043786 39.783624,-105.043541 39.783599,-105.043308 39.783589,-105.04101 39.783582,-105.038282 39.783598,-105.037215 39.783593,-105.036626 39.783582,-105.03627 39.78358,-105.035561 39.783533,-105.034549 39.783448,-105.033752 39.783421,-105.033378 39.783406,-105.033132 39.7834,-105.032847 39.783429,-105.032657 39.783443,-105.032442 39.783466,-105.03211 39.783517,-105.031703 39.783585,-105.030055 39.783861,-105.02809 39.78413,-105.027313 39.784236,-105.026595 39.784299,-105.026018 39.784335,-105.025655 39.784366,-105.025373 39.78438,-105.025336 39.784381,-105.025192 39.784385)))
Why can't the postgis adapter convert this back to a value?
Hoping there is an adjustment I can do to make this work. If not happy to help diagnose/fix, but wanted to ask before I educate myself further if there is a simple error on my part!
Please let me know if you need further information!
I did some further digging. Looks like the source of the error is most likely in rgeo/lib/rgeo/wkrep/wkb_parser.rb.
@teeparham Should I move this Issue there?
I dug into this further and found that an exception is thrown in RGeo::Geographic::Factory in the polygon method here:
def polygon(outer_ring_, inner_rings_=nil)
@polygon_class.new(self, outer_ring_, inner_rings_) rescue nil
end
The polygon_class is RGeo::Geographic::SphericalPolygonImpl and the exceptions is:
@polygon_class.new(self, outer_ring_, inner_rings_)
RGeo::Error::InvalidGeometry: Failed to cast exterior ring LINESTRING (-105.025192 39.784385, -105.025191 39.78431, -105.025191 39.78431, -105.025186 39.783917, -105.025193 39.782989, -105.025241 39.782572, -105.025242 39.782145, -105.025245 39.780947, -105.025188 39.780263, -105.02525 39.779832, -105.025257 39.779044, -105.025268 39.777854, -105.025223 39.776644, -105.025287 39.775767, -105.025286 39.774713, -105.025287 39.773441, -105.02523 39.772937, -105.025292 39.772434, -105.025294 39.772045, -105.025299 39.771136, -105.025299 39.770841, -105.025238 39.770223, -105.025238 39.769759, -105.025239 39.769289, -105.025954 39.769311, -105.02761 39.76936, -105.029969 39.769403, -105.031537 39.769452, -105.032301 39.769472, -105.033073 39.769488, -105.033644 39.76951, -105.034045 39.769525, -105.034643 39.769548, -105.035238 39.76954, -105.035805 39.769533, -105.036411 39.769523, -105.036987 39.769513, -105.037579 39.769488, -105.038156 39.769463, -105.038741 39.769448, -105.039338 39.769433, -105.039918 39.769445, -105.040499 39.769457, -105.041086 39.769452, -105.041675 39.769447, -105.042265 39.769415, -105.042309 39.769413, -105.042856 39.769383, -105.043433 39.769373, -105.044013 39.769363, -105.045149 39.769382, -105.045717 39.769381, -105.046286 39.769381, -105.047442 39.769366, -105.047973 39.769364, -105.048598 39.769361, -105.048809 39.769366, -105.049761 39.769365, -105.050336 39.76936, -105.050917 39.769355, -105.051495 39.769345, -105.052079 39.769334, -105.052656 39.769334, -105.053241 39.769334, -105.053243 39.776568, -105.053244 39.783672, -105.053234 39.783675, -105.052971 39.783749, -105.052614 39.783885, -105.052386 39.783993, -105.051743 39.78432, -105.050918 39.784742, -105.050709 39.784817, -105.050315 39.784948, -105.049842 39.785046, -105.049697 39.78507, -105.049418 39.785115, -105.048863 39.785149, -105.048538 39.785138, -105.048249 39.785113, -105.047986 39.78507, -105.04771 39.785026, -105.047404 39.78493, -105.047092 39.784825, -105.046816 39.784724, -105.046486 39.784562, -105.046097 39.784388, -105.045253 39.783973, -105.044745 39.7838, -105.044236 39.78369, -105.044034 39.783656, -105.043786 39.783624, -105.043541 39.783599, -105.043308 39.783589, -105.04101 39.783582, -105.038282 39.783598, -105.037215 39.783593, -105.036626 39.783582, -105.03627 39.78358, -105.035561 39.783533, -105.034549 39.783448, -105.033752 39.783421, -105.033378 39.783406, -105.033132 39.7834, -105.032847 39.783429, -105.032657 39.783443, -105.032442 39.783466, -105.03211 39.783517, -105.031703 39.783585, -105.030055 39.783861, -105.02809 39.78413, -105.027313 39.784236, -105.026595 39.784299, -105.026018 39.784335, -105.025655 39.784366, -105.025373 39.78438, -105.025336 39.784381, -105.025192 39.784385)
Which in turn comes from RGeo::ImplHelper::BasicPolygonMethods initialize method:
@exterior_ring = Feature.cast(exterior_ring_, factory_, Feature::LinearRing)
Cast looks like it spiders off.... I'll try and dig more later.
Closing since this is an upstream issue.