裂缝探测python

In the first blog of this series, we developed an idea aiming to address the site selection problem from the perspective of the demand and supply. We completed the analysis of the demand side and simulated the distribution of the customers in the target city, Penang. Although the case study is conducted in the scenario of the grocery industry, the same solution can be applied to real estate, e-commerce, and education sectors as well. In this blog, we are going to tackle the supply side and look into the imbalance between the demand and supply across the city. Bear in mind that our client is a supermarket chain and its potential customers are the entire population of the city.

在本系列的第一个博客中,我们提出了一个想法,旨在从需求和供应的角度解决选址问题。 我们完成了需求方面的分析,并模拟了目标城市槟城的客户分布。 尽管案例研究是在杂货业的情况下进行的,但相同的解决方案也可以应用于房地产,电子商务和教育领域。 在此博客中,我们将解决供应方面的问题,并研究整个城市的需求和供应之间的不平衡。 请记住,我们的客户是一家连锁超市,其潜在客户是该城市的全部人口。

The supply analysis consists of the following sections.

供应分析包括以下部分。

  1. Competitor discovery: to find the locations of the existing supermarkets and grocery stores.

    竞争对手发现:查找现有超市和杂货店的位置。

  2. Distance estimation: to estimate the distance between the competitors and the different regions of the city.

    距离估算:估算竞争对手与城市不同区域之间的距离。

  3. Customer density estimation: to estimate the average number of customers served by one supermarket or grocery store at different locations of the city.

    顾客密度估算:估算城市中不同地点的一家超级市场或杂货店所服务的平均顾客数量。

竞争对手发现 (Competitor Discovery)

The information about existing grocery providers can be obtained using the Google Places API. It provides a variety of information about different types of places of interest, including their outlet name, geographical location, opening hours, and even visitor ratings etc. Here we expect the information provided by the API is up to date. However, it is not guaranteed that the API can detect all the places which fulfil the search criteria, especially for the less developed regions. For the purpose of this study, this is the best accessible data source we can rely on.

可以使用Google Places API获取有关现有杂货店提供商的信息。 它提供了有关不同类型的景点的各种信息,包括其景点名称,地理位置,开放时间,甚至访客评分等。在这里,我们希望API提供的信息是最新的。 但是,不能保证API可以检测到所有满足搜索条件的地点,特别是对于欠发达地区。 就本研究而言,这是我们可以依靠的最佳可访问数据源。

The Places API works with an API key and is usually queried with 3 parameters: the type of amenity, a center location, and a radius. Recap in the first series, we split the entire city area into thousands of 1km x 1km grids. In order to collect all the existing grocery providers available via the API, we take the geo-coordinates of the grid centers, and search for the supermarkets and grocery stores within 2 km’s distance. To make the blog more concise and less heavy with code, I’m going to omit the preparatory steps of the input data and the config parameters, and only highlight how the Places API is queried. The following code extracts the supermarkets within 2 km’s distance from Orchard Road, Singapore.

Places API与API密钥一起使用,通常使用3个参数查询:舒适性的类型,中心位置和半径。 回顾第一个系列,我们将整个城市区域划分为数千个1km x 1km的网格。 为了收集通过API提供的所有现有杂货店提供商,我们采用网格中心的地理坐标,并在2公里范围内搜索超级市场和杂货店。 为了使博客更简洁,更省力,我将省略输入数据和config参数的准备步骤,仅强调如何查询Places API。 以下代码提取了距新加坡乌节路2公里以内的超市。

import googlemapsAPI_KEY = "YOUR_API_KEY"
gmaps = googlemaps.Client(key=API_KEY)
res = gmaps.places("supermarket",location="1.304833,103.831833",  # Orchard Road, Singaporeradius=2000
)if res["status"] == 'OK' and len(res["results"]) > 0:for result in res["results"]:print(result)
else:print("No place is found")

The query results are returned as a list of Python dictionaries. One of them looks as follows. In this study, we only use the geolocation information of the existing supermarkets.

