Deterministic spatial analysis is an important component of computational approaches to problems in agriculture, ecology, epidemiology, sociology, and many other fields. What is the surveyed perimeter/area ratio of these patches of animal habitat? Which properties in this town intersect with the 50-year flood contour from this new flooding model? What are the extents of findspots for ancient ceramic wares with maker’s marks “A” and “B”, and where do the extents overlap? What’s the path from home to office that best skirts identified zones of location based spam? These are just a few of the possible questions addressable using non-statistical spatial analysis, and more specifically, computational geometry.
确定性的空间分析是解决农业、生态学、流行病学、社会学和其他许多领域问题的计算方法的重要组成部分。这些成片的动物栖息地的调查周长/面积比率是多少?这个镇的哪些房产与这个新的洪水模型的50年一遇洪水等值线相交?带有标记 “A “和 “B “的古代陶瓷器皿的发现点的范围是什么,以及这些范围在哪里重叠?从家到办公室的路径是什么,可以最好地绕过已确定的基于位置的垃圾区域?这些只是使用非统计空间分析,更具体地说,计算几何学可能解决的几个问题。
Shapely is a Python package for set-theoretic analysis and manipulation of planar features using (via Python’s ctypes
module) functions from the well known and widely deployed GEOS library. GEOS, a port of the Java Topology Suite (JTS), is the geometry engine of the PostGIS spatial extension for the PostgreSQL RDBMS. The designs of JTS and GEOS are largely guided by the Open Geospatial Consortium’s Simple Features Access Specification [1] and Shapely adheres mainly to the same set of standard classes and operations. Shapely is thereby deeply rooted in the conventions of the geographic information systems (GIS) world, but aspires to be equally useful to programmers working on non-conventional problems.
Shapely是一个Python包,用于平面特征的集合论分析和操作,使用(通过Python的ctypes模块)众所周知的、广泛部署的GEOS库中的函数。GEOS是Java拓扑套件(JTS)的一个移植,是PostgreSQL RDBMS的PostGIS空间扩展的几何引擎。JTS和GEOS的设计在很大程度上受开放地理空间联盟的简单特征访问规范[1]的指导,Shapely遵循同一套标准类和操作。因此,Shapely深深植根于地理信息系统(GIS)世界的惯例,但希望对从事非传统问题的程序员同样有用。
The first premise of Shapely is that Python programmers should be able to perform PostGIS type geometry operations outside of an RDBMS. Not all geographic data originate or reside in a RDBMS or are best processed using SQL. We can load data into a spatial RDBMS to do work, but if there’s no mandate to manage (the “M” in “RDBMS”) the data over time in the database we’re using the wrong tool for the job. The second premise is that the persistence, serialization, and map projection of features are significant, but orthogonal problems. You may not need a hundred GIS format readers and writers or the multitude of State Plane projections, and Shapely doesn’t burden you with them. The third premise is that Python idioms trump GIS (or Java, in this case, since the GEOS library is derived from JTS, a Java project) idioms.
Shapely的第一个前提是,Python程序员应该能够在RDBMS之外执行PostGIS类型的几何操作。并非所有的地理数据都起源于或驻留在RDBMS中,或者最好使用SQL来处理。我们可以将数据加载到空间RDBMS中进行工作,但如果没有任务来管理(RDBMS中的 “M”)数据库中的数据,我们就会使用错误的工具来完成工作。第二个前提是,特征的持久性、序列化和地图投影是重要的,但却是正交的问题。你可能不需要一百个GIS格式的读写器或众多的国家平面投影,Shapely也不会给你带来负担。第三个前提是Python的习惯用法胜过GIS(或者说Java,因为GEOS库来自于JTS,一个Java项目)的习性。
If you enjoy and profit from idiomatic Python, appreciate packages that do one thing well, and agree that a spatially enabled RDBMS is often enough the wrong tool for your computational geometry job, Shapely might be for you.
如果你喜欢并受益于惯用的Python,欣赏能很好地完成一件事的包,并同意支持空间的RDBMS经常是您计算几何工作的错误工具,那么Shapely可能适合您。