New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test geopandas #214
Test geopandas #214
Conversation
… into test_geopandas
1 similar comment
cartoframes/context.py
Outdated
@@ -174,7 +174,7 @@ def write(self, df, table_name, temp_dir='/tmp', overwrite=False, | |||
|
|||
if encode_geom: | |||
# enforce that geodataframe CRS is 4326 | |||
df = df.to_crs({'init':'epsg:4326'}) | |||
df.crs = {'init':'epsg:4326'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this what re-projections look like?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe so. I'm going to add a test!
Changes Unknown when pulling c5bfd65 on test_geopandas into ** on master**. |
1 similar comment
Changes Unknown when pulling c5bfd65 on test_geopandas into ** on master**. |
Changes Unknown when pulling 7cf0dfd on test_geopandas into ** on master**. |
Changes Unknown when pulling 08769d4 on test_geopandas into ** on master**. |
6 similar comments
Changes Unknown when pulling 08769d4 on test_geopandas into ** on master**. |
Changes Unknown when pulling 08769d4 on test_geopandas into ** on master**. |
Changes Unknown when pulling 08769d4 on test_geopandas into ** on master**. |
Changes Unknown when pulling 08769d4 on test_geopandas into ** on master**. |
Changes Unknown when pulling 08769d4 on test_geopandas into ** on master**. |
Changes Unknown when pulling 08769d4 on test_geopandas into ** on master**. |
@michellemho, could you resolve the conflicts here? |
Finally got around to this! I needed these geometry encoding changes to be merged in so I can use CARTOframes with some of the GPS work! |
Great, I'll take a look this week and let's get it merged in finally!! |
@@ -39,6 +39,13 @@ | |||
mpi = None | |||
plt = None | |||
HAS_MATPLOTLIB = plt is not None | |||
try: | |||
import geopandas | |||
from shapely.geometry import Point |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we don't need geopandas
or shapely.geometry.Point
anywhere in cartoframes
, how about testing whether they can be imported other than importing them.
Looks like there's a way to do that here: https://stackoverflow.com/questions/14050281/how-to-check-if-a-python-module-exists-without-importing-it
We'd probably need an:
if version.major_version == 2:
python2.7 version
elfi version.version < (3, 3):
python3.3ish version
elif version.version >= (3, 4):
python3.4+ stuff
else:
HAS_GEOPANDAS = False
|
||
if encode_geom: | ||
if not HAS_GEOPANDAS: | ||
raise RuntimeError('geopandas and shapely needs to be installed to use `encode_geom`') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about:
'
shapely
(orgeopandas
) needs to be installed if using theencode_geom
flag'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe this is better:
Install
shapely
>= vx.x.x (orgeopandas
>= vy.y.y) to enable geometry encoding
Since we already have |
Yep! |
This PR tests trying to write a geodataframe with different arguments
closes #201
closes #182