使用Redis来实现LBS的应用

用REDIS实现LBS系统 用REDIS实现LBS系统前言LBS系统其实并不是什么难的问题,现在已经有很多成熟的框架,比如MongoDB就提供一套性能不错的LBS系统。但是前些日子从公司接手这份差事的时候,(由于当时的整个应用架构体系还比较简单)并不希望轻易就引入其他系统和架构,在当时仅有REDIS和MYSQL的时候,果断就选择从REDIS下手。由于是第一次写这种技术方面的文章,可能写的比较草,就算是抛砖引玉吧。有什么不足的地 阅读详情

微信、陌陌 架构方案分析

近两年、手机应用,莫过于微信、陌陌之类最受欢迎;但实现原理,分享文章甚少。

故,提出两种方案,供分享;不对之处,敬请留言学习。

目标

解决大型应用(微信、陌陌级别)中,用户经纬度在不断更新,用户查找频繁的问题。(每分钟1000W级)

方案A:

本方案前,请先阅读:基于LBS功能应用的Geohash方案,看过该文章便可简单知道;

1、仅需每分钟将用户的经纬度,上报到数据库;

2、然后每次用户查找附近好友时,通过 LIKE 'wm3yr3%',即可获取

缺点:稍有一定数据量,对数据库的鸭梨可想而知

方案B:使用Redis

策略

假象把中国分成,若干个一平方公里的单元格

1)、用户位置的变更,理解为一个单元格移动到另外一个单元格(或者不移动)

2)、用户查找附近,理解为查找,自己所在方块的的所有人

数据结构

1)、用户基本信息 纬度、经度、GeoHash值(经纬度,仅用于后期距离计算)

2)、单元格 集合(用户1,用户2,…)

存储工具

1)、redis string(key->value) 结构,存储用户基本信息

2)、redis set(集合) 结构,以GeoHash值,前6位作为key(约表示一平方千米),存储单元格的用户群

算法流程

1)、更新用户信息,先删除用户原所在集合,再更新当前用户信息,最后更新当前用户所在集合

2)、查找附近,直接查找,所在单元格集合所有用户ID

具体实现

<?php
 /**
  * LBS核心类
  * @author name <simplephp@163.com>
  * @site http://www.wubiao.info
  */
include_once('geohash.class.php');
 
class LBS {
    //索引长度 6位
    protected $index_len = 6;
    protected $redis;
    protected $geohash;
 
    public function __construct() {
        //redis
        $this->redis = new Redis();
        $this->redis->pconnect('127.0.0.1','6379');
        //geohash
        $this->geohash = new Geohash();
    }
    /**
    * 更新用户信息
    * @param mixed $latitude 纬度
    * @param mixed $longitude 经度
    */
    public function upinfo($user_id,$latitude,$longitude) {
        //原数据处理
        //获取原Geohash
        $o_hashdata = $this->redis->hGet($user_id,'geo');
        if (!empty($o_hashdata)) {
            //原索引
            $o_index_key = substr($o_hashdata, 0, $this->index_len);
            //删除
            $this->redis->sRem($o_index_key,$user_id);
        }
        //新数据处理
        //纬度
        $this->redis->hSet($user_id,'la',$latitude);
        //经度
        $this->redis->hSet($user_id,'lo',$longitude);
        //Geohash
        $hashdata = $this->geohash->encode($latitude,$longitude);
        $this->redis->hSet($user_id,'geo',$hashdata);
        //索引
        $index_key = substr($hashdata, 0, $this->index_len);
        //存入
        $this->redis->sAdd($index_key,$user_id);
        return true;
    }
    /**
    * 获取附近用户
    * @param mixed $latitude 纬度
    * @param mixed $longitude 经度
    */
    public function serach($latitude,$longitude) {
        //Geohash
        $hashdata = $this->geohash->encode($latitude,$longitude);
        //索引
        $index_key = substr($hashdata, 0, $this->index_len);
        //取得
        $user_id_array = $this->redis->sMembers($index_key);
        return $user_id_array;
    }
}
?>

