Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion needed regarding preserving the start & end location for each trip segment #623

Closed
xubowenhaoren opened this issue Feb 24, 2021 · 1 comment

Comments

@xubowenhaoren
Copy link
Contributor

Hello,

We are working on a project with sub-tasks to improve the overall accessibility of the E-mission app UI. We've discovered that the Leaflet map cannot display the start & end location for each trip segment in an accessible manner. Since this is a very short 10-week project, we've decided to add the text display of the start & end location for each trip segment. A UI prototype below:

image

To display the start & end location information for each trip segment, we've added the following

in www/js/diary/services.js.points2Geojson():

      var start_place_name_res = {name: "dummy start place"};
      var end_place_name_res = {name: "dummy end place"};
      CommonGraph.getSectionDisplayName(startPoint.data.latitude, startPoint.data.longitude, start_place_name_res);
      CommonGraph.getSectionDisplayName(endPoint.data.latitude, endPoint.data.longitude, end_place_name_res);
        // missing properties are:
        "properties": {
          distances: distances,
          distance: distances.reduce(function (acc, val) {
            return acc + val;
          }, 0),
          duration: endPoint.data.ts - startPoint.data.ts,
          end_fmt_time: endMoment.format(),
          end_local_dt: moment2localdate(endMoment),
          end_ts: endPoint.data.ts,
          feature_type: "section",
          sensed_mode: "MotionTypes.UNPROCESSED", // TODO: pass this information to change-mode.js
          source: "unprocessed",
          speeds: speeds,
          start_fmt_time: startMoment.format(),
          start_local_dt: moment2localdate(startMoment),
          start_ts: startPoint.data.ts,
          times: times,
          trip_id: {$oid: tripAndSectionId},
          start_point_lat: startPoint.data.latitude,
          start_point_long: startPoint.data.longitude,
          end_point_lat: endPoint.data.latitude,
          end_point_long: endPoint.data.longitude,
          start_point_name: start_place_name_res,
          end_point_name: end_place_name_res
        }

in www/js/diary/detail.js:

  $scope.formattedSectionProperties = $scope.tripgj.sections.map(function(s) {
    return {"fmt_time": DiaryHelper.getLocalTimeString(s.properties.start_local_dt),
            "fmt_end_time": DiaryHelper.getLocalTimeString(s.properties.end_local_dt),
            "fmt_start_place": s.properties.start_point_name.name,
            "fmt_end_place": s.properties.end_point_name.name,
            "fmt_time_range": DiaryHelper.getFormattedTimeRange(s.properties.end_ts, s.properties.start_ts),
            "fmt_distance": DiaryHelper.getFormattedDistance(s.properties.distance),
            "sensed_mode": s.properties.sensed_mode,
            "icon": DiaryHelper.getIcon(s.properties.sensed_mode),
            "colorStyle": {color: DiaryHelper.getColor(s.properties.sensed_mode)}
            };
  });

These additions work pretty well with the unprocessed trips. However, we noticed that the UI was broken after the trips are segmented. After checking the e-mission-server code, we discovered that the section.py wrapper only wraps formatted information in the original E-mission UI. Hence my question is:

  1. What are the necessary changes to add to the e-mission server to add/preserve the start & end location for each trip segment?
  2. Given that our current server instance is based on the e-mission-server GIS branch, how can we add our own branch after making the necessary changes?
@xubowenhaoren
Copy link
Contributor Author

I just realized that this is a duplicate of issue #616. Closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant