Skip to content

Commit

Permalink
docs: fix Shapely import in GEOGRAPHY sample (#431)
Browse files Browse the repository at this point in the history
  • Loading branch information
tswast committed Dec 9, 2020
1 parent dbc68b3 commit 96a1c5b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions samples/geography/insert_wkt.py
Expand Up @@ -16,7 +16,7 @@
def insert_wkt(override_values={}):
# [START bigquery_insert_geography_wkt]
from google.cloud import bigquery
import shapely
import shapely.geometry
import shapely.wkt

bigquery_client = bigquery.Client()
Expand All @@ -32,7 +32,9 @@ def insert_wkt(override_values={}):

# Use the Shapely library to generate WKT of a line from LAX to
# JFK airports. Alternatively, you may define WKT data directly.
my_geography = shapely.LineString([(-118.4085, 33.9416), (-73.7781, 40.6413)])
my_geography = shapely.geometry.LineString(
[(-118.4085, 33.9416), (-73.7781, 40.6413)]
)
rows = [
# Convert data into a WKT string.
{"geo": shapely.wkt.dumps(my_geography)},
Expand Down
6 changes: 3 additions & 3 deletions samples/geography/insert_wkt_test.py
Expand Up @@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from . import insert_geojson
from . import insert_wkt


def test_insert_geojson(table_id):
errors = insert_geojson.insert_geojson(override_values={"table_id": table_id})
def test_insert_wkt(table_id):
errors = insert_wkt.insert_wkt(override_values={"table_id": table_id})
assert not errors

0 comments on commit 96a1c5b

Please sign in to comment.