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

feat: Add topojson graph export rebase #1926

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

MichaelsJP
Copy link
Member

@MichaelsJP MichaelsJP commented Dec 4, 2024

Pull Request Checklist

  • 1. I have [rebased][rebase] the latest version of the main branch into my feature branch and all conflicts
    have been resolved.
  • 2. I have added information about the change/addition to functionality to the CHANGELOG.md file under the
    [Unreleased] heading.
  • 3. I have documented my code using JDocs tags.
  • 4. I have removed unnecessary commented out code, imports and System.out.println statements.
  • 5. I have written JUnit tests for any new methods/classes and ensured that they pass.
  • 6. I have created API tests for any new functionality exposed to the API.
  • 7. If changes/additions are made to the ors-config.json file, I have added these to the [ors config documentation][config]
    along with a short description of what it is for, and documented this in the Pull Request (below).
  • 8. I have built graphs with my code of the Heidelberg.osm.gz file and run the api-tests with all test passing
  • 9. I have referenced the Issue Number in the Pull Request (if the changes were from an issue).
  • 10. For new features or changes involving building of graphs, I have tested on a larger dataset
    (at least Germany), and the graphs build without problems (i.e. no out-of-memory errors).
  • 11. For new features or changes involving the graphbuilding process (i.e. changing encoders, updating the
    importer etc.), I have generated longer distance routes for the affected profiles with different options
    (avoid features, max weight etc.) and compared these with the routes of the same parameters and start/end
    points generated from the current live ORS.
    If there are differences then the reasoning for these MUST be documented in the pull request.
  • 12. I have written in the Pull Request information about the changes made including their intended usage
    and why the change was needed.
  • 13. For changes touching the API documentation, I have tested that the API playground [renders correctly][api].

Information about the changes

  • Key functionality added:
    TopoJSON response type on the export endpoint. Returns a TopoJSON representation of the graph within a given bounding box containing the ORS edges and nodes, OSM ways with ID, a flag is passable both ways, speeds and distances.

Let's not add Lombok to existing classes. Only new ones for now. Hence, this fiel gets a typical setter.
Before the "coordinates" keyword was still serialized wrongly into the topojson structure creating a wrong arcs structure.
Reduce unnecessary duplication and streamline the export serialization with e.g. JsonExportResponse. The only difference is that it doesn't extent the ExportResponse. This is also not necessary. ExportResponse holds no value for the TopoJson export.
Layers is not necessary. It can be represented by a HashMap of layers where the key is the layer name. In our case "network".
@MichaelsJP MichaelsJP force-pushed the feat/add-topojson-graph-export-rebase branch from 807ea6d to aff6244 Compare December 4, 2024 21:06
takb added 3 commits December 9, 2024 16:10
… properties replacing weight with speed/distance, fallback for cases where OSM ids are not available, using OSM way geometries (with option to turn off and get only node coordinates (beeline graph) instead)
@takb takb requested review from koebi and sfendrich December 10, 2024 10:55
@github-actions github-actions bot added feature and removed feature labels Dec 10, 2024
Copy link
Contributor

@sfendrich sfendrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions github-actions bot added feature and removed feature labels Dec 10, 2024
@takb takb marked this pull request as ready for review December 10, 2024 11:04
@github-actions github-actions bot added feature and removed feature labels Dec 10, 2024
@takb takb force-pushed the feat/add-topojson-graph-export-rebase branch from e60e4aa to 9b7530f Compare December 10, 2024 13:52
Copy link

sonarcloud bot commented Dec 10, 2024

request.setProfileName(profile);
request.setResponseType(APIEnums.ExportResponseType.TOPOJSON);

ExportResult result = exportService.generateExportFromRequest(request);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it feels a bit weird that this is using the same function as the JSON endpoint, as they are returning vastly different data?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in both cases that function gets data from the graph for a specific bbox, the function below does different things with that result, I don't think that's so confusing...

Comment on lines -26 to -29
public void setEdgeWeigths(Map<Pair<Integer, Integer>, Double> edgeWeigths) {
this.edgeWeigths = edgeWeigths;
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this setter not needed anymore?
Lombok annotation is only there for ExportWarning

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope

Comment on lines 183 to 184
if (osmIdsAvailable) {
extra.put("osm_id", osmIdGraphStorage.getEdgeValue(iter.getEdge()));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is duplicating information that is already present as the key in topoGeometries.
We shouldn't add it twice.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

look at my refactored ExportRequest class, should be betternow


if (debug()) {
Map<String, Object> extra = new HashMap<>();
if (debug) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an API flag that should be adequately named - and not "debug" which sounds like a service-wide debug flag.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@takb takb requested review from sfendrich and koebi December 10, 2024 16:12
@github-actions github-actions bot added feature and removed feature labels Dec 10, 2024
@takb takb force-pushed the feat/add-topojson-graph-export-rebase branch from 2b1cfa4 to 3f8ad0d Compare December 10, 2024 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants