Skip to content

Commit 46629e4

Browse files
authored
Merge pull request #102 from tilezen/correct-readme-code
Correct the README django code
2 parents 879569a + 51b7758 commit 46629e4

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,13 @@ If you have geometries in longitude and latitude (EPSG:4326), you can convert to
127127
(x0, y0, x_max, y_max) = tile_bounds.extent
128128
x_span = x_max - x0
129129
y_span = y_max - y0
130-
def xy_pairs():
131-
for x_merc, y_merc in line:
132-
yield (
133-
int((x_merc - x0) * MVT_EXTENT / x_span),
134-
int((y_merc - y0) * MVT_EXTENT / y_span),
130+
131+
tile_based_coords = []
132+
for x_merc, y_merc in line:
133+
tile_based_coord = (int((x_merc - x0) * MVT_EXTENT / x_span),
134+
int((y_merc - y0) * MVT_EXTENT / y_span))
135+
tile_based_coords.append(tile_based_coord)
136+
return LineString(*tile_based_coords)
135137
```
136138

137139
The tile bounds can be found with `mercantile`, so a complete usage example might look like this:

0 commit comments

Comments
 (0)