Polecenie geodezyjne (mapki)
--- Polecenie, które pokaże pierwsze 2000 danych ---
curl -s "http://localhost:9200/test/test/_search?size=2000&pretty=1"
| jq .hits.hits[].\"_source\"
| jq "{type:\"Feature\",
properties: {objectid, pcd2, pcds, dointr, doterm, oseast100m, osnrth100m,oscty, odslaua, oslaua, osward, usertype, osgrdind, ctry, oshlthau, gor, oldha, nhscr, ccg, psed, cened ,edind, ward98, oa01, nhsrg, hro, lsoa01, ur01ind, msoa01, cannet, scn, oshaprev, oldpct, oldhro, pcon, canreg, pct, oseast1m, osnrth1m, oa11, lsoa11,msoa11,},
geometry: {type:\"Point\", coordinates: .location}}"
| jq --slurp .
| jq {type:\"FeatureCollection\",features:.} > map1.geojson
Z właściwości, które podane są w poleceniu, faktycznie na mapie wykorzystywane są tylko 15 z 42. Oto one:
objectid
pcd2
pcds
dointr
doterm
oseast1m
usertype
ctry
ccg
hro
pct
osnrth1m
oa11
lsoa11
msoa11
--- Polecenie, które wyświetli poligon pomiędzy miejscowościami Aberdeen, Gilcomston, Kittybrewster. ---
(współrzędne: [-2.1, 57.15]), (współrzędne: [-2.11,57.14]), (współrzędne: [-2.12,57.16])
curl -XGET localhost:9200/test/_search?pretty -d "{\"size\":100,\"query\":{\"bool\":{\"must\":{\"match_all\":{}}, \"filter\":{\"geo_polygon\":{\"location\":{\"points\":[[-2.1, 57.15],[-2.11,57.14],[-2.12,57.16]]}}}}}}"
| jq .hits.hits[]._source
| jq "{type:\"Feature\",
properties: {objectid, pcd2, pcds, dointr, doterm, oseast100m, osnrth100m,oscty, odslaua, oslaua, osward, usertype, osgrdind, ctry, oshlthau, gor, oldha, nhscr, ccg, psed, cened ,edind, ward98, oa01, nhsrg, hro, lsoa01, ur01ind, msoa01, cannet, scn, oshaprev, oldpct, oldhro, pcon, canreg, pct, oseast1m, osnrth1m, oa11, lsoa11,msoa11,},
geometry: {type:\"Point\", coordinates: .location}}"
| jq --slurp .
| jq {type:\"FeatureCollection\",features:.} > map2.geojson