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 | |
polygons.*, | |
COUNT(points.*) | |
FROM polygons, points | |
WHERE ST_Intersects(points.the_geom, polygons.the_geom) |
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
import pandas as pd | |
from geopandas import GeoDataFrame, points_from_xy | |
import geopandas as gpd | |
import time | |
# Load the Uber point data | |
df = pd.read_csv('uber_all.csv') | |
# Create the GeoDataFrame and assign the proper projection |
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
-- written for PostGIS | |
-- table states is US State Polygons | |
-- table capitals are US State Capital points | |
select | |
a.name, | |
a.id, | |
-- create a centroid of the state polygon |
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
WITH | |
buildings AS ( | |
SELECT | |
id, | |
latitude, | |
longitude, | |
username, | |
osm_timestamp, | |
FROM | |
`bigquery-public-data.geo_openstreetmap.planet_nodes` |
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 | |
* | |
from | |
`bigquery-public-data.geo_us_boundaries.states` |
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 | |
state_geom, state_name, state | |
from | |
`bigquery-public-data.geo_us_boundaries.states` |
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 | |
* | |
from bigquery-public-data.geo_us_boundaries.state |
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 | |
state_geom, state_name, state | |
from | |
`bigquery-public-data.geo_us_boundaries.states` | |
limit 10 |
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 | |
state_geom, state_name, state | |
from | |
`bigquery-public-data.geo_us_boundaries.states` | |
limit 10 offset 10 |
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 | |
state_geom, state_name, state | |
from | |
`bigquery-public-data.geo_us_boundaries.states` | |
# this is a comment - it won't impact your code and you can delete it if you want | |
# use the where clause to select rows based on a condition | |
# in this case an exact match to where the state_name column equals Wisconsin |
OlderNewer