当前位置: 首页 > news >正文

做机网站wordpress 修改小工具样式

做机网站,wordpress 修改小工具样式,沙田镇网站仿做,杭州市做网站的公司使用Redis geo实现 redis geo是基于Sorted Set来实现的 Redis 3.2 版本新增了geo相关命令#xff0c;用于存储和操作地理位置信息。提供的命令包括添加、计算位置之间距离、根据中心点坐标和距离范围来查询地理位置集合等#xff0c;说明如下: geoadd#xff1a;添加地理…使用Redis geo实现 redis geo是基于Sorted Set来实现的 Redis 3.2 版本新增了geo相关命令用于存储和操作地理位置信息。提供的命令包括添加、计算位置之间距离、根据中心点坐标和距离范围来查询地理位置集合等说明如下: geoadd添加地理位置的坐标。 geopos获取地理位置的坐标。 geodist计算两个位置之间的距离。 georadius根据用户给定的经纬度坐标来获取指定范围内的地理位置集合。 georadiusbymember根据储存在位置集合里面的某个地点获取指定范围内的地理位置集合。 geohash返回一个或多个位置对象的 geohash 值 测试 添加坐标点 geoadd region 117.130313 31.84504 shuxihu 117.143635 31.838962 chanyeyuan 117.143635 31.838962 shiyanxiaoxue 117.123423 31.842912 aolai 117.207504 31.879882 zhiwuyuan // 查询距离117.130313 31.84504半径1000米地点信息 georadius region 117.130313 31.84504 1000 m 执行结果 SpringBoot与redis geo整合 springframework中已经加入了对redis geo的支持相关的类都在org.springframework.data.geo包下。而对redis的命令行交互也提供了org.springframework.data.redis相关的类来支持相关开发。 为了在项目中方便使用整理工具代码如下主要封装了 1、添加元素到redisgeo 2、计算某指定集合下给定中心和查询范围获取区域内成员的方法 3、计算两个成员的距离 4、查询某指定成员数组的位置信息 package com.octv.cloud.ota.controller;import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.geo.*; import org.springframework.data.redis.connection.RedisGeoCommands; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController;import java.util.List;/*** author xiaoss* since 1.0, 2023年02月27日 11:31:45*/ RestController RequestMapping(test) public class TestController {Autowiredprivate RedisTemplateString,String redisTemplate;/*** 添加节点及位置信息* param geoKey 位置集合* param pointName 位置点标识* param longitude 经度* param latitude 纬度*/public void geoAdd(String geoKey, double longitude, double latitude,String pointName){Point point new Point(longitude, latitude);redisTemplate.opsForGeo().add(geoKey, point, pointName);}/**** param longitude* param latitude* param radius* param geoKey* param metricUnit 距离单位例如 Metrics.KILOMETERS* param metricUnit* return*/public ListGeoResultRedisGeoCommands.GeoLocationString findRadius(String geoKey, double longitude, double latitude, double radius, Metrics metricUnit, int limit){// 设置检索范围Point point new Point(longitude, latitude);Circle circle new Circle(point, new Distance(radius, metricUnit));// 定义返回结果参数如果不指定默认只返回content即保存的member信息RedisGeoCommands.GeoRadiusCommandArgs args RedisGeoCommands.GeoRadiusCommandArgs.newGeoRadiusArgs().includeDistance().includeCoordinates().sortAscending().limit(limit);GeoResultsRedisGeoCommands.GeoLocationString results redisTemplate.opsForGeo().radius(geoKey, circle, args);ListGeoResultRedisGeoCommands.GeoLocationString list results.getContent();return list;}/*** 计算指定key下两个成员点之间的距离* param geoKey* param member1* param member2* param unit 单位* return*/public Distance calDistance(String geoKey, String member1, String member2, RedisGeoCommands.DistanceUnit unit){Distance distance redisTemplate.opsForGeo().distance(geoKey, member1, member2, unit);return distance;}/*** 根据成员点名称查询位置信息* param geoKey geo key* param members 名称数组* return*/public ListPoint geoPosition(String geoKey, String[] members){ListPoint points redisTemplate.opsForGeo().position(geoKey, members);return points;}GetMapping(test)public void test(){geoAdd(region,117.130313, 31.84504,shuxihu);geoAdd(region,117.143635,31.838962,chanyeyuan);geoAdd(region,117.143635,31.838962,shiyanxiaoxue);geoAdd(region, 117.123423,31.842912,aolai);geoAdd(region,117.207504,31.879882,zhiwuyuan);ListGeoResultRedisGeoCommands.GeoLocationString listfindRadius(region,117.130313 ,31.84504 ,0.5,Metrics.KILOMETERS,5);for(GeoResultRedisGeoCommands.GeoLocationString object:list){System.out.println(object.getContent().getName());}} }
http://wiki.neutronadmin.com/news/372963/

相关文章:

  • 河南网站建站系统平台惠州网站设计培训
  • 网站后台示演网站建设php书籍
  • 番禺网站建设设计襄阳市网站建设
  • 成都建站模板网站开发东莞wordpress
  • 珠海网站制作套餐网络服务提供者
  • wordpress单主题广州seo公司品牌
  • dede网站迁移最近中美关系最新消息
  • 广州穗科建设管理有限公司网站企业制作网站服务
  • ps做网站logo尺寸网站备案中页面
  • 天津网站建设制作排名thegem wordpress主题
  • 湖北可以做网站方案的公司怎样做网站搜索推广
  • 做网站不想用微软雅黑了聊城高唐网站建设公司
  • 免费网站app哪个好企业网站底部
  • 金湖县城乡建设局网站有网站加金币的做弊器吗6
  • 个人网站做商城会怎样网站 cms
  • 网站怎么建设高端公司网站建设psd模板
  • 知名电子商务网站有哪些洛阳建设信息网站
  • 商城网站设计定制企业获客方式
  • 可以拿自己电脑做网站acg大神做的网站
  • 小型手机网站建设哪家好手机网站相册代码
  • 奎文营销型网站建设国内做网站哪个好
  • 小说类网站怎么做网站审批需要什么手续
  • 北京如何做网站做网站jsp和php
  • 国外简约网站注册公司在哪里注册
  • 网站注美仑-专门做服装的网站
  • 万能浏览器最新下载深圳百度快速排名优化
  • 企业电子商务网站有哪些功能毕业设计做网站题目
  • 网站开发时间进度左右布局的网站
  • 做三个月网站广告收入输入文字生成图片app
  • 做网站郑州汉狮已有域名 做网站