Last active
December 27, 2015 14:09
-
-
Save knownasilya/7338955 to your computer and use it in GitHub Desktop.
filter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
geom = models.MultiPolygonField(srid=4326, null=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
neighborhoodBounds = Polygon.from_bbox(data['neighborhoodBounds'].split(',')) | |
neighborhoodBounds.srid = 4326 | |
#print neighborhoodBounds | |
#POLYGON ((40.8116690000000020 -73.9644080000000059, 40.8116690000000020 -73.9349679999999978, 40.8355379999999997 -73.9349679999999978, 40.8355379999999997 -73.9644080000000059, 40.8116690000000020 -73.9644080000000059)) | |
# No results.. | |
filtered = BuildingData.objects.filter(geom__within = neighborhoodBounds) | |
# Doesn't work either: | |
#select bd.bin from buildings_buildingdata as bd | |
#where bin = 2082444 AND ST_Within(bd.geom, | |
#ST_GeometryFromText('POLYGON ((40.8408170000000013 -73.7898320000000041, 40.8408170000000013 -73.7797680000000042, 40.8467830000000021 -73.7797680000000042, 40.8467830000000021 -73.7898320000000041, 40.8408170000000013 -73.7898320000000041))')); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment