Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Determine if coordinates within current mapview zoomlevel?

Hi,

I have a question concerning latitudedelta and longitudedelta of Titanium.Map.Mapview.location? What units are those parameters? Are these the same as the lat and long? I would like to find out if a certain coordinate is within the current view (=the deltas).

Example: My current position is

current_latitude:45.00000
current_longitude:9.00000
latitudeDelta:0.05
longitudeDelta:0.05

if I wanted to find out if

target_latitude: 45.06000
target_longitude: 9.06000

is within the current view with the above parameters how would I calculate this? Just for the latitude data I would assume this:

if (current_latitude + latitudedelta - target_latitude <= 0 || current_latitude - latitudedelta - target_latitude >= 0) {
 // true, within view's zoomlevel
} else {
 // false, outside of current view's zoomlevel
}

so in my above case of target_longitude and target_latitude this would return false?

And: Why are there two deltas? In all examples I looked at they seemed to be always identical.

Thanks for your help!

Regards, Felix

— asked April 28th 2010 by Felix Eggbert
  • coordinates
  • latitudedelta
  • longitudedelta
  • mapview
  • zoomlevel
0 Comments

0 Answers

The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.