🦁
ArangoDBでGeoJSONを試す
ArangoDBでGeoJSON
にチュートリアル的なのがあるので試してみた
GeoJSONとは
地理的データをエンコードするためのフォーマットです
新潟のGeoJSONデータ
から落とせます
落としてきたデータをインポートする
上記画像のようにfeatures
の中身をコピーして
WebUIで任意のコレクション(今回はniigata)の右上の+をクリックして
このようにDocumentBodyに貼り付けCreateをクリック
データが作られた
WebUIで出してみる
QUERIESで
FOR u IN niigata
FILTER u.properties.KEN_NAME == "新潟県"
AND u.properties.GST_NAME == "長岡市"
RETURN u
結果
長岡市の範囲が出た!
指定座標(緯度経度)で範囲内データを取得する
自由の女神の位置から
// GEO_POINT(経度, 緯度)
LET statueOfLiberty = GEO_POINT(-74.044500, 40.689306) // 自由の女神
FOR u IN niigata
FILTER
GEO_CONTAINS(u.geometry, statueOfLiberty) == TRUE
RETURN
u
結果
Warnings:
[10], 'in function 'GEO_CONTAINS()': Invalid loop in polygon: Edge 557 has duplicate vertex with edge 709'
[10], 'in function 'GEO_CONTAINS()': Invalid loop in polygon: Edge 24 has duplicate vertex with edge 153'
[10], 'in function 'GEO_CONTAINS()': Invalid loop in polygon: Edge 38 has duplicate vertex with edge 43'
Result:
[]
新潟駅の位置から
// GEO_POINT(経度, 緯度)
LET niigataCity = GEO_POINT(139.0613719, 37.9121356) // 新潟駅
FOR u IN niigata
FILTER
GEO_CONTAINS(u.geometry, niigataCity) == TRUE
RETURN
u
結果
Warnings:
[10], 'in function 'GEO_CONTAINS()': Invalid loop in polygon: Edge 557 has duplicate vertex with edge 709'
[10], 'in function 'GEO_CONTAINS()': Invalid loop in polygon: Edge 24 has duplicate vertex with edge 153'
[10], 'in function 'GEO_CONTAINS()': Invalid loop in polygon: Edge 38 has duplicate vertex with edge 43'
Result:
[
{
"_key": "61484547",
"_id": "niigata/61484547",
"_rev": "_dQI5KE--_8",
"type": "Feature",
"properties": {
"AREA": 194321.751,
"PERIMETER": 2498.279,
"H27KA15_": 992,
"H27KA15_ID": 991,
"KEN": "15",
"CITY": "103",
"KEN_NAME": "新潟県",
"SITYO_NAME": null,
"GST_NAME": "新潟市",
"CSS_NAME": "中央区",
"HCODE": 8101,
"KIHON1": "1330",
"DUMMY1": "-",
"KIHON2": "01",
"KEYCODE1": "103133001",
"KEYCODE2": "103133001",
"AREA_MAX_F": "M",
"KIGO_D": null,
"N_KEN": null,
"N_CITY": null,
"KIGO_E": null,
"KIGO_I": null,
"MOJI": "花園1丁目",
"KBSUM": 15,
"JINKO": 663,
"SETAI": 459,
"X_CODE": 139.06219,
"Y_CODE": 37.91246,
"KCODE1": "1330-01",
"KEY_CODE": "15103133001"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
139.0554783404258,
37.91088932501438
],
[
139.05539528327967,
37.91124041003866
],
[
139.0555016830144,
37.91127073963769
],
[
139.0558315871864,
37.911338302737526
],
[
139.0560599626144,
37.911385088838564
],
[
139.05647532815178,
37.9114750517179
],
[
139.05651250143805,
37.91147374931006
],
[
139.05661670302717,
37.91158419348418
],
[
139.0580004440336,
37.91193254090349
],
[
139.05909826061603,
37.912200580066184
],
[
139.059047176898,
37.91231302615712
],
[
139.059090043188,
37.912324648758755
],
[
139.05933905793927,
37.91239174237058
],
[
139.05939563613074,
37.912406959942054
],
[
139.0599081869983,
37.91254516416848
],
[
139.06014207233494,
37.91260838844639
],
[
139.0601925970606,
37.912621944164826
],
[
139.05996462482292,
37.91308324966267
],
[
139.06026292585784,
37.9131754499888
],
[
139.0609993476932,
37.91343196729782
],
[
139.0616599149543,
37.91364407277017
],
[
139.06224652963144,
37.913845969966985
],
[
139.06321254981947,
37.91416022316183
],
[
139.064481853773,
37.91458845701697
],
[
139.06474779669506,
37.914087400334665
],
[
139.0651225555596,
37.91336746542524
],
[
139.0654486610866,
37.913388283365535
],
[
139.0656888433652,
37.913297308686815
],
[
139.06594903281916,
37.91334842964258
],
[
139.06632726897317,
37.913424040836695
],
[
139.06677219944964,
37.9135128429551
],
[
139.06692105956188,
37.91320901970705
],
[
139.0666683919166,
37.91314209874869
],
[
139.06633884507343,
37.913054710533494
],
[
139.06574247703205,
37.91289666431122
],
[
139.06516270613008,
37.91274782662542
],
[
139.06445027070447,
37.91223485510596
],
[
139.0636143497179,
37.911628848725435
],
[
139.06323961044268,
37.91139215638139
],
[
139.06325109764893,
37.911366197285986
],
[
139.06213589419946,
37.9110823628014
],
[
139.0608468334461,
37.91078216965149
],
[
139.06096758103968,
37.91049523787253
],
[
139.06060433058295,
37.910495562271024
],
[
139.06009023177992,
37.910386229318355
],
[
139.05989103390388,
37.91033297607571
],
[
139.05964838847092,
37.910356092197276
],
[
139.05925038593216,
37.91042528031109
],
[
139.0592390279337,
37.9104271652511
],
[
139.05899736254358,
37.91045590842601
],
[
139.05869047034645,
37.91050030751772
],
[
139.05832567824572,
37.91053639438182
],
[
139.05793918305991,
37.91056976664504
],
[
139.0576408014137,
37.910564426096066
],
[
139.05752924063535,
37.910562420265784
],
[
139.0573390441916,
37.91055904134098
],
[
139.0571041011322,
37.9105548652281
],
[
139.05703533077443,
37.91055362904841
],
[
139.05656486852027,
37.91054517335115
],
[
139.05656514165605,
37.91058149386529
],
[
139.05615957514706,
37.91054174301619
],
[
139.05560561542868,
37.910487489079
],
[
139.0554783404258,
37.91088932501438
]
]
]
}
}
]
アオーレ長岡の位置から
// GEO_POINT(経度, 緯度)
LET nagaokaCity = GEO_POINT(138.8517256, 37.44662674) // アオーレ長岡
FOR u IN niigata
FILTER
GEO_CONTAINS(u.geometry, nagaokaCity) == TRUE
RETURN
u
結果
Warnings:
[10], 'in function 'GEO_CONTAINS()': Invalid loop in polygon: Edge 557 has duplicate vertex with edge 709'
[10], 'in function 'GEO_CONTAINS()': Invalid loop in polygon: Edge 24 has duplicate vertex with edge 153'
[10], 'in function 'GEO_CONTAINS()': Invalid loop in polygon: Edge 38 has duplicate vertex with edge 43'
Result:
[
{
"_key": "61486489",
"_id": "niigata/61486489",
"_rev": "_dQI5KEu--r",
"type": "Feature",
"properties": {
"AREA": 43011.87,
"PERIMETER": 1210.954,
"H27KA15_": 2081,
"H27KA15_ID": 2080,
"KEN": "15",
"CITY": "202",
"KEN_NAME": "新潟県",
"SITYO_NAME": null,
"GST_NAME": "長岡市",
"CSS_NAME": null,
"HCODE": 8101,
"KIHON1": "0250",
"DUMMY1": "-",
"KIHON2": "01",
"KEYCODE1": "202025001",
"KEYCODE2": "202025001",
"AREA_MAX_F": "M",
"KIGO_D": null,
"N_KEN": null,
"N_CITY": null,
"KIGO_E": null,
"KIGO_I": null,
"MOJI": "大手通1丁目",
"KBSUM": 1,
"JINKO": 29,
"SETAI": 16,
"X_CODE": 138.85127,
"Y_CODE": 37.44663,
"KCODE1": "0250-01",
"KEY_CODE": "15202025001"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
138.85128346157273,
37.447796670729005
],
[
138.85164306912517,
37.44770421778788
],
[
138.85163182623367,
37.447664547567044
],
[
138.85177970184415,
37.44762806079157
],
[
138.85180202691689,
37.44766333289283
],
[
138.85189405132851,
37.44763968451627
],
[
138.85194235634404,
37.447726130987654
],
[
138.85278433242047,
37.44750213305862
],
[
138.8528393509768,
37.44765979745545
],
[
138.85344528672184,
37.447495073323175
],
[
138.8530205456181,
37.44646389710626
],
[
138.85316087322127,
37.446427854868105
],
[
138.85304545751063,
37.44615590296927
],
[
138.8529445648628,
37.44618028171922
],
[
138.8528219477818,
37.44587864402651
],
[
138.85220146428765,
37.44602144340528
],
[
138.85238327330524,
37.44656239987407
],
[
138.85195455190092,
37.44667646133103
],
[
138.8518521707724,
37.446382787043525
],
[
138.85179167675201,
37.44640310415111
],
[
138.85164871284752,
37.44607350758639
],
[
138.85130940128462,
37.44534112647285
],
[
138.85128425494153,
37.445347669760494
],
[
138.8510725727471,
37.44544094608021
],
[
138.8507145157618,
37.44554676829776
],
[
138.85061368088037,
37.44557916640998
],
[
138.85092485179888,
37.44620707461262
],
[
138.8508532230416,
37.44622873471732
],
[
138.85088466009927,
37.446296350615484
],
[
138.85050647269242,
37.446417086050815
],
[
138.8508506360713,
37.44712271228595
],
[
138.85044574437836,
37.44725964614999
],
[
138.85070410346646,
37.44788259952691
],
[
138.85071709714094,
37.44792846232226
],
[
138.8512752011476,
37.447776563258834
],
[
138.85128346157273,
37.447796670729005
]
]
]
}
}
]
ワーニング
[10], 'in function 'GEO_CONTAINS()': Invalid loop in polygon: Edge 557 has duplicate vertex with edge 709'
[10], 'in function 'GEO_CONTAINS()': Invalid loop in polygon: Edge 24 has duplicate vertex with edge 153'
[10], 'in function 'GEO_CONTAINS()': Invalid loop in polygon: Edge 38 has duplicate vertex with edge 43'
内容からしてポリゴンデータで無効なループしてるっぽいんだけど、どこのデータがわからん…
Discussion