abidinamdar / gmapcatcher

Automatically exported from code.google.com/p/gmapcatcher
1 stars 0 forks source link

Need to Know indexing and conversion from lat lon to map tile and pixel size #310

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What new or enhanced feature are you proposing?
Hi, This is more of a request to know how the software functions rather than a 
request to enhance features:

I am using this tool to download a large area of map tiles and at varying zoom 
levels. I believe I have worked out the conversion to find the relevant image 
set for a given longitude, however, I can't use the same process to work out 
the image needed for a given latitude.

Could someone give me a breakdown of how the latitude conversion works?

Currently for Longitude I use: 
GLon = Lon+180;
Ratio = GLon/360;
Zoom = 7; %For example...
No_Tiles = 1024;
Folder_Number = No_Tiles*Ratio - 1;

Then if No_Tiles is larger than 1024 I use an index folder conversion.

If anyone could help with this it would be most appreciated.

JD

Original issue reported on code.google.com by atxjohn...@gmail.com on 21 Feb 2012 at 11:51

GoogleCodeExporter commented 8 years ago
Also: If anyone has the conversion from pixel to meters for the different zoom 
levels this would be appreciated.

Original comment by atxjohn...@gmail.com on 21 Feb 2012 at 11:52

GoogleCodeExporter commented 8 years ago
You do know that this an Open Source project, right?

http://code.google.com/p/gmapcatcher/source/browse/trunk/gmapcatcher/mapUtils.py
def coord_to_tile(coord):

http://code.google.com/p/gmapcatcher/source/browse/trunk/gmapcatcher/tilesRepo/t
ilesRepoFS.py
def coord_to_path(self, tile_coord, layer):

Original comment by heldersepu on 21 Feb 2012 at 1:28

GoogleCodeExporter commented 8 years ago
Thank you for these links.
I'm new to programming and google code, so I really appreciate these pointers. 
I have no idea how to find this stuff (been thrown in the deep end as a Ph.D. 
student in a different field from my main discipline).

Original comment by atxjohn...@gmail.com on 27 Feb 2012 at 3:12

GoogleCodeExporter commented 8 years ago
First thing you should do is get the source code, some instructions here:
http://code.google.com/p/gmapcatcher/source/checkout

You should use a good editor to read the python source code, if you are on 
Windows I will recommend you notepad++

If you need any more help shoot me an email heldersepu(at)gmail.com

Original comment by heldersepu on 27 Feb 2012 at 3:22

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I'm sorry for this inconvenience, but i don't understand why these 2 functions 
don't work with me. My values for lat, long, zoom parameters are 21.0688888889, 
105.8125, -2. So the coordinates after being processed by coord_to_tile 
function are 416413, 230744 and the path should be "sat_tiles\-2\406\399\344", 
but i don't find any folder named 399. is the formular should be added +100 or 
something like that. I hope you will reply soon. Thank you so much.

Original comment by Lethaili...@gmail.com on 13 Mar 2014 at 9:10

GoogleCodeExporter commented 8 years ago
@Lethailinh9999
That is not the values I get if run those coords through the functions:

coord =
[21.0688888889, 105.8125, -2]

map_coord =
((208122, 115372), (79, 46))

tile_coord =
[208122, 115372, -2]

path =
-2\203\250\112\684.png

See sample code here:
https://code.google.com/p/hs-scripts/source/browse/trunk/Python/coord.py

Original comment by heldersepu on 13 Mar 2014 at 1:44

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Thank you so much for your reply. But there is no folder named "203" in the 
folder named "-2". There is only one folder named "406" and the function in the 
link above get the MAP_MAX_ZOOM_LEVEL is 17. (  
http://code.google.com/p/gmapcatcher/source/browse/trunk/gmapcatcher/mapUtils.py
def coord_to_tile(coord))
Using this  constant i get the folder named "406" but the folder named "399".  

Original comment by Lethaili...@gmail.com on 14 Mar 2014 at 9:03

GoogleCodeExporter commented 8 years ago
You are correct the max zoom is 17, I made the correction to the script:
https://code.google.com/p/hs-scripts/source/browse/trunk/Python/coord.py

Here are the results I get now:

coord =
[21.0688888889, 105.8125, -2]

map_coord =
((416244, 230744), (159, 93))

tile_coord =
[416244, 230744, -2]

path =
-2\406\500\225\344.png

Original comment by heldersepu on 14 Mar 2014 at 1:36

GoogleCodeExporter commented 8 years ago
Thank you so much! I got the result i want. 

Original comment by Lethaili...@gmail.com on 15 Mar 2014 at 4:43

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi. I want to convert lat, lng, zoom to pixel coordinate in the tile i 
downloaded from gmapcatcher. As I have the image path-2\406\500\225\344.png, if 
i have a mark point, i want to know where it is in that image tile. I hope you 
will reply soon. Thank you so much!

Original comment by Lethaili...@gmail.com on 20 Mar 2014 at 7:02

GoogleCodeExporter commented 8 years ago
In the previous example
map_coord =
((416244, 230744), (159, 93))

that is (tile, offset)
the offset is the pixel coords withing that tile

If you truly want to thank, consider making a donation:
http://gmapcatcher.googlecode.com/svn/donate.html

Original comment by heldersepu on 20 Mar 2014 at 4:04