I'm new to GIS and I have 'part of' a problem to solve. Basically I have road details in geojson (WGS84) with LineString of points covering a 100KM square. I'm designing an architecture to snap a GPS co-ordinate to a grid cell (with different precision). So I have to construct a hash function which will generate a cellId (say 100m/1000m/10KM square) precision.
Say, if my X,Y is 58.345876, 10.765433 then applying this hash function should give me a cellId (4 bytes/8 bytes) with which I can look up. I tried different ways (likes of doing modulus etc.,) but it does not seem to be consistent.
Can someone guide me with code as to how to build this algorithm?