GraphHopper.com | Forum | GitHub | Maps | Blog

GraphHopper Not Considering Modification in a Way


#1

I have deployed GraphHopper server locally and working on routes for ski slopes/pistes for Chamrousse ski resort in France.
OSM contains pistes/slopes for Chamrousse ski resort in France. I chose a piste named “Perchette” (having OSM way id: 210631968) which is shown in screenshot at the following link:
OSM Chamrousse Ski Piste “Perchette” into Consideration.

I exported Chamrousse OSM extract, converted it into .pbf and copied into GraphHopper root directory. When I executed GraphHopper and calculcated a route on web between two points/locations near to “Perchetter” piste (which is not visible in GraphHopper/OSM maps in default mode. But it is visible in OSM Edit mode), I got the following route as shown in the link:

GraphHopper Returned Route (Left side). It also contains new route (on right side) which I will refer below
This route passes through an unnammed way having way id: 24005121.

Then I changed the definition of “Perchette” similar to the way id 24005121 (i.e., having nodes references and only two following tags):

<tag k="highway" v="track"/> 
<tag k="surface" v="unpaved"/>

The default definition of “Perchette” way is:

<way id="210631968" version="3" timestamp="2017-09-15T08:44:41Z" changeset="52062048" uid="1811738" user="47NOE">
	<nd ref="582825820"/>
	<nd ref="2207085890"/>
	<nd ref="2207085885"/>
	<nd ref="2207085881"/>
	<nd ref="2999556660"/>
	<nd ref="2999557242"/>
	<nd ref="2207085877"/>
	<nd ref="2207085878"/>
	<nd ref="582825821"/>
	<tag k="name" v="Perchette"/>
	<tag k="route" v="piste"/>
	<tag k="piste:type" v="downhill"/>
	<tag k="piste:difficulty" v="easy"/>
</way>

Then I modified its definition as follows:

<way id="210631968" version="3" timestamp="2017-09-15T08:44:41Z" changeset="52062048" uid="1811738" user="47NOE">
    <nd ref="582825820"/>
    <nd ref="2207085890"/>
    <nd ref="2207085885"/>
    <nd ref="2207085881"/>
    <nd ref="2999556660"/>
    <nd ref="2999557242"/>
    <nd ref="2207085877"/>
    <nd ref="2207085878"/>
    <nd ref="582825821"/>
    <tag k="highway" v="track"/>
    <tag k="surface" v="unpaved"/>
 </way>

When I updated OSM file in GraphHopper and calculated the route again, the route is different from initial route but still it does not passes from “Perchette” way which is the closest to starting and ending points. The new route is comprised of four ways (one old way and three new ways) having following way ids:

24005121(unnamed way),
399383189 (Route de la croisette),
266301460 (Route de la croisette) and
234527109 (unnamed way):

I cannot post more than 2 links and therefore, please follow the last link again as it contains new route as well. The above link has the following text:
“GraphHopper Returned Route (Left side). It also contains new route (on right side) which I will refer below”

My question is that why GraphHopper is not considering the modified “Perchette” way as a highway track in recommending a route? Am I doing anything wrong? or missing anything?

Thanks in advance.
Yasir


#2

I think the issue is that you use the CarFlagEncoder. Try the same with foot. For skiing you will probably have to write your own FlagEncoder.

Also “Perchette” seems to be disconnected from the Graph (no way leading to it).

Cheers,
Robin


#3

Thank you Robin for your comment.
But in my modified definition of “Perchette” way, I define it as of type “highway” and value “track”. So in my opinion, it should work with CarFlagEncoder.
Yes, I will write my own FlagEncoder for skiing, but at this moment, I am testing to declare piste as highway (for car and it is just for testing purpose) and I want GraphHopper to consider it for CarFlagEncoder.

As you mentioned that “Perchette” seems to be disconnected, I think this could be the main reason.
My question is that the starting and ending points lie within “Perchette”. In this manner, does it really matter that “Perchette” should be connected? I mean I was thinking that although “Perchette” is disconnected but if starting and ending points are within “Perchette” then there is no need for it to be connected.
I may be wrong because I do not have any knowledge about how GraphHopper builds graph for routing.

Best Regards,
Yasir


#4

Hi Yasir,

Yes I think it should, just wanted to let you know that you probably have to write your own FlagEncoder.

This depends on your configuration of GraphHopper. Small disconnected “sub-networks” usually get removed by GraphHopper, you can configure this though.

You might want to try this setting:

prepare.min_network_size=0
prepare.min_one_way_network_size=0

Cheers,
Robin


#5

Hi Robin,

Really thank you very much. Now, it works by setting prepre.min_network_size=0 and prepare.min_one_way_network_size=0 :slight_smile:

I have three more questions. I would be thankful if you can help me about them (if you have idea about them)

  1. I want to write my own FlagEncoder for skiing. Since GraphHopper is an extensive project with lot of files. Do you know which is/are the relevant file(s) to write my own FlagEncoder for skiing?

  2. I have deployed a local instance of GraphHopper on my own server. How can I request a route in JSON format? Also, do I still have to obtain and use API key for my local instance of GraphHopper in order to obtain a route in JSON format?

  3. “Perchette” is a disconnected way. I want to make it connected with other ways. How can I do this? Is there any documentation or tutorial for this mapping/connections?

Many thanks again for your help.

Best Regards,
Yasir


#6

Hi Yasir,

If you can open the HTML file at localhost:8989 and send routes, open your browser developer tools and inspect the network traffic.

No documentation about this. This is also not trivial if you want to do this for every way. You can change the OSM export by hand or try to do it in GraphHopper, I would probably try in the OSMReader or PostProcessing. This might be also related to #82.

Cheers,
Robin


#7

Hi Robin,

Really many many thanks for your great help. I really appreciate your prompt responses and very good answers :slight_smile:

Your answers have solved my concerns :slight_smile:

Best Regards,
Yasir