查询结果作为Python字典列表返回。 其中之一如下所示。 在本研究中,我们仅使用现有超市的地理位置信息。

{   "business_status":"OPERATIONAL",   "formatted_address":"491 River Valley Rd, #01-14, Singapore 248371",   "geometry":{      "location":{         "lat":1.2929051,         "lng":103.8270208      },      "viewport":{         "northeast":{            "lat":1.294498079892722,            "lng":103.8284264298927         },         "southwest":{            "lat":1.291798420107278,            "lng":103.8257267701073         }      }   },   "icon":"https://maps.gstatic.com/mapfiles/place_api/icons/shopping-71.png",   "id":"fda0ec60faa787f2bf992132e66c80f29daa5964",   "name":"FairPrice Finest Valley Point",   "opening_hours":{      "open_now":False   },   "photos":[      {         "height":2048,         "html_attributions":[            "<a href=\"https://maps.google.com/maps/contrib/111973208857299784904\">Anusha Lalwani</a>"         ],         "photo_reference":"CmRaAAAAQ6An4L-A5PbgDFkpZVllEGuB4Ayw0hdrZ9coCBaF6esLM2B7RVnJCvf0DPeZrlcbZ3KVFUz9cciPtArUAZ6tof_lJHzJHqKzcEFyRGJurK_Drld0GUec9sCWm25bXURVEhD6GZqf6j_Kb5IOTtQ1ogslGhQas22jzBT2rJ0jkj9zUhDvCLYj_w",         "width":1536      }   ],   "place_id":"ChIJTyWXW4EZ2jERNKBCOx_-4LA",   "plus_code":{      "compound_code":"7RVG+5R Singapore",      "global_code":"6PH57RVG+5R"   },   "rating":4,   "reference":"ChIJTyWXW4EZ2jERNKBCOx_-4LA",   "types":[      "grocery_or_supermarket",      "food",      "point_of_interest",      "store",      "establishment"   ],   "user_ratings_total":112}

The supermarkets and grocery stores are collected from all the grids and plotted on the QGIS map after removing the duplicates, as shown in Figure 2. It can be observed that the distribution of the existing grocery providers (the white dots) is approximately aligned with the customer distribution.

从所有网格中收集超级市场和杂货店,并在删除重复项后将其绘制在QGIS地图上,如图2所示。可以看到,现有杂货店的分布(白点)与零售店的分布大致一致。客户分布。

Figure 2 Partial view of the existing supermarkets and grocery stores across Penang city
图2槟城市现有超市和杂货店的局部视图

距离估算(Distance Estimation)

Allow me to ask you a question. How long would you like to spend on travelling for grocery shopping?

请允许我问一个问题。 您想花多长时间去杂货店购物?

People living in different cities could have different answers. My answer to this question is 15 min’s walking distance. Walking to the grocery store can be taken as a regular physical exercise during a lockdown. In this study, we are expecting a longer threshold of travelling time due to the relatively small population density of Penang. According to the advice given by a friend from Malaysia, we assume a threshold of 10 min’s driving distance. It is the most important parameter used in this analysis and can be adjusted easily if the solution is deployed as a dashboard application later on. Please note that in consulting projects, such parameters need to be obtained via rigorous market research.

生活在不同城市的人们可能会有不同的答案。 我对这个问题的回答是15分钟的步行距离。 锁定期间,步行到杂货店可以作为常规体育锻炼。 在这项研究中,由于槟城人口密度相对较小,我们预计出行时间会更长。 根据马来西亚朋友的建议,我们假设开车的距离10分钟。 它是此分析中最重要的参数,如果以后将该解决方案部署为仪表板应用程序,则可以轻松调整。 请注意,在咨询项目中,需要通过严格的市场研究来获得此类参数。

