Sean Gillies (Posts about gis)https://sgillies.net/tags/gis.atom2023-12-31T01:26:22ZSean GilliesNikolaShapely 1.8.0https://sgillies.net/2021/10/26/shapely-1-8-0.html2021-10-26T08:29:27-06:002021-10-26T08:29:27-06:00Sean Gillies<p>From the 1.8.0 <a class="reference external" href="https://github.com/Toblerity/Shapely/releases/tag/1.8.0">release notes</a>:</p>
<blockquote>
<p>Shapely 1.8.0 is a transitional version. There are a few bug fixes and new
features, but it largely exists to warn about the upcoming changes in
2.0.0. See the new migration guide for more details on how to update your
code from Shapely 1.8 to 2.0.</p>
</blockquote>
<p>One of the upcoming changes: the geometry objects of 2.0 will be immutable,
simplifying their implementation, and making it possible to hash them.
Here's an example of the warning you'll see when you set a new attribute on
a version 1.8 geometry object.</p>
<div class="code"><pre class="code pycon"><a id="rest_code_6a3f141e2ef04d379b86ee931f93820e-1" name="rest_code_6a3f141e2ef04d379b86ee931f93820e-1" href="https://sgillies.net/2021/10/26/shapely-1-8-0.html#rest_code_6a3f141e2ef04d379b86ee931f93820e-1"></a><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">shapely.geometry</span> <span class="kn">import</span> <span class="n">Point</span>
<a id="rest_code_6a3f141e2ef04d379b86ee931f93820e-2" name="rest_code_6a3f141e2ef04d379b86ee931f93820e-2" href="https://sgillies.net/2021/10/26/shapely-1-8-0.html#rest_code_6a3f141e2ef04d379b86ee931f93820e-2"></a><span class="gp">>>> </span><span class="n">pt</span> <span class="o">=</span> <span class="n">Point</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
<a id="rest_code_6a3f141e2ef04d379b86ee931f93820e-3" name="rest_code_6a3f141e2ef04d379b86ee931f93820e-3" href="https://sgillies.net/2021/10/26/shapely-1-8-0.html#rest_code_6a3f141e2ef04d379b86ee931f93820e-3"></a><span class="gp">>>> </span><span class="n">pt</span><span class="o">.</span><span class="n">id</span> <span class="o">=</span> <span class="mi">1</span>
<a id="rest_code_6a3f141e2ef04d379b86ee931f93820e-4" name="rest_code_6a3f141e2ef04d379b86ee931f93820e-4" href="https://sgillies.net/2021/10/26/shapely-1-8-0.html#rest_code_6a3f141e2ef04d379b86ee931f93820e-4"></a><span class="go"><stdin>:1: ShapelyDeprecationWarning: Setting custom attributes on geometry objects is deprecated, and will raise an AttributeError in Shapely 2.0</span>
</pre></div>Shapely 1.7.0https://sgillies.net/2020/02/04/shapely-1-7-0.html2020-02-04T19:20:15-07:002020-02-04T19:20:15-07:00Sean Gillies<p>At long last, Shapely 1.7.0 is done. We have wheels on PyPI, wheels that
include GEOS 3.8.0, <a class="reference external" href="https://pypi.org/project/Shapely/1.7.0/#files">wheels for Manylinux1, OS X, and Windows</a>. The changes since 1.6.4 are
all listed in the <a class="reference external" href="https://github.com/Toblerity/Shapely/blob/master/CHANGES.txt#L4-L88">change log</a>.</p>
<p>There are now 96 people named in <a class="reference external" href="https://github.com/Toblerity/Shapely/blob/master/CREDITS.txt">Shapely's credits</a>. Special
1.7.0 thanks to Joris Van den Bossche and the GeoPandas project for pre-release
testing and to Mike Taves for putting the finishing touches on the project's
AppVeyor configuration and Windows wheel building infrastructure.</p>
<p>Stay tuned for more news.</p>Fiona discussion groupshttps://sgillies.net/2019/03/20/fiona-discussion-groups.html2019-03-20T11:29:27-06:002019-03-20T11:29:27-06:00Sean Gillies<p>The Fiona project now has brand-new, old-fashioned <a class="reference external" href="https://fiona.groups.io/g/main">users</a> and <a class="reference external" href="https://fiona.groups.io/g/dev">developers</a> discussion groups on groups.io. The former
is for support, the latter is for project planning. Please subscribe to one or
both of these if you'd like to receive announcements, help your fellow Fiona
users, or contribute to the further development of the package. Thanks!</p>GIS Stack Exchange at its besthttps://sgillies.net/2017/12/05/gis-se-at-its-best.html2017-12-05T10:20:11-07:002017-12-05T10:20:11-07:00Sean Gillies<p>A clear and intriguing question, no overzealous moderation, and an excellent
answer. This is the <a class="reference external" href="https://gis.stackexchange.com/questions/264150/how-to-split-a-shapely-polygon-with-two-linestrings-and-get-the-middle-polygon">GIS Stack Exchange at its best</a>.</p>New home for rasteriohttps://sgillies.net/2014/01/29/new-home-for-rasterio.html2014-01-29T00:00:00-07:002014-01-29T00:00:00-07:00Sean Gillies<p>As it's getting more use at work, I've <a class="reference external" href="https://github.com/mapbox/rasterio/issues/25">moved rasterio</a> to Mapbox's GitHub
organization and wrote about it on the <a class="reference external" href="https://www.mapbox.com/blog/rasterio-announce/">Mapbox blog</a>. Mapbox is probably known more
for Javascript, but has a lot of Python programs running at any moment and more in
development.</p>
<p>What do I mean when I write that rasterio is Python software, not GIS software?
There is GIS software under the hood, obviously, and rasterio would be nowhere
without the excellent <a class="reference external" href="http://www.gdal.org">GDAL</a> library. What I mean is
that whenever faced with a design choice between the way something would be
done in a name brand GIS program and the way it would be done in Python,
I always choose the Python way. That means I/O is done via file-like objects.
That means no reliance on <a class="reference external" href="http://sgillies.net/blog/2013/12/17/teaching-python-gis-users-to-be-more-rational.html">side effects</a>.
Python dicts instead of GIS-specific types or microformatted strings. It means
embracing Python idioms and protocols. Making things iterable and zip-able. It
means <a class="reference external" href="http://www.python.org/dev/peps/pep-0008/">PEP 8</a> and <a class="reference external" href="http://www.python.org/dev/peps/pep-0020/">PEP 20</a>.</p>
<p>This is not to say that I think Python is the best language for every
application or that Python language design is always right. I'm increasingly
a polyglot and I expect that you are, too, or will be soon. It seems clear to
me that one of the main keys to successful polyglot programming isn't using
interfaces that stick to the common features of languages, it's using the best
parts of various languages to their fullest. I believe this means idiomatic
Javascript in your Javascript programs (for example) and idiomatic Python in
your Python programs. Celebrating Python is what I'm doing to make rasterio
a better tool for polyglots.</p>
<p>Bill Dollins <a class="reference external" href="http://blog.geomusings.com/2013/11/27/consider-the-alternative/">recently wrote about some of the characteristics of GIS software</a>, and
here is the crux of it:</p>
<blockquote>
<p>So I have come to realize that the mainstream GIS community has become very
much like my professor’s theoretical cat; conditioned to take the long way to
the end result when more direct paths are clearly available. What’s more,
they have become conditioned to think of such approaches as normal.</p>
</blockquote>
<p>Python, on the other hand, is supposed to be direct, highly productive, and fun.
I've chosen to make rasterio less like the GIS software Bill wrote about and
more like ElementTree, simplejson, Requests, pytest, and Numpy – packages that
make the most of Python's strengths.</p>
<p>By the way, I wrote to the Python Software Foundation's Trademark Committee to
make extra sure that my derived work (the GeoJSON file at
<a class="reference external" href="https://gist.github.com/sgillies/8655640#file-python-powered-json">https://gist.github.com/sgillies/8655640#file-python-powered-json</a>) was legit,
and received a very clear and friendly response from David Mertz in the
affirmative. I've been a reader of his articles for years and it was a pleasure
to correspond with him at last. Python isn't just a great language, it's great
people.</p>