2015-11-23 18:41:48 +01:00
|
|
|
class GeojsonService
|
2018-03-20 17:47:37 +01:00
|
|
|
def self.to_json_polygon_for_cadastre(coordinates)
|
2016-01-15 11:53:00 +01:00
|
|
|
polygon = {
|
2018-01-15 18:54:57 +01:00
|
|
|
geom: {
|
|
|
|
type: "Feature",
|
|
|
|
geometry: {
|
|
|
|
type: "Polygon",
|
|
|
|
coordinates: [
|
|
|
|
coordinates
|
|
|
|
]
|
2016-01-15 11:53:00 +01:00
|
|
|
}
|
2018-01-15 18:54:57 +01:00
|
|
|
}
|
2016-01-15 11:53:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
polygon.to_json
|
|
|
|
end
|
2018-10-23 15:37:13 +02:00
|
|
|
|
2018-11-29 11:40:07 +01:00
|
|
|
def self.to_json_polygon_for_selection_utilisateur(coordinates)
|
|
|
|
coordinates = coordinates.map do |lat_longs|
|
|
|
|
outbounds = lat_longs.map do |lat_long|
|
|
|
|
[lat_long['lng'], lat_long['lat']]
|
|
|
|
end
|
|
|
|
|
|
|
|
[outbounds]
|
|
|
|
end
|
|
|
|
|
|
|
|
polygon = {
|
|
|
|
type: 'MultiPolygon',
|
|
|
|
coordinates: coordinates
|
|
|
|
}
|
|
|
|
|
|
|
|
polygon.to_json
|
|
|
|
end
|
2017-04-04 15:27:04 +02:00
|
|
|
end
|