Wednesday, May 4, 2016

Re: manipulate n insert field values

> Den 4. maj 2016 kl. 10.07 skrev Shameema Mohsin <itz.shameema@gmail.com>:
>
>
> 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.

I'm sorry, but asking for a full Python implementation of the above is too much to ask for free help for. Implement it in PHP if that's what you're familiar with, and grab a Python handbook to look up the equivalent Python syntax.

Erik

--
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+unsubscribe@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/EDD2FC06-6471-44E4-8BFD-F02C59AC42FD%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment