Skip to content

Doesn't recognize WKT MultiLineString type #22

Open

Description

@tschomay

Theto throws an error when attempting to plot a MultiLineString well known text data type. MWE below:

wkts = ['MULTILINESTRING ((0 0, 1 1), (2 0, 2 1))']
(
    Theto(api_key=None)
    .add_source(wkts, label='a')
    .prepare_plot(plot_width=400, map_type='carto_light')
    .add_layer('a', fill_color='yellow', line_color='black', alpha=0.5)
    .render_plot('notebook')
)

The following error is produced:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-2-07450c06b8a0> in <module>
      5 (
      6     Theto(api_key=None)
----> 7     .add_source(wkts, label='a')
      8     .prepare_plot(plot_width=400, map_type='carto_light')
      9     .add_layer('a', fill_color='yellow', line_color='black', alpha=0.5)

/opt/maxpoint/envs/analysis-preview-py3-115.0-5968/lib/python3.6/site-packages/theto/theto.py in add_source(self, data, label, uid, column_name, **kwargs)
    256             processed_data = [coordinate_utils.import_geojson(v, self.precision) for v in raw_data]
    257         else:
--> 258             processed_data = [coordinate_utils.process_input_value(v) for v in raw_data]
    259 
    260         processed_data_transformed = [coordinate_utils.to_webmercator(v) for v in processed_data]

/opt/maxpoint/envs/analysis-preview-py3-115.0-5968/lib/python3.6/site-packages/theto/theto.py in <listcomp>(.0)
    256             processed_data = [coordinate_utils.import_geojson(v, self.precision) for v in raw_data]
    257         else:
--> 258             processed_data = [coordinate_utils.process_input_value(v) for v in raw_data]
    259 
    260         processed_data_transformed = [coordinate_utils.to_webmercator(v) for v in processed_data]

/opt/maxpoint/envs/analysis-preview-py3-115.0-5968/lib/python3.6/site-packages/theto/coordinate_utils.py in process_input_value(value)
    288             return loads(value)
    289         else:
--> 290             raise ValueError('String inputs must be either a geohash or well-known text.')
    291     elif type(value) in (tuple, list):
    292         if validate_latlon_pair(value):

ValueError: String inputs must be either a geohash or well-known text.

Activity

  1. schaunwheeler commented on Apr 24, 2020

    @schaunwheeler
    Contributor

    There's a typo in Theto.coordinate_utils:

    VALID_WKT_TYPES = [
        'GEOMETRY', 
        'POINT', 
        'MULTIPOINT', 
        'LINESTRING',
        'LINEARRING'
        'MULTILINESTRING', 
        'POLYGON', 
        'MULTIPOLYGON'
    ]
    

    There's a comma missing after 'LINEARRING'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions