I found this: https://github.com/trevorprater/pymorton

The problem is I’ve only done one search for Z curve, and I found three 
different ways to do it for lat/long.  Since there’s no standard 
implementation, there’s very little point to it.  If you are doing it to make 
it easier to search, then you can just create an index on (lat, long).

> On May 4, 2016, at 2:07 AM, Shameema Mohsin <itz.shame...@gmail.com> wrote:
> 
> 
> Z value calculation
> ................................
> step1: converting lat and long to int
> 
> latitude int = (latitude + 90) × 10^6
> longitude int = (latitude + 180) × 10^6
> 
> note 10^6 = 1000000 
> 
> We compute the Morton value for a spatial point P (x, y)
> by interleaving the bits of x and y. For example, when x =
> 3(011 ) and y = 4(100), the Morton value for P is
> 100101 = 37 
> 
> step2: convert int (base 10) to binary digits (base 2)
> ..........?
> step3: interleave both values bits and compute z value
> take first bit from y cordinate  (longitude) : 1
> take first bit from x cordinate  (lat) : 0
> take 2nd bit from y cordinate  (longitude) :0
> take 2nd bit from x cordinate  (lat) : 1
> #take 3rd bit from y cordinate  (longitude) : 0
> #take 3rd bit from x cordinate  (lat) : 1
> 
> therefore z binary value is 100101 
> and z value is 37
> 
> #this is the technique used to convert spatial 2D indexing to 1D to improve 
> efficiency.
> 
> I do not know the python syntax. Kindly help.
> 

Peter of the Norse
rahmc...@radio1190.org



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/A32028E6-1085-4B4C-BF1B-6D5C4FC79BD4%40Radio1190.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to