Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Need help in GeoJson + OSRM 🚨🚨 #6807

Unanswered
prabaljainn asked this question in Q&A
Discussion options

Hello OSRM Team,

I am working on a project where I need to calculate the distance between two geographical points. However, the key requirement is to use my custom routes defined in GeoJSON format, rather than the default OpenStreetMap data.

Details:

I have GeoJSON files that represent specific routes.
My goal is to calculate the distance between two points, potentially including intermediate waypoints, using these custom routes.
I'm interested in knowing whether OSRM supports custom GeoJSON routes and, if so, how I can integrate these routes into the OSRM framework.
Specific Questions:

  1. Does OSRM support the integration of custom route data in GeoJSON format?
  2. If yes, could you please guide me on how to incorporate my GeoJson?

@DennisOSRM @TheMarex @daniel-j-h @oxidase @danpat

I would like to cover this in a video, if i succeed i would love to make a guide to do this.

Thanks in advanced.

You must be logged in to vote

Replies: 10 comments

Comment options

easiest to do is to build your own PBF from your custom data. and there again, easiest is https://osmcode.org/pyosmium/. needs some intimate knowledge of OSM tagging rules.

You must be logged in to vote
0 replies
Comment options

Can’t i just convert GeoJson to osm pbf?

You must be logged in to vote
0 replies
Comment options

Try. In any case, rather a stackoverflow question.

You must be logged in to vote
0 replies
Comment options

@prabaljainn There have been some tools like https://github.com/tyrasd/geojsontoosm written - the key problem is that you need topology in your data - the lines need to be connected to each other. GeoJSON doesn't have that information in the core format, so it's not usable for routing without being converted to a format that does.

You must be logged in to vote
0 replies
Comment options

@danpat thanks for these quick responses. Can you please refer me some docs, taking reference I think i have to process my data than do the following

You must be logged in to vote
0 replies
Comment options

@prabaljainn Probably the best description of the issue is in the documentation for TopoJSON - https://github.com/topojson/topojson

Ultimately, OSRM only knows how to parse OSM-formatted data, either in PBF or XML forms. It is up to you to figure out how to convert your GeoJSON data into usable OSM data.

Most folks that work with network format data do not use GeoJSON for this reason - it is not a useful format for graph/routing applications.

You must be logged in to vote
0 replies
Comment options

FWIW, neither is a OSM PBF :D

You must be logged in to vote
0 replies
Comment options

I need to look around some other way to deal with my geojson data. 🙁
Maybe, using Haversine formula to calculate the great-circle distance to trace the path and sum the distance up.

Thanks @nilsnolde @danpat for your time.

You must be logged in to vote
0 replies
Comment options

@nilsnolde What I meant was that at least topology can be derived from the OSM nodes/ways information, unlike GeoJSON.

All the open routing engines today are basically 50% routing engines, 50% "convert to an optimized format for routing" engines - I once upon a time toyed with making a routing engine that just used OSM data directly, but man, was startup time slow......

You must be logged in to vote
0 replies
Comment options

Even in GeoJSON you can fairly easily get around that using properties, which ain't pretty but the current protobuf definition isn't either (for routing or pretty much anything needing the geometry or even topology of ways/relations).

I once upon a time toyed with making a routing engine that just used OSM data directly

Hahaha yeah that sounds ambitious. The OSM PBF should have had an official routing optimized schema, so much work and time dumped in each single engine. The idea I'm still toying with is to at least normalize things a bit more for routing engines to e.g. put admin data on the ways, resolve some annoying relations to way info, some sane density derivation, elevation postings to ways etc. I tested the waters with Graphhopper & Valhalla, the interest was semi, which I can kinda understand. No one really wants to be dependent on a data conversion pipeline from a third-party sorta rando OSS project.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Converted from issue

This discussion was converted from issue #6753 on March 04, 2024 23:20.

AltStyle によって変換されたページ (->オリジナル) /