街道应该表示为LineString或Polygon

时间:2016-09-22 05:54:36

标签: mysql geolocation gis openstreetmap

我要做的是找到距离街道10米范围内的地方。
我的街道表有一个geometry列,其中的坐标是保存的。
示例坐标看起来像

{ "type": "Feature", "properties": { "id": 4.000000, "osm_id": 69551269.000000, "type": "tertiary", "name": "Street name", "tunnel": 0, "bridge": 0, "oneway": 1, "ref": null, "z_order": 4.000000, "access": null, "service": null, "class": "highway" }, 
   "geometry": { "type": "LineString", 
       "coordinates": [ [ 45.055701068545773, 37.537045660463036 ], [ 45.055566036085651, 37.536995369044007 ], [ 45.054243455583901, 37.536797891405229 ], [ 45.053941120336447, 37.536756233346466 ], [ 45.053692177812167, 37.536712228354787 ], [ 45.052483758831642, 37.536435290273943 ], [ 45.052157870436275, 37.536344765719662 ], [ 45.051875819394468, 37.536229430731993 ], [ 45.05173206975504, 37.536151395213466 ], [ 45.051607347035826, 37.536067827638817 ], [ 45.051492766419436, 37.535979063284202 ], [ 45.050636052096081, 37.535314881276747 ], [ 45.050383253896371, 37.535111536305749 ], [ 45.050164989137727, 37.534882458892014 ], [ 45.050017048546714, 37.534692692604175 ], [ 45.049976061040212, 37.534639970433204 ], [ 45.049796436855189, 37.534394380670221 ], [ 45.049439032503869, 37.533859196152598 ], [ 45.049149186292141, 37.533424929749174 ], [ 45.048739143588875, 37.532811039160741 ], [ 45.048373357334377, 37.532213577102539 ], [ 45.048231284075598, 37.531903279047071 ], [ 45.048143022635173, 37.531710579093094 ], [ 45.047949568309946, 37.531336494754463 ], [ 45.047873628267183, 37.531189895267971 ], [ 45.047984772303266, 37.53111303321586 ] ] } },

我的问题是坐标应保存为多边形还是LineString GeoJson授权表明LineString没有内部或外部,但我从openstreet获得的数据(上面是一个样本)的类型为LineString。 那么我应该使用哪一个?

编辑:
openstreetmap中的示例LineString如下所示:
enter image description here enter image description here

我通过绘制带坐标的多边形来绘制它们。

2 个答案:

答案 0 :(得分:0)

在您的情况下,两种几何类型中的任何一种,线串和多边形都适用于您。但我认为将线串转换为多边形非常简单,只需使用带有20m的ST_Buffer多边形......

答案 1 :(得分:0)

import fnmatch import os.path pattern = "*.mxf" matching = [os.path.basename(s) for s in rasp if fnmatch.fnmatch(s, pattern)] print matching

20米= 0.0124274英里, 地理坐标系和几何坐标系之间的差异:https://en.wikipedia.org/wiki/Geographic_coordinate_system