AtlasOfLivingAustralia / biocollect

Biocollect front end application
https://biocollect.ala.org.au/
Other
10 stars 15 forks source link

PID which is a point cannot be shown on biocollect #1006

Open qifeng-bai opened 6 years ago

qifeng-bai commented 6 years ago

Spatial portal has fixed this issue: GeoServer added a new layer: ALA:Points for points and a new style for rendering points.

Current AlaMap plugin use the default ALA:Objects layer to show PID . - that is why Point PID cannot be displayed

For fixing this issued, we need to tell ALAMap when it should use ALA:Objects or ALA:Points

BioCollect calls alamap.setGeoJson to initiate map layers. the setGeojson method has been called many places.

Here, for display site, in views/site/index.gsp, line 370-371 var geoJson = Biocollect.MapUtilities.featureToValidGeoJson(mapFeatures.features[0]); smallMap.setGeoJSON(geoJson);

featureToValidGeoJson is in MapUtilities.js if (feature.type.toLowerCase() == 'pid') { geoJson.geometry.type = ALA.MapConstants.DRAW_TYPE.POLYGON_TYPE; geoJson.geometry.coordinates = feature.coordinates || []; geoJson.properties.pid = feature.pid; } else if (feature.type.toLowerCase() == "circle") { geoJson.geometry.type = ALA.MapConstants.DRAW_TYPE.POINT_TYPE; geoJson.geometry.coordinates = feature.coordinates; geoJson.properties.point_type = ALA.MapConstants.DRAW_TYPE.CIRCLE_TYPE; geoJson.properties.radius = feature.radius; } else if (feature.type.toLowerCase() == "point") { geoJson.geometry.type = ALA.MapConstants.DRAW_TYPE.POINT_TYPE; geoJson.geometry.coordinates = feature.coordinates; } else if (feature.type.toLowerCase() == "polygon") { geoJson.geometry.type = ALA.MapConstants.DRAW_TYPE.POLYGON_TYPE; geoJson.geometry.coordinates = feature.coordinates; geoJson.properties.radius = feature.radius; } else if (feature.type.toLowerCase() == "linestring") { geoJson.geometry.type = ALA.MapConstants.DRAW_TYPE.LINE_TYPE; geoJson.geometry.coordinates = feature.coordinates; }

I found two examples: The first site is a pid with point http://devt.ala.org.au:8087/biocollect/ala/site/index/f40badfd-1d1a-4c2f-9662-533d5b7bb67b
pid: 6201576 feature.type: pid

The second site is a pid with polygon http://devt.ala.org.au:8087/biocollect/ala/site/index/ef23ef76-51f9-4eb6-afd6-635ca6e887ee pid: 6202407 feature.type : Polygon

There are some unclear questions: 1, When the feature.type is given? any rules? Since the first check in featureToValidGeoJson declares: if it is a pid, then set it to a polygon?

2, is it safe to declare a site which has a pid and its type is point, it is a point, not polygon

qifeng-bai commented 6 years ago

Geoserver use the same marker as leaflet used on Biocollect

https://biocollect-dev.ala.org.au/ala/site/index/f40badfd-1d1a-4c2f-9662-533d5b7bb67b