Closed DenisCarriere closed 6 years ago
Ah, ok so just checked and here's the message string being used generate the hash:
Reference 2 -74.004821 40.741642 208 9279 -74.005127 40.740851 187.9
the problem was inboundBearing not being rounded to %d. Fixing java implementation
new java implementation -- let's drop the inbound reference entirely... i don't see how it adds value to the reference id and it isn't part of the original OpenLR spec.
hashString = "Reference " + ssr.formOfWay.value;
for(SharedStreetsLocationReference lr : ssr.locationReferences) {
hashString += String.format(" %.6f %.6f", lr.point.getX(), lr.point.getY());
if(lr.outboundBearing != null) {
hashString += String.format(" %d", Math.round(lr.outboundBearing));
hashString += String.format(" %d", Math.round(lr.distanceToNextRef * 100)); // store in centimeter
}
}
UniqueId id = UniqueId.generateHash(hashString);
let's drop the inbound reference entirely
@kpwebb Should we also drop inboundBearing
for the Protobuf schema? If we aren't ever planning on using it, is it worth storing that data?
Let's keep it in the protobuf -- folks are interested in this (was specifically requested by @migurski) and seems useful. I just don't think we should include it the ref id, as the ref should be unique based on other properties and this is just calculated as a convenience.
Ok! Sounds good to me!
Any chance you can update the *.reference.pbf
sample data, that way I can make sure we are getting the same ReferenceID.
Anytime I build the Java Builder it throws some kind of error.. lol 😢
Done! New sample data is up and I'll push a new pre-built jar for Builder.
👍 Sweet!
@kpwebb Having a hard time defining the ReferenceID message.
Maybe I'm missing something obvious, here's the example that's failing for me.
Data example
https://github.com/sharedstreets/sharedstreets-pbf/blob/master/test/out/11-602-769.reference.json
Java implementation
https://github.com/sharedstreets/sharedstreets-builder/blob/master/src/main/java/io/sharedstreets/data/SharedStreetsReference.java#L323-L340
Javascript Implementation
My Reference Message
Message Breakdown
lonlats
lonlats
" %d"
and inbound is"%.1f"
?)Javascript Code using example
@kpwebb Could you let me know which part of the message is wrong & which parts are correct?