GraphHopper.com | Forum | GitHub | Maps | Blog

Where does the name FlagEncoder come from


#1

I mean the FLAG part. I seem to be lacking some fundamental understaning of, eg, the CarFlagEncoder.


#2

One “flag” is usually a boolean value or used for a bit and was initially used for forward and backward access of an edge. The term “encoding” is used when we convert e.g. an integer like the average speed to its bit representation (usually 7 bits). In fact “encoding” is just one way, the opposite way is “decoding”, but DecodingEncodingManager would be too ugly :wink:

So, to store properties in an edge more efficient we do not store e.g. integers with 4 bytes but instead take care of the domain, e.g. a maximum speed can be stored with just 5 bits. An average speed required like I said roughly 7 bits or more depending on how precise you want it.

This way we can store surface, road class, roundabout, max speed, road access etc information in less than 12 bytes. (See the new shared_enc2 branch, where we start to store this information and not just average speed and access bits)