首页 \ 问答 \ 谷歌地图Android:将折线折叠到街道(Google Maps Android: snap polyline to street)

谷歌地图Android:将折线折叠到街道(Google Maps Android: snap polyline to street)

使用谷歌地图Android v2,我如何捕捉使用折线绘制的路线或只是连接到街道的点?

我从Google Play服务获取位置,但是通常情况下通常在5-10米左右,所以积分不是直接在街上,而是有点不对。


Using Google Maps Android v2, how can I snap a route drawn with a polyline or just the points that are getting connected to a street?

I am getting locations from Google Play Services, but accurency is usually around 5-10 meters, so points are not directly on the street, but a bit wrong.


原文:https://stackoverflow.com/questions/17419973
更新时间:2022-04-21 21:04

最满意答案

sed -n 's/\[\(.*\)\]/\1/p' file

说明:-n禁止将每行打印到STDOUT,但正则表达式末尾的/p重新启用此行为,从而导致打印所有匹配的行。 正则表达式本身匹配括号之间的所有内容,并用它替换整行。


sed -n 's/\[\(.*\)\]/\1/p' file

Explanation: -n suppresses the printing of each line to STDOUT, but the /p at the end of the regex re-enables this behavior causing all matching lines to be printed. The regex itself matches everything between brackets and replaces the entire line with it.

相关问答

更多
  • grep基本是以行为单位处理文本的; 而awk可以做更细分的处理,通过指定分隔符将一行(一条记录)划分为多个字段,以字段为单位处理文本。awk中支持C语法,可以有分支条件判断、循环语句等,相当于一个小型编程语言。 二者都支持正则匹配。
  • 如果你有GNU grep; grep -f - file 如果没有,你可以从awk打印出一个sed脚本,或者创建一个稍微复杂的awk脚本。 或者只是将输出加入一个大的egrep表达式; egrep "$(awk -F'"' '{ printf ("%s%s", j, $2); j="|" }' input)" If you have GNU grep; grep -f - file If not, you could print out a sed script from awk, or maybe ...
  • 简短定义: grep :搜索文件中的特定术语 #usage $ grep This file.txt Every line containing "This" Every line containing "This" Every line containing "This" Every line containing "This" $ cat file.txt Every line containing "This" Every line containing "This" Every line cont ...
  • 这是一个awk版本(你问awk) awk '/AM|PM/ && NF--; /a =/ {print "a = "$(NF-6),"b = "$(NF-3),"c = "$NF}' file Oct 07, 2014 7:39:10 AM a = 0 b = 0 c = 0 另一个版本: awk '/AM|PM/ && NF--; {n=split($0,a,"abcd");if (n==2) print "abcd"a[2]}' file Oct 07, 2014 7:39:10 AM abcd = ...
  • 你可以用这个: awk '/^Amount/ {amount+=$2} END {print amount+0}' file 使用+0技巧,如果未设置值,则使其打印0 。 说明 没有必要grep + awk。 awk一个人可以grep(以及更多的东西!): /^Amount/ {}以“金额”开头的行上的/^Amount/ {} ,执行{} 。 amount+=$2将字段2的值添加到计数器“金额”。 处理完整个文件后END {print amount+0} ,打印amount值。 如果之前未设置,则执行+0 ...
  • 我在OP的评论中看到,也许问题不再是问题。 但是,下面的细微修改将处理空行情况。 只需添加一个检查以确保该行至少有一个字段: grep "$(awk '{if (NF > 0) print $1}' file1)" file2 如果带有模式的文件只是每行一组模式,那么它的简单版本就是: grep -f file1 file2 这会导致grep使用file1中的行作为模式。 I see in the OP's comment that maybe the question is no longer a q ...
  • wmctrl -lp | awk '/Firefox/ { print $1 }' 不需要grep。 Awk会这样做。 此外默认的字段分隔符是空格,所以不需要指定。 另外,围绕你的awk脚本使用单引号,这样shell不会扩展$ 1。 这就是你的脚本失败的原因。 $ 1变成了什么都没有,你的awk动作变成了“打印”,它打印出整条线。 wmctrl -lp | awk '/Firefox/ { print $1 }' No need for grep. Awk will do that. Also the ...
  • Lars Fischer在评论中回答了这个问题。 这个社区wiki帖子正式化(并改进)它。 要仅为搜索词着色,可以使用带有这些颜色代码的全局替换( gsub ): awk 'BEGIN { RS=">"; FS="\n" } gsub(/GATTACA/, "\033[0;32m&\033[0m", $0)' file 这将记录分隔符( RS )设置为>而不是默认\n (换行符)和字段分隔符( FS )为\n而不是其他空白字符的默认值。 然后,它对该查询执行全局替换,将文本替换为正确颜色代码所包围的文本。 ...
  • 在Gnu Awk中,您可以使用\<和\>来匹配单词的开头和结尾,所以 gawk '/\/{++i} END{print i}' 会做同样的事情 grep -wc 'GOOD' file 如果你想计算GOOD这个词的出现总数(不仅是行数,还有给定行/记录中的出现次数),你可以在Gnu Awk版本4中使用FPAT , gawk 'BEGIN { FPAT="\\"; RS="^$" } { print NF }' file 如果要计算给定记录中短语GOOD DI的完全匹配数, ...
  • sed -n 's/\[\(.*\)\]/\1/p' file 说明:-n禁止将每行打印到STDOUT,但正则表达式末尾的/p重新启用此行为,从而导致打印所有匹配的行。 正则表达式本身匹配括号之间的所有内容,并用它替换整行。 sed -n 's/\[\(.*\)\]/\1/p' file Explanation: -n suppresses the printing of each line to STDOUT, but the /p at the end of the regex re-enables ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)