xni06 / JCoord

Easily convert between latitude/longitude, Universal Transverse Mercator (UTM) and Ordnance Survey (OSGB) references with Java using the Jcoord package.
http://www.jstott.me.uk/jcoord
12 stars 9 forks source link

Leading zeros in getOsRefWithPrecisionOf(SIX_DIGITS) #7

Closed nickw1 closed 4 years ago

nickw1 commented 6 years ago

Noticed that OSRef.getOsRefWithPrecisionOf() with six digit precision adds leading zeros to the grid reference.

For instance 489600m, 128500m gets converted to SU08960285.

Is this intended behaviour? Would expect SU896285.

I am quite happy to fix this myself if the leading zeros are indeed erroneous.

xni06 commented 6 years ago

TBH, I don't know what it should be as I'm no expert in this field - you'd have to ask the author :-/

In his absence, all I can say is that your assumption sounds correct having injected them into http://www.fieldenmaps.info/cconv/cconv_gb.html

Feel free to add a breaking test then make the relevant changes.

In the meantime, we can see whether anyone else has any comments.

nickw1 commented 6 years ago

OK. BTW it's not just an assumption, the OS document it explicitly; see six-figure refs at: https://getoutside.ordnancesurvey.co.uk/guides/beginners-guide-to-grid-references/

xni06 commented 4 years ago

Would you like to create a PR?

nickw1 commented 4 years ago

Fixed in PR #10; therefore now closed.