diff --git a/server/routes/fixtures/lancing_summary.rows.json b/server/routes/fixtures/lancing_summary.rows.json new file mode 100644 index 0000000..2284ddf --- /dev/null +++ b/server/routes/fixtures/lancing_summary.rows.json @@ -0,0 +1 @@ +[{"source":"wof","id":"102191581","type":"continent","bounds":"-24.539906,34.815009,69.033946,81.85871","centroid":"34.4425412370906,53.5665955","name":"Europe","abbr":null,"hierarchy":"{}"},{"source":"wof","id":"85633159","type":"country","bounds":"-8.649996,49.864632,1.768975,60.860867","centroid":"-1.92127540769231,54.314473","name":"United Kingdom","abbr":"GBR","hierarchy":"{\"empire\":{\"id\":\"136253055\",\"name\":\"United Kingdom\",\"abbr\":null,\"centroid\":\"-1.91165220035508,54.3140933285001\",\"bounds\":\"-130.753081835,-59.4727515599999,72.4946395190001,60.84788646\"},\"continent\":{\"id\":\"102191581\",\"name\":\"Europe\",\"abbr\":null,\"centroid\":\"34.4425412370906,53.5665955\",\"bounds\":\"-24.539906,34.815009,69.033946,81.85871\"}}"},{"source":"wof","id":"1880771683","type":"county","bounds":"-0.371517,50.81603,-0.215295,50.874738","centroid":"-0.293903293653248,50.845215","name":"Adur","abbr":null,"hierarchy":"{\"macrocounty\":{\"id\":\"1880762061\",\"name\":\"West Sussex\",\"abbr\":null,\"centroid\":\"-0.527606148029217,50.944699\",\"bounds\":\"-0.957597,50.722029,0.04455,51.167304\"},\"region\":{\"id\":\"1880762709\",\"name\":\"West Sussex\",\"abbr\":\"WSX\",\"centroid\":\"-0.527950792997637,50.944531\",\"bounds\":\"-0.957585,50.721769,0.044537,51.1673\"},\"macroregion\":{\"id\":\"404227469\",\"name\":\"England\",\"abbr\":null,\"centroid\":\"-1.46781061127396,52.884022\",\"bounds\":\"-6.419011,49.864632,1.768975,55.811664\"},\"country\":{\"id\":\"85633159\",\"name\":\"United Kingdom\",\"abbr\":\"GBR\",\"centroid\":\"-1.92127540769231,54.314473\",\"bounds\":\"-8.649996,49.864632,1.768975,60.860867\"},\"empire\":{\"id\":\"136253055\",\"name\":\"United Kingdom\",\"abbr\":null,\"centroid\":\"-1.91165220035508,54.3140933285001\",\"bounds\":\"-130.753081835,-59.4727515599999,72.4946395190001,60.84788646\"},\"continent\":{\"id\":\"102191581\",\"name\":\"Europe\",\"abbr\":null,\"centroid\":\"34.4425412370906,53.5665955\",\"bounds\":\"-24.539906,34.815009,69.033946,81.85871\"}}"},{"source":"wof","id":"136253055","type":"empire","bounds":"-130.753081835,-59.4727515599999,72.4946395190001,60.84788646","centroid":"-1.91165220035508,54.3140933285001","name":"United Kingdom","abbr":null,"hierarchy":"{\"continent\":{\"id\":\"102191569\",\"name\":\"Asia\",\"abbr\":null,\"centroid\":\"86.452113973758,39.5042785\",\"bounds\":\"-180.0,-12.199965,180.0,81.288804\"}}"},{"source":"wof","id":"404433635","type":"localadmin","bounds":"-0.33721134805332,50.8160406824397,-0.28436419706688,50.8499960063144","centroid":"-0.308561469179093,50.83314028254","name":"Lancing Civil Parish","abbr":null,"hierarchy":"{\"county\":{\"id\":\"1880771683\",\"name\":\"Adur\",\"abbr\":null,\"centroid\":\"-0.293903293653248,50.845215\",\"bounds\":\"-0.371517,50.81603,-0.215295,50.874738\"},\"macrocounty\":{\"id\":\"1880762061\",\"name\":\"West Sussex\",\"abbr\":null,\"centroid\":\"-0.527606148029217,50.944699\",\"bounds\":\"-0.957597,50.722029,0.04455,51.167304\"}}"},{"source":"wof","id":"1125843731","type":"locality","bounds":"-0.337211,50.816041,-0.284364,50.849996","centroid":"-0.308561668306394,50.83314","name":"Lancing","abbr":null,"hierarchy":"{\"localadmin\":{\"id\":\"404433635\",\"name\":\"Lancing Civil Parish\",\"abbr\":null,\"centroid\":\"-0.308561469179093,50.83314028254\",\"bounds\":\"-0.33721134805332,50.8160406824397,-0.28436419706688,50.8499960063144\"},\"county\":{\"id\":\"1880771683\",\"name\":\"Adur\",\"abbr\":null,\"centroid\":\"-0.293903293653248,50.845215\",\"bounds\":\"-0.371517,50.81603,-0.215295,50.874738\"},\"macrocounty\":{\"id\":\"1880762061\",\"name\":\"West Sussex\",\"abbr\":null,\"centroid\":\"-0.527606148029217,50.944699\",\"bounds\":\"-0.957597,50.722029,0.04455,51.167304\"}}"},{"source":"wof","id":"1880762061","type":"macrocounty","bounds":"-0.957597,50.722029,0.04455,51.167304","centroid":"-0.527606148029217,50.944699","name":"West Sussex","abbr":null,"hierarchy":"{\"region\":{\"id\":\"1880762709\",\"name\":\"West Sussex\",\"abbr\":\"WSX\",\"centroid\":\"-0.527950792997637,50.944531\",\"bounds\":\"-0.957585,50.721769,0.044537,51.1673\"},\"macroregion\":{\"id\":\"404227469\",\"name\":\"England\",\"abbr\":null,\"centroid\":\"-1.46781061127396,52.884022\",\"bounds\":\"-6.419011,49.864632,1.768975,55.811664\"},\"country\":{\"id\":\"85633159\",\"name\":\"United Kingdom\",\"abbr\":\"GBR\",\"centroid\":\"-1.92127540769231,54.314473\",\"bounds\":\"-8.649996,49.864632,1.768975,60.860867\"},\"empire\":{\"id\":\"136253055\",\"name\":\"United Kingdom\",\"abbr\":null,\"centroid\":\"-1.91165220035508,54.3140933285001\",\"bounds\":\"-130.753081835,-59.4727515599999,72.4946395190001,60.84788646\"},\"continent\":{\"id\":\"102191581\",\"name\":\"Europe\",\"abbr\":null,\"centroid\":\"34.4425412370906,53.5665955\",\"bounds\":\"-24.539906,34.815009,69.033946,81.85871\"}}"},{"source":"wof","id":"404227469","type":"macroregion","bounds":"-6.419011,49.864632,1.768975,55.811664","centroid":"-1.46781061127396,52.884022","name":"England","abbr":null,"hierarchy":"{\"country\":{\"id\":\"85633159\",\"name\":\"United Kingdom\",\"abbr\":\"GBR\",\"centroid\":\"-1.92127540769231,54.314473\",\"bounds\":\"-8.649996,49.864632,1.768975,60.860867\"},\"empire\":{\"id\":\"136253055\",\"name\":\"United Kingdom\",\"abbr\":null,\"centroid\":\"-1.91165220035508,54.3140933285001\",\"bounds\":\"-130.753081835,-59.4727515599999,72.4946395190001,60.84788646\"},\"continent\":{\"id\":\"102191581\",\"name\":\"Europe\",\"abbr\":null,\"centroid\":\"34.4425412370906,53.5665955\",\"bounds\":\"-24.539906,34.815009,69.033946,81.85871\"}}"},{"source":"wof","id":"1880762709","type":"region","bounds":"-0.957585,50.721769,0.044537,51.1673","centroid":"-0.527950792997637,50.944531","name":"West Sussex","abbr":"WSX","hierarchy":"{\"macroregion\":{\"id\":\"404227469\",\"name\":\"England\",\"abbr\":null,\"centroid\":\"-1.46781061127396,52.884022\",\"bounds\":\"-6.419011,49.864632,1.768975,55.811664\"},\"country\":{\"id\":\"85633159\",\"name\":\"United Kingdom\",\"abbr\":\"GBR\",\"centroid\":\"-1.92127540769231,54.314473\",\"bounds\":\"-8.649996,49.864632,1.768975,60.860867\"},\"empire\":{\"id\":\"136253055\",\"name\":\"United Kingdom\",\"abbr\":null,\"centroid\":\"-1.91165220035508,54.3140933285001\",\"bounds\":\"-130.753081835,-59.4727515599999,72.4946395190001,60.84788646\"},\"continent\":{\"id\":\"102191581\",\"name\":\"Europe\",\"abbr\":null,\"centroid\":\"34.4425412370906,53.5665955\",\"bounds\":\"-24.539906,34.815009,69.033946,81.85871\"}}"},{"source":"wof","id":"102047873","type":"timezone","bounds":"-8.650666,49.708694,1.759,60.845806","centroid":"-1.92172135629714,54.3147355","name":"Europe/London","abbr":null,"hierarchy":"{\"country\":{\"id\":\"85633159\",\"name\":\"United Kingdom\",\"abbr\":\"GBR\",\"centroid\":\"-1.92127540769231,54.314473\",\"bounds\":\"-8.649996,49.864632,1.768975,60.860867\"},\"empire\":{\"id\":\"136253055\",\"name\":\"United Kingdom\",\"abbr\":null,\"centroid\":\"-1.91165220035508,54.3140933285001\",\"bounds\":\"-130.753081835,-59.4727515599999,72.4946395190001,60.84788646\"},\"continent\":{\"id\":\"102191581\",\"name\":\"Europe\",\"abbr\":null,\"centroid\":\"34.4425412370906,53.5665955\",\"bounds\":\"-24.539906,34.815009,69.033946,81.85871\"}}"}] \ No newline at end of file diff --git a/server/routes/fixtures/lancing_verbose.rows.json b/server/routes/fixtures/lancing_verbose.rows.json new file mode 100644 index 0000000..c579547 --- /dev/null +++ b/server/routes/fixtures/lancing_verbose.rows.json @@ -0,0 +1 @@ +[{"source":"wof","id":"102191581","type":"continent","bounds":"-24.539906,34.815009,69.033946,81.85871","centroid":"34.4425412370906,53.5665955","name":"Europe","name_localized":"Europe","names":null,"abbr":null,"abbrs":null,"hierarchy":"{}","distance":0},{"source":"wof","id":"85633159","type":"country","bounds":"-8.649996,49.864632,1.768975,60.860867","centroid":"-1.92127540769231,54.314473","name":"United Kingdom","name_localized":"United Kingdom","names":null,"abbr":"GBR","abbrs":null,"hierarchy":"{\"continent\":{\"id\":\"102191581\",\"name\":\"Europe\",\"abbr\":null,\"centroid\":\"34.4425412370906,53.5665955\",\"bounds\":\"-24.539906,34.815009,69.033946,81.85871\"},\"empire\":{\"id\":\"136253055\",\"name\":\"United Kingdom\",\"abbr\":null,\"centroid\":\"-1.91165220035508,54.3140933285001\",\"bounds\":\"-130.753081835,-59.4727515599999,72.4946395190001,60.84788646\"}}","distance":0},{"source":"wof","id":"1880771683","type":"county","bounds":"-0.371517,50.81603,-0.215295,50.874738","centroid":"-0.293903293653248,50.845215","name":"Adur","name_localized":"Adur","names":null,"abbr":null,"abbrs":null,"hierarchy":"{\"continent\":{\"id\":\"102191581\",\"name\":\"Europe\",\"abbr\":null,\"centroid\":\"34.4425412370906,53.5665955\",\"bounds\":\"-24.539906,34.815009,69.033946,81.85871\"},\"empire\":{\"id\":\"136253055\",\"name\":\"United Kingdom\",\"abbr\":null,\"centroid\":\"-1.91165220035508,54.3140933285001\",\"bounds\":\"-130.753081835,-59.4727515599999,72.4946395190001,60.84788646\"},\"macrocounty\":{\"id\":\"1880762061\",\"name\":\"West Sussex\",\"abbr\":null,\"centroid\":\"-0.527606148029217,50.944699\",\"bounds\":\"-0.957597,50.722029,0.04455,51.167304\"},\"region\":{\"id\":\"1880762709\",\"name\":\"West Sussex\",\"abbr\":\"WSX\",\"centroid\":\"-0.527950792997637,50.944531\",\"bounds\":\"-0.957585,50.721769,0.044537,51.1673\"},\"macroregion\":{\"id\":\"404227469\",\"name\":\"England\",\"abbr\":null,\"centroid\":\"-1.46781061127396,52.884022\",\"bounds\":\"-6.419011,49.864632,1.768975,55.811664\"},\"country\":{\"id\":\"85633159\",\"name\":\"United Kingdom\",\"abbr\":\"GBR\",\"centroid\":\"-1.92127540769231,54.314473\",\"bounds\":\"-8.649996,49.864632,1.768975,60.860867\"}}","distance":0},{"source":"wof","id":"136253055","type":"empire","bounds":"-130.753081835,-59.4727515599999,72.4946395190001,60.84788646","centroid":"-1.91165220035508,54.3140933285001","name":"United Kingdom","name_localized":"United Kingdom","names":null,"abbr":null,"abbrs":null,"hierarchy":"{\"continent\":{\"id\":\"102191569\",\"name\":\"Asia\",\"abbr\":null,\"centroid\":\"86.452113973758,39.5042785\",\"bounds\":\"-180.0,-12.199965,180.0,81.288804\"}}","distance":0},{"source":"wof","id":"404433635","type":"localadmin","bounds":"-0.33721134805332,50.8160406824397,-0.28436419706688,50.8499960063144","centroid":"-0.308561469179093,50.83314028254","name":"Lancing Civil Parish","name_localized":"Lancing Civil Parish","names":null,"abbr":null,"abbrs":null,"hierarchy":"{\"macrocounty\":{\"id\":\"1880762061\",\"name\":\"West Sussex\",\"abbr\":null,\"centroid\":\"-0.527606148029217,50.944699\",\"bounds\":\"-0.957597,50.722029,0.04455,51.167304\"},\"county\":{\"id\":\"1880771683\",\"name\":\"Adur\",\"abbr\":null,\"centroid\":\"-0.293903293653248,50.845215\",\"bounds\":\"-0.371517,50.81603,-0.215295,50.874738\"}}","distance":0},{"source":"wof","id":"404444573","type":"localadmin","bounds":"-0.37153159623633,50.8209145979033,-0.32640575588762,50.8746788644057","centroid":"-0.347315401530332,50.8478112364921","name":"Sompting Civil Parish","name_localized":"Sompting Civil Parish","names":null,"abbr":null,"abbrs":null,"hierarchy":"{\"continent\":{\"id\":\"102191581\",\"name\":\"Europe\",\"abbr\":null,\"centroid\":\"34.4425412370906,53.5665955\",\"bounds\":\"-24.539906,34.815009,69.033946,81.85871\"},\"empire\":{\"id\":\"136253055\",\"name\":\"United Kingdom\",\"abbr\":null,\"centroid\":\"-1.91165220035508,54.3140933285001\",\"bounds\":\"-130.753081835,-59.4727515599999,72.4946395190001,60.84788646\"},\"macrocounty\":{\"id\":\"1880762061\",\"name\":\"West Sussex\",\"abbr\":null,\"centroid\":\"-0.527606148029217,50.944699\",\"bounds\":\"-0.957597,50.722029,0.04455,51.167304\"},\"region\":{\"id\":\"1880762709\",\"name\":\"West Sussex\",\"abbr\":\"WSX\",\"centroid\":\"-0.527950792997637,50.944531\",\"bounds\":\"-0.957585,50.721769,0.044537,51.1673\"},\"county\":{\"id\":\"1880771683\",\"name\":\"Adur\",\"abbr\":null,\"centroid\":\"-0.293903293653248,50.845215\",\"bounds\":\"-0.371517,50.81603,-0.215295,50.874738\"},\"macroregion\":{\"id\":\"404227469\",\"name\":\"England\",\"abbr\":null,\"centroid\":\"-1.46781061127396,52.884022\",\"bounds\":\"-6.419011,49.864632,1.768975,55.811664\"},\"country\":{\"id\":\"85633159\",\"name\":\"United Kingdom\",\"abbr\":\"GBR\",\"centroid\":\"-1.92127540769231,54.314473\",\"bounds\":\"-8.649996,49.864632,1.768975,60.860867\"}}","distance":0.00013378282517294838},{"source":"wof","id":"1125843731","type":"locality","bounds":"-0.337211,50.816041,-0.284364,50.849996","centroid":"-0.308561668306394,50.83314","name":"Lancing","name_localized":"Lancing","names":null,"abbr":null,"abbrs":null,"hierarchy":"{\"macrocounty\":{\"id\":\"1880762061\",\"name\":\"West Sussex\",\"abbr\":null,\"centroid\":\"-0.527606148029217,50.944699\",\"bounds\":\"-0.957597,50.722029,0.04455,51.167304\"},\"county\":{\"id\":\"1880771683\",\"name\":\"Adur\",\"abbr\":null,\"centroid\":\"-0.293903293653248,50.845215\",\"bounds\":\"-0.371517,50.81603,-0.215295,50.874738\"},\"localadmin\":{\"id\":\"404433635\",\"name\":\"Lancing Civil Parish\",\"abbr\":null,\"centroid\":\"-0.308561469179093,50.83314028254\",\"bounds\":\"-0.33721134805332,50.8160406824397,-0.28436419706688,50.8499960063144\"}}","distance":0},{"source":"wof","id":"1125795433","type":"locality","bounds":"-0.371532,50.820915,-0.326406,50.874679","centroid":"-0.347315167187499,50.847811","name":"Sompting","name_localized":"Sompting","names":null,"abbr":null,"abbrs":null,"hierarchy":"{\"continent\":{\"id\":\"102191581\",\"name\":\"Europe\",\"abbr\":null,\"centroid\":\"34.4425412370906,53.5665955\",\"bounds\":\"-24.539906,34.815009,69.033946,81.85871\"},\"empire\":{\"id\":\"136253055\",\"name\":\"United Kingdom\",\"abbr\":null,\"centroid\":\"-1.91165220035508,54.3140933285001\",\"bounds\":\"-130.753081835,-59.4727515599999,72.4946395190001,60.84788646\"},\"macrocounty\":{\"id\":\"1880762061\",\"name\":\"West Sussex\",\"abbr\":null,\"centroid\":\"-0.527606148029217,50.944699\",\"bounds\":\"-0.957597,50.722029,0.04455,51.167304\"},\"region\":{\"id\":\"1880762709\",\"name\":\"West Sussex\",\"abbr\":\"WSX\",\"centroid\":\"-0.527950792997637,50.944531\",\"bounds\":\"-0.957585,50.721769,0.044537,51.1673\"},\"county\":{\"id\":\"1880771683\",\"name\":\"Adur\",\"abbr\":null,\"centroid\":\"-0.293903293653248,50.845215\",\"bounds\":\"-0.371517,50.81603,-0.215295,50.874738\"},\"macroregion\":{\"id\":\"404227469\",\"name\":\"England\",\"abbr\":null,\"centroid\":\"-1.46781061127396,52.884022\",\"bounds\":\"-6.419011,49.864632,1.768975,55.811664\"},\"localadmin\":{\"id\":\"404444573\",\"name\":\"Sompting Civil Parish\",\"abbr\":null,\"centroid\":\"-0.347315401530332,50.8478112364921\",\"bounds\":\"-0.37153159623633,50.8209145979033,-0.32640575588762,50.8746788644057\"},\"country\":{\"id\":\"85633159\",\"name\":\"United Kingdom\",\"abbr\":\"GBR\",\"centroid\":\"-1.92127540769231,54.314473\",\"bounds\":\"-8.649996,49.864632,1.768975,60.860867\"}}","distance":0.0001338656388766779},{"source":"wof","id":"1880762061","type":"macrocounty","bounds":"-0.957597,50.722029,0.04455,51.167304","centroid":"-0.527606148029217,50.944699","name":"West Sussex","name_localized":"West Sussex","names":null,"abbr":null,"abbrs":null,"hierarchy":"{\"continent\":{\"id\":\"102191581\",\"name\":\"Europe\",\"abbr\":null,\"centroid\":\"34.4425412370906,53.5665955\",\"bounds\":\"-24.539906,34.815009,69.033946,81.85871\"},\"empire\":{\"id\":\"136253055\",\"name\":\"United Kingdom\",\"abbr\":null,\"centroid\":\"-1.91165220035508,54.3140933285001\",\"bounds\":\"-130.753081835,-59.4727515599999,72.4946395190001,60.84788646\"},\"region\":{\"id\":\"1880762709\",\"name\":\"West Sussex\",\"abbr\":\"WSX\",\"centroid\":\"-0.527950792997637,50.944531\",\"bounds\":\"-0.957585,50.721769,0.044537,51.1673\"},\"macroregion\":{\"id\":\"404227469\",\"name\":\"England\",\"abbr\":null,\"centroid\":\"-1.46781061127396,52.884022\",\"bounds\":\"-6.419011,49.864632,1.768975,55.811664\"},\"country\":{\"id\":\"85633159\",\"name\":\"United Kingdom\",\"abbr\":\"GBR\",\"centroid\":\"-1.92127540769231,54.314473\",\"bounds\":\"-8.649996,49.864632,1.768975,60.860867\"}}","distance":0},{"source":"wof","id":"404227469","type":"macroregion","bounds":"-6.419011,49.864632,1.768975,55.811664","centroid":"-1.46781061127396,52.884022","name":"England","name_localized":"England","names":null,"abbr":null,"abbrs":null,"hierarchy":"{\"continent\":{\"id\":\"102191581\",\"name\":\"Europe\",\"abbr\":null,\"centroid\":\"34.4425412370906,53.5665955\",\"bounds\":\"-24.539906,34.815009,69.033946,81.85871\"},\"empire\":{\"id\":\"136253055\",\"name\":\"United Kingdom\",\"abbr\":null,\"centroid\":\"-1.91165220035508,54.3140933285001\",\"bounds\":\"-130.753081835,-59.4727515599999,72.4946395190001,60.84788646\"},\"country\":{\"id\":\"85633159\",\"name\":\"United Kingdom\",\"abbr\":\"GBR\",\"centroid\":\"-1.92127540769231,54.314473\",\"bounds\":\"-8.649996,49.864632,1.768975,60.860867\"}}","distance":0},{"source":"wof","id":"1880762709","type":"region","bounds":"-0.957585,50.721769,0.044537,51.1673","centroid":"-0.527950792997637,50.944531","name":"West Sussex","name_localized":"West Sussex","names":null,"abbr":"WSX","abbrs":null,"hierarchy":"{\"continent\":{\"id\":\"102191581\",\"name\":\"Europe\",\"abbr\":null,\"centroid\":\"34.4425412370906,53.5665955\",\"bounds\":\"-24.539906,34.815009,69.033946,81.85871\"},\"empire\":{\"id\":\"136253055\",\"name\":\"United Kingdom\",\"abbr\":null,\"centroid\":\"-1.91165220035508,54.3140933285001\",\"bounds\":\"-130.753081835,-59.4727515599999,72.4946395190001,60.84788646\"},\"macroregion\":{\"id\":\"404227469\",\"name\":\"England\",\"abbr\":null,\"centroid\":\"-1.46781061127396,52.884022\",\"bounds\":\"-6.419011,49.864632,1.768975,55.811664\"},\"country\":{\"id\":\"85633159\",\"name\":\"United Kingdom\",\"abbr\":\"GBR\",\"centroid\":\"-1.92127540769231,54.314473\",\"bounds\":\"-8.649996,49.864632,1.768975,60.860867\"}}","distance":0},{"source":"wof","id":"102047873","type":"timezone","bounds":"-8.650666,49.708694,1.759,60.845806","centroid":"-1.92172135629714,54.3147355","name":"Europe/London","name_localized":"Europe/London","names":null,"abbr":null,"abbrs":null,"hierarchy":"{\"continent\":{\"id\":\"102191581\",\"name\":\"Europe\",\"abbr\":null,\"centroid\":\"34.4425412370906,53.5665955\",\"bounds\":\"-24.539906,34.815009,69.033946,81.85871\"},\"empire\":{\"id\":\"136253055\",\"name\":\"United Kingdom\",\"abbr\":null,\"centroid\":\"-1.91165220035508,54.3140933285001\",\"bounds\":\"-130.753081835,-59.4727515599999,72.4946395190001,60.84788646\"},\"country\":{\"id\":\"85633159\",\"name\":\"United Kingdom\",\"abbr\":\"GBR\",\"centroid\":\"-1.92127540769231,54.314473\",\"bounds\":\"-8.649996,49.864632,1.768975,60.860867\"}}","distance":0}] \ No newline at end of file diff --git a/server/routes/fixtures/martinborough_summary.0.0.rows.json b/server/routes/fixtures/martinborough_summary.0.0.rows.json deleted file mode 100644 index d9b1df5..0000000 --- a/server/routes/fixtures/martinborough_summary.0.0.rows.json +++ /dev/null @@ -1 +0,0 @@ -[{"source":"wof","id":"85633345","type":"country","bounds":"-176.893092,-47.289993,178.577174,-33.958498","centroid":"171.211792793069,-43.586223","name":"New Zealand","abbr":"NZL","hierarchy":"{}","distance":0},{"source":"wof","id":"102079347","type":"county","bounds":"174.958653,-41.613549,175.809775,-40.921064","centroid":"175.417743019556,-41.2673995","name":"South Wairarapa District","abbr":"SP","hierarchy":"{\"region\":{\"id\":\"85687233\",\"name\":\"Wellington Region\",\"abbr\":\"WG\",\"centroid\":\"175.416663466846,-41.2214985\",\"bounds\":\"174.388038,-41.815112,176.56406,-40.628591\"},\"country\":{\"id\":\"85633345\",\"name\":\"New Zealand\",\"abbr\":\"NZL\",\"centroid\":\"171.211792793069,-43.586223\",\"bounds\":\"-176.893092,-47.289993,178.577174,-33.958498\"}}","distance":0},{"source":"wof","id":"101914287","type":"locality","bounds":"175.400001,-41.301336,175.564123,-41.145135","centroid":"175.479717715759,-41.2232135","name":"Martinborough","abbr":null,"hierarchy":"{\"county\":{\"id\":\"102079347\",\"name\":\"South Wairarapa District\",\"abbr\":\"SP\",\"centroid\":\"175.417743019556,-41.2673995\",\"bounds\":\"174.958653,-41.613549,175.809775,-40.921064\"},\"region\":{\"id\":\"85687233\",\"name\":\"Wellington Region\",\"abbr\":\"WG\",\"centroid\":\"175.416663466846,-41.2214985\",\"bounds\":\"174.388038,-41.815112,176.56406,-40.628591\"},\"country\":{\"id\":\"85633345\",\"name\":\"New Zealand\",\"abbr\":\"NZL\",\"centroid\":\"171.211792793069,-43.586223\",\"bounds\":\"-176.893092,-47.289993,178.577174,-33.958498\"}}","distance":0},{"source":"wof","id":"1729339735","type":"locality","bounds":"175.290524,-41.335574,175.439075,-41.215716","centroid":"175.37998759782,-41.275665","name":"Dyerville","abbr":null,"hierarchy":"{\"county\":{\"id\":\"102079347\",\"name\":\"South Wairarapa District\",\"abbr\":\"SP\",\"centroid\":\"175.417743019556,-41.2673995\",\"bounds\":\"174.958653,-41.613549,175.809775,-40.921064\"},\"region\":{\"id\":\"85687233\",\"name\":\"Wellington Region\",\"abbr\":\"WG\",\"centroid\":\"175.416663466846,-41.2214985\",\"bounds\":\"174.388038,-41.815112,176.56406,-40.628591\"},\"country\":{\"id\":\"85633345\",\"name\":\"New Zealand\",\"abbr\":\"NZL\",\"centroid\":\"171.211792793069,-43.586223\",\"bounds\":\"-176.893092,-47.289993,178.577174,-33.958498\"}}","distance":0.00013074145292661256},{"source":"wof","id":"85687233","type":"region","bounds":"174.388038,-41.815112,176.56406,-40.628591","centroid":"175.416663466846,-41.2214985","name":"Wellington Region","abbr":"WG","hierarchy":"{\"country\":{\"id\":\"85633345\",\"name\":\"New Zealand\",\"abbr\":\"NZL\",\"centroid\":\"171.211792793069,-43.586223\",\"bounds\":\"-176.893092,-47.289993,178.577174,-33.958498\"}}","distance":0}] \ No newline at end of file diff --git a/server/routes/fixtures/oamaru_summary.0.0.rows.json b/server/routes/fixtures/oamaru_summary.0.0.rows.json deleted file mode 100644 index a59fbd5..0000000 --- a/server/routes/fixtures/oamaru_summary.0.0.rows.json +++ /dev/null @@ -1 +0,0 @@ -[{"source":"wof","id":"85633345","type":"country","bounds":"-176.893092,-47.289993,178.577174,-33.958498","centroid":"171.211792793069,-43.586223","name":"New Zealand","abbr":"NZL","hierarchy":"{}","distance":0},{"source":"wof","id":"102079381","type":"county","bounds":"169.542497,-45.575812,171.144216,-43.788862","centroid":"170.185891754622,-44.6831305","name":"Waitaki District","abbr":"WI","hierarchy":"{\"region\":{\"id\":\"85687179\",\"name\":\"Canterbury Region\",\"abbr\":\"CA\",\"centroid\":\"171.809768703811,-43.494176\",\"bounds\":\"169.542498,-45.080929,174.264103,-41.907383\"},\"country\":{\"id\":\"85633345\",\"name\":\"New Zealand\",\"abbr\":\"NZL\",\"centroid\":\"171.211792793069,-43.586223\",\"bounds\":\"-176.893092,-47.289993,178.577174,-33.958498\"}}","distance":0},{"source":"wof","id":"1729238521","type":"localadmin","bounds":"170.897807,-45.122193,171.01932,-45.024824","centroid":"170.95695134316,-45.073514","name":"Oamaru","abbr":null,"hierarchy":"{\"county\":{\"id\":\"102079381\",\"name\":\"Waitaki District\",\"abbr\":\"WI\",\"centroid\":\"170.185891754622,-44.6831305\",\"bounds\":\"169.542497,-45.575812,171.144216,-43.788862\"},\"region\":{\"id\":\"85687201\",\"name\":\"Otago Region\",\"abbr\":\"OT\",\"centroid\":\"170.177803464208,-45.3973235\",\"bounds\":\"168.116395,-46.839379,171.406801,-43.955411\"},\"country\":{\"id\":\"85633345\",\"name\":\"New Zealand\",\"abbr\":\"NZL\",\"centroid\":\"171.211792793069,-43.586223\",\"bounds\":\"-176.893092,-47.289993,178.577174,-33.958498\"}}","distance":0},{"source":"wof","id":"101914699","type":"locality","bounds":"170.949378,-45.103048,170.983274,-45.083577","centroid":"170.967650942297,-45.0927995","name":"Oamaru","abbr":null,"hierarchy":"{\"localadmin\":{\"id\":\"1729238521\",\"name\":\"Oamaru\",\"abbr\":null,\"centroid\":\"170.95695134316,-45.073514\",\"bounds\":\"170.897807,-45.122193,171.01932,-45.024824\"},\"county\":{\"id\":\"102079381\",\"name\":\"Waitaki District\",\"abbr\":\"WI\",\"centroid\":\"170.185891754622,-44.6831305\",\"bounds\":\"169.542497,-45.575812,171.144216,-43.788862\"},\"region\":{\"id\":\"85687201\",\"name\":\"Otago Region\",\"abbr\":\"OT\",\"centroid\":\"170.177803464208,-45.3973235\",\"bounds\":\"168.116395,-46.839379,171.406801,-43.955411\"},\"country\":{\"id\":\"85633345\",\"name\":\"New Zealand\",\"abbr\":\"NZL\",\"centroid\":\"171.211792793069,-43.586223\",\"bounds\":\"-176.893092,-47.289993,178.577174,-33.958498\"}}","distance":0},{"source":"wof","id":"85687201","type":"region","bounds":"168.116395,-46.839379,171.406801,-43.955411","centroid":"170.177803464208,-45.3973235","name":"Otago Region","abbr":"OT","hierarchy":"{\"country\":{\"id\":\"85633345\",\"name\":\"New Zealand\",\"abbr\":\"NZL\",\"centroid\":\"171.211792793069,-43.586223\",\"bounds\":\"-176.893092,-47.289993,178.577174,-33.958498\"}}","distance":0}] \ No newline at end of file diff --git a/server/routes/fixtures/update.ts b/server/routes/fixtures/update.ts index 44d39c5..c88d559 100644 --- a/server/routes/fixtures/update.ts +++ b/server/routes/fixtures/update.ts @@ -55,4 +55,24 @@ writeFixture( hierarchy: 1 }, 'oamaru_verbose.rows.json' -) \ No newline at end of file +) + +// writeFixture( +// service.module.pip.statement.summary, +// { lon: -0.332593, lat: 50.830056 }, +// 'lancing_summary.rows.json' +// ) + +// writeFixture( +// service.module.pip.statement.verbose, +// { +// lon: -0.332593, +// lat: 50.830056, +// limit: 1000, +// aliaslimit: 0, +// sources: '\u001ewof\u001e', +// lang: 'und', +// hierarchy: 1 +// }, +// 'lancing_verbose.rows.json' +// ) \ No newline at end of file diff --git a/server/routes/pip_pelias.js b/server/routes/pip_pelias.js index f47fe69..9e1d5e4 100644 --- a/server/routes/pip_pelias.js +++ b/server/routes/pip_pelias.js @@ -28,6 +28,15 @@ const displayLayers = new Set([ 'ocean' ]) +// layers which should be added from the 'pure pip' results if not +// present in the hierarchy. +const hoistLayers = new Set([ + 'country', + 'dependency', + 'empire', + 'continent' +]) + // a custom 'view' which emulates the legacy pelias PIP format (with some additions!) // see: https://github.com/pelias/wof-admin-lookup function controller (req, res) { @@ -117,6 +126,13 @@ function remapFromHierarchy (resp, searchLayers) { mapped[placetype] = _.uniqBy(mapped[placetype], 'id') } + // 'hoist' some layers from the pure pip results if not already present + for (const placetype of hoistLayers) { + if (!mapped[placetype] && resp[placetype]) { + mapped[placetype] = resp[placetype].map(normalize) + } + } + return mapped } diff --git a/server/routes/pip_pelias.test.js b/server/routes/pip_pelias.test.js index 2ea3712..511d765 100644 --- a/server/routes/pip_pelias.test.js +++ b/server/routes/pip_pelias.test.js @@ -313,3 +313,82 @@ tap.test('pelias - layer filter', (t) => { }) t.end() }) + +// at time of writin the locality of lancing has -1 values for {region, county, continent} +// https://spelunker.whosonfirst.org/id/1125843731 +tap.test('remapFromHierarchy - Lancing', (t) => { + let res = mock.createResponse() + let req = mock.createRequest({ + params: { lon: -0.332593, lat: 50.830056 }, + app: proxy((query) => { + t.same(query, { + lon: -0.332593, + lat: 50.830056 + }) + return require('./fixtures/lancing_summary.rows.json') + }) + }) + + pelias(req, res) + t.equal(200, res.statusCode) + t.same(res._getJSONData(), { + locality: [ + { + id: 1125843731, + name: 'Lancing', + centroid: { lat: 50.83314, lon: -0.3085617 }, + bounding_box: '-0.337211,50.816041,-0.284364,50.849996' + } + ], + localadmin: [ + { + id: 404433635, + name: 'Lancing Civil Parish', + centroid: { lat: 50.8331403, lon: -0.3085615 }, + bounding_box: '-0.3372113,50.8160407,-0.2843642,50.849996' + } + ], + county: [ + { + id: 1880771683, + name: 'Adur', + centroid: { lat: 50.845215, lon: -0.2939033 }, + bounding_box: '-0.371517,50.81603,-0.215295,50.874738' + } + ], + macrocounty: [ + { + id: 1880762061, + name: 'West Sussex', + centroid: { lat: 50.944699, lon: -0.5276061 }, + bounding_box: '-0.957597,50.722029,0.04455,51.167304' + } + ], + country: [ + { + id: 85633159, + name: 'United Kingdom', + abbr: 'GBR', + centroid: { lat: 54.314473, lon: -1.9212754 }, + bounding_box: '-8.649996,49.864632,1.768975,60.860867' + } + ], + empire: [ + { + id: 136253055, + name: 'United Kingdom', + centroid: { lat: 54.3140933, lon: -1.9116522 }, + bounding_box: '-130.7530818,-59.4727516,72.4946395,60.8478865' + } + ], + continent: [ + { + id: 102191581, + name: 'Europe', + centroid: { lat: 53.5665955, lon: 34.4425412 }, + bounding_box: '-24.539906,34.815009,69.033946,81.85871' + } + ] + }) + t.end() +})