This travelling distance question is important here because, given the threshold of the travelling time, we can estimate the number of customers each grocery store can reach out to, which is known as catchment analysis. To facilitate this analysis, we extract the estimated driving time between each pair of grid and existing grocery store via Google Distance Matrix API. The following code extracts the driving time from Orchard Road to Marina Bay Sands, Singapore.

这个旅行距离问题在这里很重要,因为给定旅行时间的阈值,我们可以估计每个杂货店可以联系的顾客数量,这被称为流域分析。 为了方便进行此分析,我们通过Google Distance Matrix API提取了每对网格与现有杂货店之间的预计行驶时间。 以下代码提取了从乌节路到新加坡滨海湾金沙的行驶时间。

import googlemapsAPI_KEY = "YOUR_API_KEY"
gmaps = googlemaps.Client(key=API_KEY)
ORCHARD_ROAD = (1.304833, 103.831833)
MARINA_BAY_SANDS = (1.282302, 103.858528)
res = gmaps.distance_matrix(ORCHARD_ROAD,MARINA_BAY_SANDS,mode='driving'
)print(res)

The result indicates that the driving time from the origin to the destination address is 13 min.

结果表明,从起点到终点的行驶时间为13分钟。

{   "destination_addresses":[      "10 Bayfront Ave, Singapore 018956"   ],   "origin_addresses":[      "2 Orchard Turn, Singapore 238801"   ],   "rows":[      {         "elements":[            {               "distance":{                  "text":"5.2 km",                  "value":5194               },               "duration":{                  "text":"13 mins",                  "value":761               },               "status":"OK"            }         ]      }   ],   "status":"OK"}

客户密度估算 (Customer Density Estimation)

Let’s summarise the key information we have obtained at grid level.

让我们总结一下我们在网格级别获得的关键信息。

  • Population, or number of customers for each grid.每个网格的人口或客户数量。
  • Number of grocery stores and supermarkets which serve the customers living in each grid.服务于每个网格中的顾客的杂货店和超市的数量。

Now we take a quick look at the distribution of the number of customers and the grocery stores across the grids. The grids with no population are ignored in the following histograms.

现在,我们快速浏览一下网格上客户和杂货店数量的分布。 在以下直方图中,将忽略没有总体的网格。

Figure 3 Distribution of the grid-wise number of customers
图3按网格划分的客户数量分布
Figure 4 Distribution of the grid-wise number of stores within 10 min’s driving distance
图4在10分钟的行驶距离内的网格存储数量分布

Both the number of customers and grocery stores look reasonable. From here, we are going to calculate a customer density index for each grid to evaluate the imbalance of the demand and supply across the city. Conceptually, it is equivalent to the demand to supply ratio (DSR).

客户和杂货店的数量看起来都很合理。 从这里,我们将为每个网格计算一个客户密度指数,以评估整个城市的供需不平衡。 从概念上讲,它等于供求比(DSR)。

customer density = Number of customers / Number of grocery stores and supermarkets serving the customers in the grid

客户密度=客户数量/为网格中的客户提供服务的杂货店和超市的数量

We are going to recommend locations of the new supermarkets based on the customer density value. In general, high customer density indicates a good location for the new outlets. Therefore, our client can use it as a reference for site selection.

我们将根据客户密度值推荐新超市的位置。 通常,较高的客户密度表明新网点的位置很好。 因此,我们的客户可以将其用作站点选择的参考。

Figure 5 shows the distribution of customer density across Penang. The regions with high DSR are highlighted in dark blue.

图5显示了槟城各地客户密度的分布。 DSR高的区域以深蓝色突出显示。

Figure 5 Distribution of customer density across Penang city
图5槟城全市客户密度分布

最后的话(Final Words)

This concludes the series of the site selection case study. You might have noticed that the capacity of the supermarkets is not considered when estimating customer density. In other words, the capacity of all the existing stores is treated the same in this study, which is not accurate in reality. One possible solution to this issue is to match the existing stores with their corresponding shapes from the OpenStreetMap (OSM) data. Floor area can be calculated with the coordinates and used to estimate the capacity of the stores.

