# Project path on tiled surface

Here is the description.

• I do present earth as a Sphere.

• I've splitted the earth on tiles starting from latitude=0, longitude=0. Tile is a rectangle ~$50\times50$ kilometers.

• Tiles are "planar". That is why they are distorted when approaching to north pole.

• Tiles have transparent numeration. I do work with lat$[0,180]$, lon$[0,180]$.

• Each Tiles are enumerated from [0..79601]

• Each tile is splitted on zones.

• Each zone is enumerated in tile like a matrix: [0, 0] .. [x,y]

• Zone is a rectangle ~$100\times100$ meters.

• If I want to get unique address of zone I need to have three variables: tile_id[0..79601], zone_col[0..x], zone_row[0..y]

• I have two GeoSpatial points start(lat, lon) and end(lat, lon). Points start, end can be located in different tiles.

I need to create a list of zones crossed by line between start, end. Is there any algorithm for such task? Thank you!

• Is your earth a sphere? – OR. Jul 19 '13 at 12:30
• Yes, it is a Sphere. – Sergey Jul 19 '13 at 12:42
• The path is going to be a circle passing through the center and the two points. Then you have to find the intersection points [between the points you want] of that circle with the parallels and meridians. That gives you the tiles you want. – OR. Jul 19 '13 at 12:52
• I have custom tiles. The demension of each tile changes because Earth is Sphere. That is why planar tiles distortion when approaching to north pole. I each of tile is splitted on zones. I need to get all zones crossed by line with lat,lon coordinates. Looks like i need to fix my problem description. Sorry. :( – Sergey Jul 19 '13 at 13:02
• I find your description still hard to understand. Most prominently, your description of tiles or zones being approximately such and such square does not help much in decoding where exactly they lie. Your enumeration of 79601 tiles is completely obscure to me. How many zones will there be for every tile, i.e. what is $x$ and $y$? Why do you only have 180° of longitude, not 360°, and why does latitude range [0°,180°] not [-90°,90°] for you? It might be useful if you could write down an algorithm which computes the zone address for arbitrary input coordinates. – MvG Jul 20 '13 at 20:32

Sorr for wasting your time. Looks like I'm bad story-teller. I've solved the problem using http://docs.geotools.org/latest/userguide/library/jts/ I've created:

1. Function which converts any (lat, lon) GeoSpatial point to (tile_id, zone_col, zone_row).
2. Function which converts any [(lat, lon),(lat, lon)] to planar [(x,y)(x,y)]. Geotools JTS works in cartesian.
3. Function for JTS which creates a set of points lying on one line between any two planar points
4. Function which converts (x,y) to (lat,lon)

So the solution is pseudo-python code:

list_of_planar_points = generate_planar_points_between(lon1, lat1, lon2, lat2, step=100_Meters)
list_of_tile_zone_col_rows = []
for planar_point in list_of_planar_points:
list_of_tile_zone_col_rows << geo_spatial_to_tile_zone(planar_to_geo_spatial(planar_point))