supermercado icon indicating copy to clipboard operation
supermercado copied to clipboard

uniontiles.union should accept sequence of tuples or mercantile Tiles

Open sgillies opened this issue 5 years ago • 3 comments

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.

sgillies avatar Oct 05 '20 16:10 sgillies

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

dnomadb avatar Oct 05 '20 23:10 dnomadb

@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

dnomadb avatar Oct 07 '20 22:10 dnomadb

@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.

sgillies avatar Oct 14 '20 20:10 sgillies