X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=src%2Fgis-tile.c;h=d92f7b5adac78280ddad75e8be2a1a3ebaca530e;hb=10671a702a73850f66173d0ddc0632b768affb7e;hp=e265e05342b12c1bb2d8d07d60a4ccf30e4edfb3;hpb=a2a902d978b6050289f7a92794fb1dc0aa2b5e26;p=grits diff --git a/src/gis-tile.c b/src/gis-tile.c index e265e05..d92f7b5 100644 --- a/src/gis-tile.c +++ b/src/gis-tile.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Andy Spencer + * Copyright (C) 2009-2010 Andy Spencer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -142,6 +142,13 @@ GisTile *gis_tile_find(GisTile *self, gdouble lat, gdouble lon) gint row = lat_offset / lat_step; gint col = lon_offset / lon_step; + if (lon == 180) col--; + if (lat == -90) row--; + + //if (lon == 180 || lon == -180) + // g_message("lat=%f,lon=%f step=%f,%f off=%f,%f row=%d/%d,col=%d/%d", + // lat,lon, lat_step,lon_step, lat_offset,lon_offset, row,rows,col,cols); + if (row < 0 || row >= rows || col < 0 || col >= cols) return NULL; else if (self->children[row][col] && self->children[row][col]->data)