perf(carto): use json schema to validate geojson instead of rgeo

This commit is contained in:
Paul Chavard 2023-04-07 15:24:28 +02:00
parent 3d3b90c4fb
commit c4432b1b47
11 changed files with 1312 additions and 99 deletions

View file

@ -1,11 +0,0 @@
class Migrations::NormalizeGeoAreaJob < ApplicationJob
def perform(ids)
GeoArea.where(id: ids).find_each do |geo_area|
geojson = RGeo::GeoJSON.decode(geo_area.geometry.to_json, geo_factory: RGeo::Geographic.simple_mercator_factory)
geometry = RGeo::GeoJSON.encode(geojson)
geo_area.update_column(:geometry, geometry)
rescue RGeo::Error::InvalidGeometry
geo_area.destroy
end
end
end