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
Geometry sequence as features #14
Conversation
if 'coordinates' in obj.keys(): | ||
return True | ||
else: | ||
return False |
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.
return 'coordinates' in obj
is the way to go here, yes?
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.
Yeah, return <boolean expression>
is definitely the way to go.
In terms of 'coordinates' in obj
vs coordinates in obj.keys()
: I prefer the explicit call to the keys
method because it enforces that the object is a mapping and won't match this is a geometry just because it has coordinates in the string
.
Yes, but check out the performance hit from calling >>> timeit.timeit(stmt="'coordinates' in obj", setup="obj={'coordinates': [0, 0]}")
0.04499248508363962
>>> timeit.timeit(stmt="'coordinates' in obj.keys()", setup="obj={'coordinates': [0, 0]}")
0.12553653097711504 |
So if |
@perrygeo yes to that. |
I had to resolve some merge conflicts and take a slightly different approach. @sgillies 👀 ? |
yield newfeat | ||
|
||
|
||
def to_feature(obj): |
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.
@perrygeo I've got no immediate use for what I'm about to suggest: but what about adding a properties
keyword argument to this function, the value of which would be copied to the result's properties
member?
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.
Could we punt on that and cover that use case with a more general tool like the proposed fio calc
?
@sgillies anything need to move on this before merging? |
This PR allows
@features_in_arg
to take a sequence of geometry objects on stdin and casts them to features with empty properties.Resolves #13