性能测试

1)模拟数据上报

<?php
 /**
  * 模拟数据上报
  * @author name <simplephp@163.com>
  * @site http://www.wubiao.info
  */
include_once('lbs.class.php');
 
$b_time = microtime(true);
$n = 0;
 
while(1) {
    //user_id 1~1000000
    $user_id = rand(1, 1000000);

    //latitude 30.59773~30.726786
    $rand_latitude = rand(30597730, 30726786);
    $latitude = $rand_latitude / 1000000;
 
    //longitude 103.983192 ~104.16069
    $rand_longitude = rand(103983192, 104160690);
    $longitude = $rand_longitude / 1000000;
 
    $lbs = new lbs();
    $lbs->upinfo($user_id, $latitude, $longitude);
    $n++;
    mylog($n);
    $e_time = microtime(true);
    if(($e_time - $b_time) >= 60) {
        exit;
    }
}
 
function mylog($content) {
    file_put_contents('upinfo.log', $content . "\r\n", FILE_APPEND);
}
?>

2)模拟附近查找

<?php
 /**
  * 模拟附近查找
  * @author name <simplephp@163.com>
  * @site http://www.wubiao.info
  */
include_once('lbs.class.php');
 
$b_time = microtime(true);
$n = 0;
 
while(1) {
    //latitude 30.59773~30.726786
    $rand_latitude = rand(30597730, 30726786);
    $latitude = $rand_latitude / 1000000;
 
    //longitude 103.983192 ~104.16069
    $rand_longitude = rand(103983192, 104160690);
    $longitude = $rand_longitude / 1000000;
 
    $lbs = new lbs();
    $re = $lbs->serach($latitude,$longitude);

    $n++;
    mylog($n);

    $e_time = microtime(true);
    if(($e_time-$b_time) >= 60) {
        exit;
    }
}
 
function mylog($content) {
    file_put_contents('search.log', $content . "\r\n", FILE_APPEND);
}
?>

测试环境

vmWare虚拟机,内存256M,主频2.93GHz

性能结果

模拟了100W活跃用户行为,不断更新,不断查找附近好友

//60 seconds insert
88544

//60 seconds search
117660

//成都 100W人,数据占用内存
11.97M

总结

从测试结果来看,完全能满足,微信、陌陌之类的性能要求;

尚可改进之处:

1、Geohash,可写成PHP C扩展;或者其他Geohash实现方式

2、Redis,内存消耗较大,可考虑redis集群方案

3、本文仅查出本单元格用户,提高精度,可查出周围八个单元个,求交集

4、求出结果,如需按照由远到近排序;读出Redis经纬度,利用距离公式排序方可。(可参照上一篇文章)

问题

1)假设我现在设定的hash长度为7 ,那一个个hash值对应一个块,如何得到这个块的坐标区间呢?

例如,成都永丰立交的Geohash值为:wm3yr31d2524;如取7位,则为,wm3yr31;

根据Geohash的算法,那么区间就会是 wm3yr3100000 ~ wm3yr31zzzzz;

根据如上两值,通过“Geohash->经纬度”算出经纬度,可大致确定区间。

2)如果用户上报的位置信息有时效性(比如:15秒内有效)如何处理?

可以在redis存储的时候,设置有效时间

转载:微信、陌陌 架构方案分析

Redis,GEO是什么?还可以定义新的数据类型吗? 在第二讲中,我们学习了Redis的5大基本数据类型:String、List、Hash、Set和Sorted Set,它们可以满足大多数的数据存储需求,但是在面对海量数据统计时,它们的内存开销很大,而且对于一些特殊的场景,它们是无法支持的。所以,Redis还提供了3种扩展数据类型,分别是Bitmap、HyperLogLog和GEO。前两种我在上节课已经重点介绍过了,今天,我再具体讲一讲GEO。 另外,我还会给你介绍开发自定义的新数据类型的基本步骤。掌握了自定义数据类型的开发方法,当你面临一些复杂的场景时,就 阅读详情

