引用https://github.com/Toblerity/Shapely/issues/190

The point returned is the nearest point on the line to the original point. The nearest point is not necessarily an existing vertex in the LineString, and in this case it isn't.

end = Point(19.125150,72.893218)
np = Point(19.12493833590478, 72.89314854771877)
expected = Point(19.124929, 72.893177) print end.distance(np) # 0.000222767386696
print end.distance(expected) # 0.000224770994572

If you want to find the nearest vertex you should first convert the LineString to a MultiPoint geometry, then use the nearest_points operation (note the minor floating point error):

from shapely.ops import nearest_points
from shapely.geometry import MultiPoint
mp = MultiPoint(route)
print nearest_points(mp, end)[0] # POINT (19.124929 72.89317699999999)

This query requires calculating the distance between the original point and each vertex in the original linestring.

直线上距离最近的点,不等于定义时用的vertix

而要得到最近的vertix,关键的思路是把Linestring“退化“成vertix的MultiPoint,退化回"点对点"距离问题,就OK了。

the nearest point/vertex point of linestring的更多相关文章

  1. Codeforces Round #382 (Div. 2)E. Ostap and Tree

    E. Ostap and Tree time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  2. ●洛谷P3233 [HNOI2014]世界树

    题链: https://www.luogu.org/problemnew/show/P3233题解: 虚树,dp,倍增. 首先对于每个询问,要把虚树建出来,这一步就从略了.这里着重分享一下如何求答案. ...

  3. Codeforces 735 E Ostap and Tree

    Discription Ostap already settled down in Rio de Janiero suburb and started to grow a tree in his ga ...

  4. Shader Model 3.0:Using Vertex Textures SM3:使用顶点纹理 (NVIDIA spec, 6800支持使用D3DFMT_R32F and D3DFMT_A32B32G32R32F的纹理格式实现Vertex Texture。)

    翻译者 周波 zhoubo22@hotmail.com 版权所有 Philipp Gerasimov Randima (Randy) Fernando Simon Green NVIDIA Corpo ...

  5. Using Vertex Texture Displacement for Realistic Water Rendering

    http://blog.csdn.net/soilwork/article/details/709869 Using Vertex Texture Displacement for Realistic ...

  6. Nearest neighbor graph | 近邻图

    最近在开发一套自己的单细胞分析方法,所以copy paste事业有所停顿. 实例: R eNetIt v0.1-1 data(ralu.site) # Saturated spatial graph ...

  7. Codeforces1110F Nearest Leaf dfs + 线段树 + 询问离线

    Codeforces1110F dfs + 线段树 + 询问离线 F. Nearest Leaf Description: Let's define the Eulerian traversal of ...

  8. CSharpGL(38)带初始数据创建Vertex Buffer Object的情形汇总

    CSharpGL(38)带初始数据创建Vertex Buffer Object的情形汇总 开始 总的来说,OpenGL应用开发者会遇到为如下三种数据创建Vertex Buffer Object的情形: ...

  9. OpenGL中glVertex、显示列表(glCallList)、顶点数组(Vertex array)、VBO及VAO区别

    OpenGL中glVertex.显示列表(glCallList).顶点数组(Vertex array).VBO及VAO区别 1.glVertex 最原始的设置顶点方法,在glBegin和glEnd之间 ...

随机推荐

  1. [Python3] 035 函数式编程 高阶函数

    目录 函数式编程 之 高阶函数 1. 引子 2. 系统提供的高阶函数 3. functools 包提供的 reduce 4. 排序 函数式编程 之 高阶函数 把函数作为参数使用的函数,叫高阶函数 1. ...

  2. JAVA验证

    1.一个JAVA类只能有一个主类. 2.main()方法返回值改为int,不能运行 3.变量作用域有限 实例: 4.数值类型在内存中直接存储其本身的值,对于不同的数值类型,内存中会分配相应的大小去存储 ...

  3. ubuntu 18.04 配置notebook远程连接的坑

    jupyter-notebook的安装不在此说明 在网上搜了很多方案都不行,好不容易从坑里爬出来 以下为远程连接配置方法 1.生成配置文件 jupyter notebook --generate-co ...

  4. 完全删除MySQL及相关软件

    一.删除mysql服务 个人认为首先删除mysql服务最重要,这个多数人会忘记如何删除 首先是查看自己的mysql服务名,需要用这个服务名进行删除 进入命令行 二.卸载mysql,workbench等 ...

  5. 第一章 T-SQL查询和编程基础 T-SQL语言基础(1)

    T-SQL查询和编程基础(1) 1.1 理论背景 SQL是为查询和管理关系型数据库管理系统(RDBMS)中的数据而专门设计的一种标准语言. RDBMS是一种基于关系模型的数据库管理系统,关系模型则是一 ...

  6. .Net高并发解决思路

    转自: 本文如有不对之处,欢迎各位拍砖扶正.另源码在文章最下面,大家下载过后先还原一下nuget包,需要改一下redis的配置,rabbitmq的配置以及Ef的连接字符串.另外使用的是CodeFirs ...

  7. qt treaview项checkbox样式

    QTreeView::indicator:enabled:checked { /** 指示器 - 选中 **/ image: url(yzfx/checkbox_checked.png);}QTree ...

  8. k8s弹性伸缩概念以及测试用例

    k8s弹性伸缩概念以及测试用例 本文原文出处:https://juejin.im/post/5c82367ff265da2d85330d4f 弹性伸缩式k8s中的一大亮点功能,当负载大的时候,你可以对 ...

  9. Spring Cloud netflix 概览和架构设计

    pring Cloud是基于Spring Boot的一整套实现微服务的框架.他提供了微服务开发所需的配置管理.服务发现.断路器.智能路由.微代理.控制总线.全局锁.决策竞选.分布式会话和集群状态管理等 ...

  10. abap 优化之ST05

    DATA: gt_mara TYPE TABLE OF mara. SELECT * INTO TABLE gt_mara FROM mara WHERE MATKL = 'L000001' %_hi ...