make GeometryIndexed slicing even faster
This commit is contained in:
parent
624d6f281c
commit
d0a4a71118
1 changed files with 5 additions and 5 deletions
10
src/c3nav/mapdata/utils/cache/indexed.py
vendored
10
src/c3nav/mapdata/utils/cache/indexed.py
vendored
|
@ -146,12 +146,12 @@ class GeometryIndexed:
|
|||
maxy = int(math.ceil(yy.stop / self.resolution))
|
||||
|
||||
height, width = self.data.shape
|
||||
minx = max(self.x, min(self.x + width, minx)) - self.x
|
||||
miny = max(self.y, min(self.y + height, miny)) - self.y
|
||||
maxx = max(self.x, min(self.x + width, maxx)) - self.x
|
||||
maxy = max(self.y, min(self.y + height, maxy)) - self.y
|
||||
minx = max(0, minx - self.x)
|
||||
miny = max(0, miny - self.y)
|
||||
maxx = max(0, maxx - self.x)
|
||||
maxy = max(0, maxy - self.y)
|
||||
|
||||
return self.data[miny:maxy, minx:maxx].flatten()
|
||||
return self.data[miny:maxy, minx:maxx].ravel()
|
||||
|
||||
from shapely.geometry.base import BaseGeometry
|
||||
if isinstance(key, BaseGeometry):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue