Skip to content

Commit

Permalink
Merge pull request #462 from OpenSPP/fix-gis-view
Browse files Browse the repository at this point in the history
Fixed GIS View not showing the coordinates and polygons
  • Loading branch information
emjay0921 authored Jun 27, 2024
2 parents f928d89 + c0e3418 commit 3a3989a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
8 changes: 7 additions & 1 deletion spp_base_gis/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,13 @@ def set_gis_field_name(self, in_tuple):
return in_tuple
field_obj = self.env["ir.model.fields"]
name = field_obj.browse(in_tuple[0]).name
return (in_tuple[0], name, in_tuple[1], field_obj.browse(in_tuple[0]).field_description)
return (
in_tuple[0],
name,
in_tuple[1],
field_obj.browse(in_tuple[0]).field_description,
field_obj.browse(in_tuple[0]).ttype,
)

@api.model
def get_gis_layers(self, view_id=None, view_type="gis", **options):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,10 @@ export class GisRenderer extends Component {
createDefaultDataLayers(layer) {
let layer_obj = {};
const visibility = layer.isVisible ? "visible" : "none";
const geoType = layer.geo_field_id[3];
const geoType = layer.geo_field_id[4];
const opacity = Math.min(1, Math.max(0, layer.layer_opacity));

if (geoType === "Polygon") {
if (geoType === "geo_polygon") {
layer_obj = {
id: layer.id,
type: "fill",
Expand All @@ -330,7 +330,7 @@ export class GisRenderer extends Component {
};
}

if (geoType === "Point") {
if (geoType === "geo_point") {
layer_obj = {
id: layer.id,
type: "circle",
Expand All @@ -346,7 +346,7 @@ export class GisRenderer extends Component {
};
}

if (geoType === "LineString") {
if (geoType === "geo_line") {
layer_obj = {
id: layer.id,
type: "line",
Expand Down Expand Up @@ -445,17 +445,17 @@ export class GisRenderer extends Component {
async onDataLayerChanged() {
for (const layer of this.dataLayersStore.getLayers) {
const visibility = layer.isVisible ? "visible" : "none";
const geoType = layer.geo_field_id[3];
const geoType = layer.geo_field_id[4];
const opacity = Math.min(1, Math.max(0, layer.layer_opacity));
let layerType = "";

if (geoType === "Point") {
if (geoType === "geo_point") {
layerType = "circle";
}
if (geoType === "LineString") {
if (geoType === "geo_line") {
layerType = "line";
}
if (geoType === "Polygon") {
if (geoType === "geo_polygon") {
layerType = "fill";
}

Expand Down

0 comments on commit 3a3989a

Please sign in to comment.