mapbox / supermercado

Supercharger for mercantile
MIT License
127 stars 21 forks source link

uniontiles.union should accept sequence of tuples or mercantile Tiles #39

Open sgillies opened 4 years ago

sgillies commented 4 years ago

I'm looking at some code which uses supermercado and is turning lists of numbers into strings just so supermercado can decode them into numbers again.

dnomadb commented 4 years ago

@sgillies I agree! This "better python api" is what I was alluding to here: https://github.com/mapbox/supermercado/issues/30#issuecomment-565649137

dnomadb commented 4 years ago

@sgillies looking back into this, I was reminded of what Damon-from-5-years-ago-was thinking: union optionally takes a "parsenames" option that would parse "tiley" strings: https://github.com/mapbox/supermercado/blob/6ce4e22f0eeb7801e5c700139b501fce56dac565/supermercado/uniontiles.py#L11. Two options:

  1. We remove this altogether and point to xt or equivalent docs
  2. We leave it and support strings only if parse_names is True
sgillies commented 4 years ago

@dnomadb I'd prefer option 1. I've done 2 for shapely and regretted it after a while. I like the example of Python's trig functions. These could all be, for example, def acos(x, is_degrees=False) but one kind of input and another method to convert inputs is the simplest to support in the long haul.