相关推荐

SSE消息推送避坑指南:从Chrome兼容性到Spring超时配置

本文深入探讨了在Java Spring Boot项目中实现SSE消息推送时,从浏览器兼容性到后端配置的完整避坑指南。针对Chrome并发连接限制、Safari自动断开、Nginx代理缓冲以及Spring SseEmitter内存泄漏与超时管理等生产环境常见问题,提供了具体的解决方案和最佳实践配置,帮助开发者构建稳定可靠的实时推送系统。

work3的博客 449

Redis核心技术与实战【学习笔记】 - 7.Redis GEO类型 - 面向 LBS 应用的数据类型

日常生活中,“附近停车场”、打车软件的叫车,这些都离不开基于位置信息服务(LBS)的应用。LBS 应用访问的数据是和人或物关联的一组经纬度信息,且要能查询相邻的经纬度范围,Redis 的 GEO 就非常适合应用在 LBS 服务的场景中。

chenjian723122704的专栏 1380

别再手动切换了!用SP3485+三极管搞定RS485自动收发电路(附完整原理图)

本文详细介绍了如何利用SP3485芯片和三极管设计RS485自动收发电路,解决传统手动切换带来的IO资源占用和软件复杂度问题。通过原理分析、电路设计拆解和实战注意事项,帮助工程师打造稳定可靠的自动收发通信模块,显著提升系统性能和可靠性。

weixin_26833939的博客 509

REDIS09_LBS出现背景、GEO算法介绍、算法步骤、剖析、邻近网格位置推算

REDIS09_LBS出现背景、GEO算法介绍、算法步骤、剖析、邻近网格位置推算

所得皆惊喜 1321

香橙派OPi 6系列选型指南:RK3588与RK3588S开发板深度对比

开发板选型是嵌入式系统设计的关键环节,尤其在边缘计算和AI推理等场景中,芯片的差异直接影响硬件架构。瑞芯微RK3588及其精简版RK3588S是当前高端开发板的核心方案,两者在PCIe通道、显示输出和SATA支持上存在显著区别。理解这些原理,有助于工程师根据项目需求快速匹配产品。香橙派OPi 6系列基于这两款芯片,衍生出OPi 6、OPi 6 Pro与OPi 6 Max三种形态:紧凑型适合嵌入式门禁与AI盒子,Pro版凭借双屏异显和PCIe 3.0满足收银机与视频分析,Max的双2.5G网口和大内存则面向轻

weixin_29185167的博客 223

保姆级教程:用再生龙Clonezilla Live给Ubuntu系统做全盘备份与恢复(含BIOS设置避坑)

本文提供了一份详细的Clonezilla Live教程,指导Ubuntu用户如何轻松完成全盘备份与恢复。从启动盘制作、BIOS设置避坑到备份参数解析和恢复操作,涵盖了所有关键步骤和常见问题解决方案,帮助用户高效保护系统数据。

weixin_42116058的博客 638

【Redis】Redis 中地理位置功能 Geospatial 了解一下?

Geospatial Indexes 是 Redis 提供的一种数据结构,用于存储和查询地理位置信息。它可以将地理位置的经度和纬度编码为二维平面上的点,并支持根据距离或矩形区域查询附近的地理位置点,这使得它在很多场景下被广泛应用,比如 LBS(Location Based Service)、智能推荐、出行规划等。Redis 中 Geospatial Indexes 是通过有序集合实现的,其内部使用 zset 数据类型来存储地理位置点的经纬度和成员信息。

DreamSun的博客 3454

Eplan P8 API二次开发--插入符号(Symbol)功能(Function)并定义属性

