security-force-monitor / sfm-cms

Platform for sharing complex information about security forces. Powers WhoWasInCommand.com
https://whowasincommand.com
10 stars 3 forks source link

Locations not showing in incidents #804

Closed tlongers closed 2 years ago

tlongers commented 2 years ago

Incident locations are not showing in some cases e.g.

https://whowasincommand.com/en/violation/view/045cab2d-fe37-4487-b364-b7b202529c62/ https://whowasincommand.com/en/violation/view/4a0761c0-1ecf-47b7-8b35-1c3af10d01b8/ https://whowasincommand.com/en/violation/view/7f244bc4-c9ff-4063-9c5c-234084a58d10/

tlongers commented 2 years ago

@smcalilly Some incidents are still not displaying after https://github.com/security-force-monitor/sfm-cms/pull/805

https://back.securityforcemonitor.org/en/violation/view/7ecde01a-94d0-4e3f-8229-2a7c6f2da54e/ https://back.securityforcemonitor.org/en/violation/view/56c47e4d-c980-44d5-8a5c-c0cc8a23122b/ https://back.securityforcemonitor.org/en/violation/view/f5e9a0e7-1134-4393-88f3-05dcb83db7fe/

The common factor in these incidents is that the location is not taken from OSM, it's an object we are made ourselves. For example, this incident:

https://back.securityforcemonitor.org/en/violation/view/7ecde01a-94d0-4e3f-8229-2a7c6f2da54e/

The location is: Muthalith Ahim (sfm, point) a16efc84-a8bb-41a1-b3d7-7d7d62bfb40f

The way to identifiy these locations is that the location:origin will be "sfm" and "osm'. In fact, the value in location:origin could be anything, as we draw geospatial data from a range of sources. See our docs on this.

The GeoJSON object in this case is:

{
 "geometry": {
     "coordinates": [
       43.08955,
       16.32543888888889
     ],
     "type": "Point"
   },
   "properties": {
     "sfm": {
       "location:admin_level_2": "Yemen (osm, poly) 9e3935b5-a3bd-40bd-9131-4b2c53de1d78",
       "location:admin_level_4": "Hajjah Governorate (osm, poly) 55b94dc2-fce3-4e4a-8d6e-4fd79a90594e",
       "location:admin_level_6": "Harad District (osm, poly) 14ba4362-6ccf-4366-99c0-8f0dd0260f30",
       "location:geo_type": "point",
       "location:humane_id:admin": "Muthalith Ahim (sfm, point) a16efc84-a8bb-41a1-b3d7-7d7d62bfb40f",
       "location:id:admin": "a16efc84-a8bb-41a1-b3d7-7d7d62bfb40f",
       "location:name": "Muthalith Ahim",
       "location:origin": "sfm"
     }
   },
   "type": "Feature"
 }

The object has correct geometry. I can see that parts of the object have been imported correctly, because the incident record on the staging server is correctly displaying the full incident location as "Muthalith Ahim, Harad District, Hajjah Governorate, Yemen", which is only available in the GeoJSON.

However, the geometry is not being picked up and displayed. As this record displays correctly on WhoWasInCommand the issue may be related to https://github.com/security-force-monitor/sfm-cms/pull/805

smcalilly commented 2 years ago

@tlongers We've fixed this with PR #806. Will you please do some QA to make sure we covered all the cases?

tlongers commented 2 years ago

Looks good @smcalilly

smcalilly commented 2 years ago

Bringing this question from an email so we can have the information here. cc @tlongers

I can't figure out from the PR whether the issue was that the geojson we are providing doesn't specify the geometry type, or that the code to render the map didn't pick up on it?

The short answer: the code to render the map didn't pick up on the geometry types. Y'all are providing valid GeoJSON with the geometry type.

Long answer: Open Street Map has some additional concepts for geometry types that are different from the GeoJSON spec. For example, OSM has a "node" which is the same thing as a GeoJSON point. The code originally relied on the OSM types, but the custom geometries created by your team don't include the OSM types (which makes sense because y'all aren't creating OSM data). This is no problem because we can get the type from the GeoJSON y'all create. Both ways work, so PR #806 handles both cases.

tlongers commented 2 years ago

Aha, that's interesting, thanks.

tlongers commented 2 years ago

Okay, this looks good. Closing!