- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我从谷歌地图方向 API 计算了线串。我将线串转换为 GEOSGeometry 对象。我需要另一个区域,该区域覆盖距线串对象距离为“d”的所有点。距离单位为米、公里。GEOS API 提供了 GEOSGeometry.buffer(width,quadsegs=8) 来执行此操作,这在 2D 投影中效果很好。
但是对于球形模型如何做到这一点?是否与SRID有关。
from django.contrib.gis.geos import LineString
from django.contrib.gis.geos import GEOSGeometry
directions = maps_client.directions(source, destination)
overview_polyline = decode_polyline(directions[0]['overview_polyline'])
linestring_obj = LineString(overview_polyline)
# FOR 2-D projection
bounding_box = linestring_obj.buffer(width=100)
# For spherical model
# ???
最佳答案
为了使以米为单位的地理距离有意义,您始终必须经过投影坐标系,因此我建议您将数据转换为投影坐标系,创建缓冲区并将其投影回来。例如:
# Specify the original srid of your data
orig_srid = 4326
# Create the linestring with the correct srid
linestring_obj = LineString(overview_polyline, srid=orig_srid)
# Transform (project) the linestring into a projected coorinate system
linestring_obj.transform(3857)
# Compute bbox in in that system
bounding_box = linestring_obj.buffer(width=100)
# Transform bounding box into the original coorinate system of your data
bounding_box.transform(orig_srid)
关于python - 计算包含地理坐标的线串的边界框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27901923/
我正在尝试创建一个程序,其中字符串的前三个字符重复给定次数,如下所示: foo('Chocolate', 3) # => 'ChoChoCho' foo('Abc', 3) # => 'AbcAbcA
我有以下字符串: std::string str = "Mode:AAA:val:101:id:A1"; 我想分离一个位于 "val:" 和 ":id" 之间的子字符串,这是我的方法: std::st
DNA 字符串可以是任意长度,包含 5 个字母(A、T、G、C、N)的任意组合。 压缩包含 5 个字母(A、T、G、C、N)的 DNA 字母串的有效方法是什么?不是考虑每个字母表 3 位,我们可以使用
是否有一种使用 levenstein 距离将一个特定字符串与第二个较长字符串中的任何区域进行匹配的好方法? 例子: str1='aaaaa' str2='bbbbbbaabaabbbb' if str
使用 OAuth 并使用以下函数使用我们称为“foo”(实际上是 OAuth token )的字符串加密 key public function encrypt( $text ) { // a
我是一名优秀的程序员,十分优秀!