总结了选址案例研究系列。 您可能已经注意到,在估计客户密度时并未考虑超市的容量。 换句话说,在本研究中,所有现有商店的容量都被视为相同,这在实际中并不准确。 解决此问题的一种可能方法是将现有商店与其来自OpenStreetMap(OSM)数据的相应形状进行匹配。 可以使用坐标计算建筑面积,并将其用于估计商店的容量。

In addition, please plan your queries of Google API before execution. Do an estimation of the number of queries and the total cost.

另外,请在执行前计划对Google API的查询。 估算查询数量和总成本。

The scripts and notebooks used in this study are available on GitHub. Thanks for the read.

本研究中使用的脚本和笔记本可在GitHub上获得。 感谢您的阅读。

翻译自: https://towardsdatascience.com/crack-site-selection-puzzle-by-geospatial-analysis-part-2-2eefc5f5140

裂缝探测python


http://www.taodudu.cc/news/show-6799201.html

相关文章:

  • Google Maps API的使用
  • 年积日计算
  • “寿命计算”有科学依据
  • 手机上微信总是说无法连接服务器错误代码,手机微信无法登录,提示载入失败昨...
  • java环境配置——JDK安装
  • JDK8 JVM参数与实际环境中的优化配置实践
  • java怎么制作放置游戏_从零开始实现放置游戏(前言)
  • 四连冠!腾讯Kona JDK蝉联JDK18贡献度国内第一
  • java游戏优化_JAVA优化技巧分享 让游戏更加的流畅
  • Java游戏项目之俄罗斯方块
  • Oracle官宣:腾讯 JDK 18 国内第一,贡献度!
  • java游戏服务器的开发和维护,java游戏服务器开发
  • java 分布式游戏服务器框架,集群游戏服务器框架,游戏服务器网关框架 ioGame 网络游戏服务器框架
  • layabox游戏开发经验分享3
  • 【精简java】仅占用50MB的Minecraft便携java运行环境(jdk17)
  • 插件 桌面图标太多而影响观看壁纸 可用于 wallpaper
  • 新的旅行起航
  • 7天酒店亮相中国国际饭店业大会元宇宙线上展 创见酒店投资新未来
  • 来,让携程技术人带你“看”世界——2020携程技术年度盛典侧记
  • 开发者学习中心重磅首发
  • 打造特色文化夜游项目及探索科技创新
  • 共赴技术“狂飙”之旅丨第二届开源云原生开发者日开启预约!
  • 红旅在线语料库网站 开发笔记
  • 关于这次长沙之旅
  • 蓝海创意云携元宇宙技术亮相中原国际文化旅游产业博览会
  • 文化之旅中国
  • 互联网+红旅赛道校赛决赛观摩部分收获
  • 海口首家洲际酒店及度假村品牌酒店开业;迪桑特携手蜷川实花推出艺术联名系列 | 美通企业日报...
  • 从五一的旅游热潮看,该如何实现数字文旅的转型升级?
  • 全嘉宾阵容官宣 | 2022 云原生峰会即将启动,实战派企业向你发出邀请

