Skip to content

Commit d11f5f6

Browse files
jdmcbrjorisvandenbossche
authored andcommitted
TST: Add CRS mismatch warning to cython branch (geopandas#584)
1 parent c549cdb commit d11f5f6

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

geopandas/tools/sjoin.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import absolute_import, division, print_function
2+
from warnings import warn
23

34
from warnings import warn
45

geopandas/tools/tests/test_sjoin.py

+22-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
Polygon([(random.random(), random.random()) for i in range(3)]) for _ in range(10)
1919
]
2020

21-
2221
points = [Point(random.random(), random.random()) for _ in range(20)]
2322

2423

@@ -93,6 +92,28 @@ def test_sjoin(op, lsuffix, rsuffix, how, missing):
9392
assert any(p.equals(p2) for p2 in L)
9493

9594

95+
def test_crs_mismatch():
96+
left = gpd.GeoDataFrame(
97+
{
98+
"geometry": triangles,
99+
"x": np.random.random(len(triangles)),
100+
"y": np.random.random(len(triangles)),
101+
},
102+
crs={"init": "epsg:4326"},
103+
)
104+
105+
right = gpd.GeoDataFrame(
106+
{
107+
"geometry": points,
108+
"x": np.random.random(len(points)),
109+
"z": np.random.random(len(points)),
110+
}
111+
)
112+
113+
with pytest.warns(UserWarning):
114+
sjoin(left, right)
115+
116+
96117
def test_errors():
97118
left = GeoDataFrame(
98119
{

0 commit comments

Comments
 (0)