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
| CREATE OR REPLACE FUNCTION public.geocode_google(IN inaddress text, OUT address text, OUT longitude double precision, OUT latitude double precision) | |
| RETURNS record AS | |
| $BODY$ | |
| from geopy.geocoders import GoogleV3 | |
| geolocator = GoogleV3() | |
| try: | |
| address, (latitude, longitude) = geolocator.geocode(inaddress,timeout=1,exactly_one=True) | |
| return address, longitude, latitude | |
| except: | |
| return None, None, None |
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
| CREATE OR REPLACE FUNCTION everynseconds(geometry, integer) | |
| RETURNS geometry AS | |
| $BODY$ | |
| SELECT | |
| st_makeline(st_locate_along_measure($1,g)) | |
| FROM | |
| generate_series(0,floor(st_m(st_endpoint($1)))::int,$2) g; | |
| $BODY$ | |
| LANGUAGE sql; |
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
| select | |
| parcel_id, | |
| address, | |
| st_distance(geom,'SRID=3005;POINT(1011102 450541)') as distance | |
| from | |
| parcels | |
| where | |
| geom && ( | |
| select | |
| st_extent(geom) |
NewerOlder