裂缝探测python_地理空间分析的第2部分裂缝站点选择难题相关推荐

  1. 【笔记】《Python地理空间分析指南(第2版)》

    转载地址:https://blog.csdn.net/jianbinzheng/article/details/80215228 概述部分 地理空间数据 地理空间技术概览 Python地理空间分析工具 ...

  2. python空间分析_读书笔记——《python地理空间分析指南》

    本文为<Python地理空间分析指南(第2版)>的读书摘录,顺便挖个坑,进一步对python的几个包做学习整理. 本笔记的用途:了解python地理空间处理的技术框架和实现途径. 第三章 ...

  3. 一直在构建工作空间_国际资讯Python与地理空间分析

    点击图片上方蓝色字体"慧天地"即可订阅 英文原文来源:www.gislounge.com 英文原文链接:https://www.gislounge.com/python-and-g ...

  4. python地理空间分析指南pdf邓世超_Python地理空间分析指南(第2版)源代码.zip

    [实例简介] Python地理空间分析指南(第2版)的随书源代码,需要的朋友可以下载一下~~ [实例截图] [核心代码] Python地理空间分析指南(第2版)源代码 └── Python地理空间分析 ...

  5. softlayer iso_在SoftLayer云中启用地图和地理空间分析

    存档日期:2019年5月14日 | 上次更新时间:2014年8月26日 | 首次发布:2012年9月5日 基于云的基础架构正在成为用于管理硬件资源,降低成本和优化基础架构的下一代IT平台. 与云基础架 ...

  6. Python地理空间分析指南(第2版)学习笔记01

    目录 前言 一.任务 二.实现与解析 1.引入库 2.构造数据模型 3.渲染地图元素 4.执行查询操作以及完成绘图 三.总结 前言 本书假定读者了解Pyhon.信息技术的基本知识,并且至少对地理空间分 ...

  7. turfjs前端地理空间分析类库

    一.简介 turfjs是一个地理空间分析库,处理各种地图算法. 1. 简单 模块化,易于理解的JavaScript函数处理GeoJSON 2. 模块化 Turf是一系列小模板的集合,可以按需使用 3. ...

  8. Turf.js——用于地理空间分析的js库,处理各种地图算法

    Turf.js--用于地理空间分析的js库,处理各种地图算法 一.官网 中文--https://turfjs.fenxianglu.cn/ 英文--https://turfjs.org/ npm地址- ...

  9. Turf.js 地理空间分析库简介

    Turf.js是一个轻量级的JavaScript库,用于地理空间分析和操作.它提供了许多强大的函数和算法,用于处理地理空间数据,如点.线.多边形和网格等.Turf.js的API简单易用,可以轻松地与其 ...

最新文章

  1. php cc攻击代码,php cc攻击代码与防范方法
  2. java通过ssh读取日志_IDEA+java通过SSH来进行分析日志,实现UI自动化动态验证码登录...
  3. 揭密Oracle之 七种武器
  4. Linux入门-shell使用技巧
  5. JVM_03 运行时数据区[ 堆 ]
  6. boost::fusion::move用法的测试程序
  7. 尚硅谷_JavaScript_学习笔记
  8. extjs中元数据_Extjs中Store小总结
  9. 链表c语言stl,C++STL之List容器
  10. 受够了if (ModelState.IsValid)?ActionFitlter也是一路的坑啊!
  11. Could not load dynamic library ‘libcudart.so.10.0‘; dlerror: libcudart.so.10.0: cannot open shared o
  12. Mybatis generator创建项目核心文件
  13. 【php】使用phpdbg来调试php程序
  14. 【系统架构】大规模的C++项目代码层次结构
  15. 用双网卡实现跨网段访问(转载)
  16. [ 深度学习 ] —— 图卷积神经网络 GCN
  17. 交流异步电机矢量控制(一)——电机模型及其坐标变换
  18. MapGis二次开发问题记录
  19. 学习笔记-状态方程精确离散化
  20. 头条号优化 如何提高头条文章阅读量

热门文章

  1. 南京大学计算机信息安全专业,2020信息安全专业排名【大学】
  2. 2018年高薪专业排名,信息安全居榜首
  3. 安卓加密软件_oppo加密笔记在哪里?oppo手机怎么给云笔记加密? - 敬业签便签...
  4. database honeypot by design
  5. 成功入选“实力竞争者”,腾讯云数据库再获国际权威机构认可
  6. 如何在Python中获得当前的CPU和RAM使用率?
  7. Linux:find命令简单使用(查找文件及文件夹)
  8. 黑帽SEO都有哪些作弊手法?
  9. 实体店老板注意,务必尽快搞社群营销,圈住你的客户
  10. js和php方式,科学计数法转换成普通数