1、目的 使用Eplan API在页中自动插入某个符号并按约定规则自动设置好属性 2. 步骤 一、基础信息 比如要在Eplan中自动插入一个电机的符号并定制属性,我们先要确定要插入的符号名,可以在Eplan中获取如下符号(Symbol)信息 可以知道我们待插入的符号名称为M3_1, 接下来,使用Visual Studio建立类库项目,并引用Eplan Api库 二、获取符号变量(SymbolVariant) 在Eplan中,当一个符号(Symbol)被插入到页中,这个符号的引用即变为一个(Function

如是道程序人生 4523

Redis 中地理位置功能 Geospatial 了解一下?

Geospatial Indexes 是 Redis 提供的一种数据结构,用于存储和查询地理位置信息。它可以将地理位置的经度和纬度编码为二维平面上的点,并支持根据距离或矩形区域查询附近的地理位置点,这使得它在很多场景下被广泛应用,比如 LBS(Location Based Service)、智能推荐、出行规划等。Redis 中 Geospatial Indexes 是通过有序集合实现的,其内部使用 zset 数据类型来存储地理位置点的经纬度和成员信息。

兴趣是最好的老师,勤能补拙 1412

手把手教你学Simulink--控制执行场景实例:基于Simulink的智能车辆自动紧急制动(AEB)仿真

本文完成了基于 Simulink 的智能车辆自动紧急制动(AEB),实现了:✅ 构建前车急刹与静止障碍物典型场景✅ 设计基于 TTC 的三级 AEB 决策逻辑✅ 验证在高风险场景下有效避免碰撞✅ 掌握从风险评估到制动执行的完整安全链✅ 为ADAS 主动安全功能开发奠定基础。

MHD0815的博客 236

pip install安装markitdown时出现ERROR: ‘packages/markitdown[all]‘ is not a valid editable requirement解决方案

本文主要介绍了pip install安装markitdown时出现ERROR: ‘packages/markitdown[all]’ is not a valid editable requirement解决方案,希望能对使用markitdown的同学们有所帮助。 文章目录 1. 问题描述 2. 解决方案

weixin_43178406的博客 2万+

Redis数据实战之GEO在LBS中应用与自定义新数据类型

Redis数据实战之GEO在LBS中应用与自定义新数据类型引言面向 LBS 应用的 GEO 数据类型GEO 的底层结构GeoHash 的编码方法如何操作 GEO 类型如何自定义数据类型Redis 的基本对象结构开发一个新的数据类型 引言 Redis 的 5 大基本数据类型:String、List、Hash、Set 和Sorted Set,它们可以满足大多数的数据存储需求,但是在面对海量数据统计时,它们的内存开销很大,而且对于一些特殊的场景,它们是无法支持的。所以,Redis 还提供了 3种扩展数据类型,分别

香农三定律的博客 899

SE模块理解+SE-Resnet模块pytorch实现

文章目录SE模块理解SE实现注意力机制原因SE-resnet网络pytorch实现定义residual定义SE模块 SE模块理解 SENet是Squeeze-and-Excitation Networks的简称,拿到了ImageNet2017分类比赛冠军,其效果得到了认可,其提出的SE模块思想简单,易于实现,并且很容易可以加载到现有的网络模型框架中。SENet主要是学习了channel之间的相关性,筛选出了针对通道的注意力,稍微增加了一点计算量,但是效果比较好。 SE模块广泛应用于去噪,去雨方向,利用SE模

qq_42754919的博客 2万+

Redis Geospatial 功能详解及多边形包含判断实现

本文介绍了Redis Geospatial在LBS应用中的使用,包括其核心功能(地理位置存储、距离计算、范围查询等)和常用命令。通过外卖平台商家查询的实战示例,展示了如何存储、查询和计算商家位置。针对多边形包含判断需求,文章详细讲解了结合Redis存储与射线法的实现方案,包括Python代码示例和边界偏差处理。Redis Geospatial与射线法的结合,能高效处理复杂的地理空间操作,为LBS应用提供可靠支持。

程序人生,算法世界 604

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

使用PHP实现查找你想要的附近人

最近有个业务场景使用到了查找附近的人,于是查阅了相关资料,并对使用PHP实现相关功能的多种方式和具体实现做一篇技术总结,欢迎各位看官提出意见和纠错,下面开始进入正题: LBS(基于位置的服务) 查找附近的人有个更大的专有名词叫做LBS(基于位置的服务),LBS是指是指通过电信移动运营商的无线电通讯网络或外部定位方式,获取移动终端用户的位置信息,在GIS平台的支持下,为用户提供相应服务的一种增值业务。因此首先得获取用户的位置,获取用户的位置有基于GPS、基于运营商基站、WIFI等方式,一般由客户端获取用户位置

lin123_00的博客 900

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

Redis_Geospatial(基于位置信息的应用)

基于位置信息服务(Location-Based Service,LBS)的应用。Redis3.2版本后增加了对GEO类型的支持。主要来维护元素的经纬度。redis基于这种类型,提供了经纬度设置、查询、范围查询、距离查询、经纬度hash等一些相关操作。

Byron__的博客 652

Redis系列:Geo 类型赋能亿级地图位置计算

我们在篇深刻理解高性能Redis的本质动态字符串(REDIS_STRING):整数(REDIS_ENCODING_INT)、字符串(REDIS_ENCODING_RAW)双端列表(REDIS_ENCODING_LINKEDLIST)压缩列表(REDIS_ENCODING_ZIPLIST)跳跃表(REDIS_ENCODING_SKIPLIST)哈希表(REDIS_HASH)整数集合(REDIS_ENCODING_INTSET)

Ly768768的博客 1603

【进阶篇】2.3 三分钟了解Redis地理位置数据结构GeoHash

随着移动互联网的普及,越来越多的应用需要对地理位置信息进行存储和查询,如LBS(Location-Based Service)服务、附近的人功能、地图搜索等。为了满足这些应用的需求,Redis提供了一种地理位置数据结构,称为GeoHash,可以存储和查询地理位置信息。本文将对Redis地理位置数据结构进行详细介绍。Redis地理位置数据结构是一种基于GeoHash算法实现的数据结构,用于存储和查询地理位置信息。

日拱一卒无有尽,功不唐捐终入海 2600

Redis:GEO类型

面向LBS(Location-Based Service,基于位置服务 ) 以叫车服务为例,每辆车有一个车辆id,以及当前所处的经纬度。 用户叫车时,叫车服务根据用户当前经纬度,来查找附近的车辆,并进行匹配。 匹配成功,叫车服务通过id查到车辆详情,并返回给用户。 GeoHash 的编码方法 二分区间,区间编码。 当要对一组经纬度进行 GeoHash 编码时,要先对经度和纬度分别编码,然后再把经纬度各自的编码组合成一个最终编码。 对于一个地理位置信息来说,它的经度范围是[-180,180]。GeoHa

weixin_40108561的博客 323

【Redis】数据结构的应用——GEO 【搜索“附近的餐馆”、在打车软件上叫车】

搜索“附近的餐馆”、在打车软件上叫车,这些都离不开基于位置信息服务(Location-Based Service,LBS)的应用。LBS 应用访问的数据是和人或物关联的一组经纬度信息,而且要能查询相邻的经纬度范围 以叫车服务为例,来分析下 LBS 应用中经纬度的存取特点。 每一辆网约车都有一个编号(例如 33),网约车需要将自己的经度信息(例如 116.034579)和纬度信息(例如 39.000452 )发给叫车应用。 用户在叫车的时候,叫车应用会根据用户的经纬度位置(例如经度 116.054579

your_棒棒糖的博客 463
上一篇: 基于LBS功能应用的Geohash方案
下一篇: nginx+lua+redis构建高并发应用
笑天居士
博客等级 码龄24年 292粉丝 136原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值