Skip to content
Permalink
Browse files
docs: fix Shapely import in GEOGRAPHY sample (#431)
  • Loading branch information
tswast committed Dec 9, 2020
1 parent dbc68b3 commit 96a1c5b3c72855ba6ae8c88dfd0cdb02d2faf909
Showing with 7 additions and 5 deletions.
  1. +4 −2 samples/geography/insert_wkt.py
  2. +3 −3 samples/geography/insert_wkt_test.py
@@ -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()
@@ -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)},
@@ -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.