Skip to content
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

Search for geovector feature by attribute #18

Closed
bhbraswell opened this issue Jun 5, 2015 · 1 comment
Closed

Search for geovector feature by attribute #18

bhbraswell opened this issue Jun 5, 2015 · 1 comment

Comments

@bhbraswell
Copy link
Member

In Python I am manually searching through features to find the one I want:

def find_geometry(self, attribute, value):
    for fid in self.get_fids():
        feature = self.get_geom(fid)
        if value == self.get_attribute(fid, attribute):
            return self.get_geom(fid)
    return None

But I'm wondering if it's possible to do this more efficiently within gippy.

@matthewhanson
Copy link
Member

Yes if I understand correctly. Open up your db or shapely with gippy.GeoVector

Then you can use the where member function to filter based on any attribute and value. It's much faster than retrieving all values and filtering in python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants