diff --git a/test/ignores.json b/test/ignores.json index 40fb7d909fa..5576c43bce6 100644 --- a/test/ignores.json +++ b/test/ignores.json @@ -1,4 +1,19 @@ { + "expression-tests/distance/invalid-geometry-input": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397", + "expression-tests/distance/line-to-line-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397", + "expression-tests/distance/line-to-lines-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397", + "expression-tests/distance/lines-to-lines-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397", + "expression-tests/distance/point-to-line-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397", + "expression-tests/distance/point-to-lines-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397", + "expression-tests/distance/point-to-point-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397", + "expression-tests/distance/point-to-points-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397", + "expression-tests/distance/points-to-line-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397", + "expression-tests/distance/points-to-lines-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397", + "expression-tests/distance/points-to-points-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397", + "expression-tests/distance/points-to-polygons-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16446", + "expression-tests/distance/lines-to-polygons-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16446", + "expression-tests/distance/polygon-to-polygons-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16446", + "expression-tests/distance/polygons-to-polygons-distance": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16446", "query-tests/regressions/mapbox-gl-js#4494": "https://github.com/mapbox/mapbox-gl-js/issues/2716", "render-tests/geojson/inline-linestring-fill": "current behavior is arbitrary", "render-tests/line-dasharray/case/square": "https://github.com/mapbox/mapbox-gl-js/issues/9531", @@ -25,5 +40,10 @@ "render-tests/tile-mode/streets-v11": "skip - mapbox-gl-js does not support tile-mode", "render-tests/within/paint-line": "https://github.com/mapbox/mapbox-gl-js/issues/7023", "render-tests/icon-text-fit/text-variable-anchor-tile-map-mode": "skip - mapbox-gl-js does not support tile-mode", - "render-tests/text-variable-anchor/all-anchors-labels-priority-tile-map-mode": "skip - mapbox-gl-js does not support tile-mode" + "render-tests/text-variable-anchor/all-anchors-labels-priority-tile-map-mode": "skip - mapbox-gl-js does not support tile-mode", + "render-tests/distance/filter-with-distance-expression": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397", + "render-tests/distance/paint-circle": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397", + "render-tests/distance/paint-line": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397", + "render-tests/distance/symbol-style": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16397", + "render-tests/distance/paint-polygon": "TODO: port https://github.com/mapbox/mapbox-gl-native/pull/16446" } diff --git a/test/integration/expression-tests/distance/invalid-geometry-input/test.json b/test/integration/expression-tests/distance/invalid-geometry-input/test.json new file mode 100644 index 00000000000..4269498e09d --- /dev/null +++ b/test/integration/expression-tests/distance/invalid-geometry-input/test.json @@ -0,0 +1,55 @@ +{ + "expression": ["distance", { + "type": "Unknown", + "coordinates": [[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]] + }], + "inputs": [[{ + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, { + "geometry": { + "type": "Point", + "coordinates": [6, 6] + } + }], [{ + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, { + "geometry": { + "type": "Point", + "coordinates": [2, 2] + } + }], [{ + "zoom": 3, + "canonicalID": { + "z": 3, + "x": 3, + "y": 3 + } + }, { + "geometry": { + "type": "LineString", + "coordinates": [[3, 3], [4, 1]] + } + }]], + "expected": { + "compiled": { + "errors": [{ + "error": "Unknown not yet implemented", + "key": "" + }, { + "key": "", + "error": "'distance' expression needs to be an array with format [\"distance\", GeoJSONObj]." + }], + "result": "error" + } + } +} diff --git a/test/integration/expression-tests/distance/line-to-line-distance/test.json b/test/integration/expression-tests/distance/line-to-line-distance/test.json new file mode 100644 index 00000000000..ab5ed281d17 --- /dev/null +++ b/test/integration/expression-tests/distance/line-to-line-distance/test.json @@ -0,0 +1,86 @@ +{ + "expression": ["distance", { + "type": "Feature", + "properties": { + "stroke": "#d7d47e", + "stroke-width": 2, + "stroke-opacity": -1, + "value": true + }, + "geometry": { + "type": "LineString", + "coordinates": [[103.89315605163574, 1.3430843400832895], [103.89646053314209, 1.341239486566936], [103.89864921569824, 1.339909475029482], [103.90238285064697, 1.3386652700342137], [103.90551567077637, 1.338021715478541], [103.90847682952881, 1.337549775363733]] + } + }], + "inputs": [[{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "LineString", + "coordinates": [[103.88373613357544, 1.3323584281174479], [103.88704061508179, 1.3331092434795238], [103.88867139816284, 1.3334739251442105], [103.88972282409668, 1.3337957030387755], [103.89111757278441, 1.334331999436213], [103.89274835586547, 1.3351900734288747], [103.89476537704467, 1.3366702503621644]] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "LineString", + "coordinates": [[103.90201807022095, 1.3571781167763333], [103.90379905700684, 1.3606103787570532], [103.90506505966187, 1.363012959238619], [103.9055585861206, 1.3638924747085997], [103.90648126602173, 1.365887472021871], [103.90686750411988, 1.3668527927080132]] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "LineString", + "coordinates": [[103.95070552825928, 1.3499059956258364], [103.95280838012696, 1.3506782573132619], [103.95396709442139, 1.3515792289717337], [103.95486831665039, 1.3527376206128572], [103.95525455474852, 1.3542392385837099], [103.95538330078125, 1.35514020891972]] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "LineString", + "coordinates": [[103.90637397766113, 1.3406817398811269], [103.90603065490723, 1.334331999436213]] + } + }]], + "expected": { + "outputs": [530.029, 1841.19, 4894.16, 0], + "serialized": ["distance", { + "properties": { + "stroke-opacity": -1, + "value": true, + "stroke-width": 2, + "stroke": "#d7d47e" + }, + "geometry": { + "type": "LineString", + "coordinates": [[103.89315605163574, 1.3430843400832895], [103.89646053314209, 1.341239486566936], [103.89864921569824, 1.339909475029482], [103.90238285064697, 1.3386652700342137], [103.90551567077637, 1.338021715478541], [103.90847682952881, 1.337549775363733]] + }, + "type": "Feature" + }], + "compiled": { + "type": "number", + "isFeatureConstant": false, + "isZoomConstant": true, + "result": "success" + } + } +} diff --git a/test/integration/expression-tests/distance/line-to-lines-distance/test.json b/test/integration/expression-tests/distance/line-to-lines-distance/test.json new file mode 100644 index 00000000000..b98e9dfc784 --- /dev/null +++ b/test/integration/expression-tests/distance/line-to-lines-distance/test.json @@ -0,0 +1,40 @@ +{ + "expression": ["distance", { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "LineString", + "coordinates": [[103.89315605163574, 1.3430843400832895], [103.89646053314209, 1.341239486566936], [103.89864921569824, 1.339909475029482], [103.90238285064697, 1.3386652700342137], [103.90551567077637, 1.338021715478541], [103.90847682952881, 1.337549775363733]] + } + }], + "inputs": [[{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "MultiLineString", + "coordinates": [[[103.88373613357544, 1.3323584281174479], [103.88704061508179, 1.3331092434795238], [103.88867139816284, 1.3334739251442105], [103.88972282409668, 1.3337957030387755], [103.89111757278441, 1.334331999436213], [103.89274835586547, 1.3351900734288747], [103.89476537704467, 1.3366702503621644]], [[103.90201807022095, 1.3571781167763333], [103.90379905700684, 1.3606103787570532], [103.90506505966187, 1.363012959238619], [103.9055585861206, 1.3638924747085997], [103.90648126602173, 1.365887472021871], [103.90686750411988, 1.3668527927080132]], [[103.95070552825928, 1.3499059956258364], [103.95280838012696, 1.3506782573132619], [103.95396709442139, 1.3515792289717337], [103.95486831665039, 1.3527376206128572], [103.95525455474852, 1.3542392385837099], [103.95538330078125, 1.35514020891972]]] + } + }]], + "expected": { + "outputs": [530.029], + "serialized": ["distance", { + "properties": {}, + "geometry": { + "type": "LineString", + "coordinates": [[103.89315605163574, 1.3430843400832895], [103.89646053314209, 1.341239486566936], [103.89864921569824, 1.339909475029482], [103.90238285064697, 1.3386652700342137], [103.90551567077637, 1.338021715478541], [103.90847682952881, 1.337549775363733]] + }, + "type": "Feature" + }], + "compiled": { + "type": "number", + "isFeatureConstant": false, + "isZoomConstant": true, + "result": "success" + } + } +} diff --git a/test/integration/expression-tests/distance/lines-to-lines-distance/test.json b/test/integration/expression-tests/distance/lines-to-lines-distance/test.json new file mode 100644 index 00000000000..718ad4b7d95 --- /dev/null +++ b/test/integration/expression-tests/distance/lines-to-lines-distance/test.json @@ -0,0 +1,40 @@ +{ + "expression": ["distance", { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "MultiLineString", + "coordinates": [[[103.89341354370116, 1.3396949569719253], [103.8960313796997, 1.3380646191208426], [103.8982629776001, 1.3356620139971914]], [[103.901309967041, 1.3559982755948157], [103.89989376068115, 1.3525231036839903]], [[103.95074844360352, 1.349755833602559], [103.95249724388123, 1.3503886592092312]]] + } + }], + "inputs": [[{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "MultiLineString", + "coordinates": [[[103.88373613357544, 1.3323584281174479], [103.88704061508179, 1.3331092434795238], [103.88867139816284, 1.3334739251442105], [103.88972282409668, 1.3337957030387755], [103.89111757278441, 1.334331999436213], [103.89274835586547, 1.3351900734288747], [103.89476537704467, 1.3366702503621644]], [[103.90201807022095, 1.3571781167763333], [103.90379905700684, 1.3606103787570532], [103.90506505966187, 1.363012959238619], [103.9055585861206, 1.3638924747085997], [103.90648126602173, 1.365887472021871], [103.90686750411988, 1.3668527927080132]], [[103.95070552825928, 1.3499059956258364], [103.95280838012696, 1.3506782573132619], [103.95396709442139, 1.3515792289717337], [103.95486831665039, 1.3527376206128572], [103.95525455474852, 1.3542392385837099], [103.95538330078125, 1.35514020891972]]] + } + }]], + "expected": { + "outputs": [17.2408], + "serialized": ["distance", { + "properties": {}, + "geometry": { + "type": "MultiLineString", + "coordinates": [[[103.89341354370116, 1.3396949569719253], [103.8960313796997, 1.3380646191208426], [103.8982629776001, 1.3356620139971914]], [[103.901309967041, 1.3559982755948157], [103.89989376068115, 1.3525231036839903]], [[103.95074844360352, 1.349755833602559], [103.95249724388123, 1.3503886592092312]]] + }, + "type": "Feature" + }], + "compiled": { + "type": "number", + "isFeatureConstant": false, + "isZoomConstant": true, + "result": "success" + } + } +} diff --git a/test/integration/expression-tests/distance/lines-to-polygons-distance/test.json b/test/integration/expression-tests/distance/lines-to-polygons-distance/test.json new file mode 100644 index 00000000000..b6e9d1a975c --- /dev/null +++ b/test/integration/expression-tests/distance/lines-to-polygons-distance/test.json @@ -0,0 +1,76 @@ +{ + "expression": ["distance", { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "MultiPolygon", + "coordinates": [[[[103.88809204101563, 1.3621763466641713], [103.88465881347656, 1.3565131154538628], [103.8896369934082, 1.3535956881386369], [103.90422821044922, 1.3575427948432913], [103.90079498291016, 1.364064087445756], [103.88809204101563, 1.3621763466641713]]], [[[103.87899398803711, 1.3395233425123459], [103.87521743774414, 1.330256143886628], [103.8819122314453, 1.3275103005613949], [103.88998031616211, 1.3299129136379467], [103.89392852783203, 1.3369491241772669], [103.88757705688477, 1.341239486566936], [103.87899398803711, 1.3395233425123459]]], [[[103.91864776611328, 1.3503350299269142], [103.91469955444336, 1.3393517280407568], [103.92414093017578, 1.3324871393386304], [103.93529891967774, 1.335232977120653], [103.93667221069336, 1.3432988578436807], [103.93598556518555, 1.351021484651125], [103.91864776611328, 1.3503350299269142]]]] + } + }], + "inputs": [[{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "MultiLineString", + "coordinates": [[[103.88373613357544, 1.3323584281174479], [103.88704061508179, 1.3331092434795238], [103.88867139816284, 1.3334739251442105], [103.88972282409668, 1.3337957030387755], [103.89111757278441, 1.334331999436213], [103.89274835586547, 1.3351900734288747], [103.89476537704467, 1.3366702503621644]], [[103.90201807022095, 1.3571781167763333], [103.90379905700684, 1.3606103787570532], [103.90506505966187, 1.363012959238619], [103.9055585861206, 1.3638924747085997], [103.90648126602173, 1.365887472021871], [103.90686750411988, 1.3668527927080132]], [[103.95070552825928, 1.3499059956258364], [103.95280838012696, 1.3506782573132619], [103.95396709442139, 1.3515792289717337], [103.95486831665039, 1.3527376206128572], [103.95525455474852, 1.3542392385837099], [103.95538330078125, 1.35514020891972]]] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "MultiLineString", + "coordinates": [[[103.8906455039978, 1.352630362150803], [103.89532327651978, 1.3537029465580084]], [[103.90356302261353, 1.359130216376035], [103.90398144721985, 1.3583257799188356]]] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "LineString", + "coordinates": [[103.92019271850586, 1.3529092341423024], [103.91701698303223, 1.3336884437452606]] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "LineString", + "coordinates": [[103.88586044311522, 1.3379788118355014], [103.88628959655762, 1.3329161766939824]] + } + }]], + "expected": { + "outputs": [0, 16.2699, 0, 0], + "serialized": ["distance", { + "properties": {}, + "geometry": { + "type": "MultiPolygon", + "coordinates": [[[[103.88809204101563, 1.3621763466641713], [103.88465881347656, 1.3565131154538628], [103.8896369934082, 1.3535956881386369], [103.90422821044922, 1.3575427948432913], [103.90079498291016, 1.364064087445756], [103.88809204101563, 1.3621763466641713]]], [[[103.87899398803711, 1.3395233425123459], [103.87521743774414, 1.330256143886628], [103.8819122314453, 1.3275103005613949], [103.88998031616211, 1.3299129136379467], [103.89392852783203, 1.3369491241772669], [103.88757705688477, 1.341239486566936], [103.87899398803711, 1.3395233425123459]]], [[[103.91864776611328, 1.3503350299269142], [103.91469955444336, 1.3393517280407568], [103.92414093017578, 1.3324871393386304], [103.93529891967774, 1.335232977120653], [103.93667221069336, 1.3432988578436807], [103.93598556518555, 1.351021484651125], [103.91864776611328, 1.3503350299269142]]]] + }, + "type": "Feature" + }], + "compiled": { + "type": "number", + "isFeatureConstant": false, + "isZoomConstant": true, + "result": "success" + } + } +} diff --git a/test/integration/expression-tests/distance/point-to-line-distance/test.json b/test/integration/expression-tests/distance/point-to-line-distance/test.json new file mode 100644 index 00000000000..4cb999c9ca4 --- /dev/null +++ b/test/integration/expression-tests/distance/point-to-line-distance/test.json @@ -0,0 +1,94 @@ +{ + "expression": ["distance", { + "type": "FeatureCollection", + "features": [{ + "type": "Feature", + "properties": {}, + "geometry": { + "type": "LineString", + "coordinates": [[103.87667655944823, 1.3198734077978092], [103.87895107269286, 1.3198305038395005], [103.88148307800293, 1.320860198634505], [103.88474464416504, 1.3220186047688565], [103.88603210449219, 1.322136590548516], [103.88659000396729, 1.3221794944670043], [103.8875126838684, 1.322190220446512], [103.88829588890076, 1.3222974802390178], [103.88919711112976, 1.3224583699190876], [103.89040946960449, 1.3228123271785267], [103.89161109924317, 1.3230912025594926], [103.89283418655396, 1.3233486259602608], [103.89425039291382, 1.323606049334287], [103.89545202255249, 1.3238205687922547], [103.89678239822388, 1.3240565401745568], [103.89828443527222, 1.3243568673559299], [103.90021562576294, 1.3247644541867095], [103.90227556228638, 1.3251505890171647], [103.9038634300232, 1.3255152718573336], [103.90473783016205, 1.3258102358799509], [103.90523135662079, 1.3259550363872928], [103.90625596046448, 1.326287541223903], [103.90744686126709, 1.3265985940951497], [103.90831589698792, 1.3268989209681999], [103.9093565940857, 1.3272850554657019], [103.9100432395935, 1.327714093725527], [103.91063332557678, 1.3280358723715427], [103.91147017478943, 1.3285185402619937], [103.91221046447754, 1.3288724966550625], [103.91329407691956, 1.3293658903304729], [103.91475319862366, 1.3300738028229565], [103.91640543937683, 1.330856796706907], [103.91727447509766, 1.3312643824659285], [103.91828298568726, 1.3317041459724615]] + } + }] + }], + "inputs": [[{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "Point", + "coordinates": [103.91959190368653, 1.3218898930028449] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "Point", + "coordinates": [103.92658710479737, 1.3294838757599914] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "Point", + "coordinates": [103.91602993011475, 1.330642277859313] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "Point", + "coordinates": [103.91246795654297, 1.3363484728438336] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "Point", + "coordinates": [103.8917827606201, 1.3479324368661275] + } + }]], + "expected": { + "outputs": [1048.1155337, 956.2168839, 3.6580301, 736.057893, 2696.576472], + "serialized": ["distance", { + "features": [{ + "properties": {}, + "geometry": { + "type": "LineString", + "coordinates": [[103.87667655944823, 1.3198734077978092], [103.87895107269286, 1.3198305038395005], [103.88148307800293, 1.320860198634505], [103.88474464416504, 1.3220186047688565], [103.88603210449219, 1.322136590548516], [103.88659000396729, 1.3221794944670043], [103.8875126838684, 1.322190220446512], [103.88829588890076, 1.3222974802390178], [103.88919711112976, 1.3224583699190876], [103.89040946960449, 1.3228123271785267], [103.89161109924317, 1.3230912025594926], [103.89283418655396, 1.3233486259602608], [103.89425039291382, 1.323606049334287], [103.89545202255249, 1.3238205687922547], [103.89678239822388, 1.3240565401745568], [103.89828443527222, 1.3243568673559299], [103.90021562576294, 1.3247644541867095], [103.90227556228638, 1.3251505890171647], [103.9038634300232, 1.3255152718573336], [103.90473783016205, 1.3258102358799509], [103.90523135662079, 1.3259550363872928], [103.90625596046448, 1.326287541223903], [103.90744686126709, 1.3265985940951497], [103.90831589698792, 1.3268989209681999], [103.9093565940857, 1.3272850554657019], [103.9100432395935, 1.327714093725527], [103.91063332557678, 1.3280358723715427], [103.91147017478943, 1.3285185402619937], [103.91221046447754, 1.3288724966550625], [103.91329407691956, 1.3293658903304729], [103.91475319862366, 1.3300738028229565], [103.91640543937683, 1.330856796706907], [103.91727447509766, 1.3312643824659285], [103.91828298568726, 1.3317041459724615]] + }, + "type": "Feature" + }], + "type": "FeatureCollection" + }], + "compiled": { + "type": "number", + "isFeatureConstant": false, + "isZoomConstant": true, + "result": "success" + } + } +} diff --git a/test/integration/expression-tests/distance/point-to-lines-distance/test.json b/test/integration/expression-tests/distance/point-to-lines-distance/test.json new file mode 100644 index 00000000000..f5a5fde84c0 --- /dev/null +++ b/test/integration/expression-tests/distance/point-to-lines-distance/test.json @@ -0,0 +1,88 @@ +{ + "expression": ["distance", { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "MultiLineString", + "coordinates": [[[103.87667655944823, 1.3198734077978092], [103.87895107269286, 1.3198305038395005], [103.88148307800293, 1.320860198634505], [103.88474464416504, 1.3220186047688565], [103.88603210449219, 1.322136590548516]], [[103.88659000396729, 1.3221794944670043], [103.8875126838684, 1.322190220446512], [103.88829588890076, 1.3222974802390178], [103.88919711112976, 1.3224583699190876], [103.89040946960449, 1.3228123271785267], [103.89161109924317, 1.3230912025594926], [103.89283418655396, 1.3233486259602608], [103.89425039291382, 1.323606049334287], [103.89545202255249, 1.3238205687922547], [103.89678239822388, 1.3240565401745568], [103.89828443527222, 1.3243568673559299], [103.90021562576294, 1.3247644541867095], [103.90227556228638, 1.3251505890171647], [103.9038634300232, 1.3255152718573336], [103.90473783016205, 1.3258102358799509], [103.90523135662079, 1.3259550363872928], [103.90625596046448, 1.326287541223903], [103.90744686126709, 1.3265985940951497], [103.90831589698792, 1.3268989209681999], [103.9093565940857, 1.3272850554657019], [103.9100432395935, 1.327714093725527], [103.91063332557678, 1.3280358723715427], [103.91147017478943, 1.3285185402619937], [103.91221046447754, 1.3288724966550625], [103.91329407691956, 1.3293658903304729], [103.91475319862366, 1.3300738028229565], [103.91640543937683, 1.330856796706907], [103.91727447509766, 1.3312643824659285], [103.91828298568726, 1.3317041459724615]]] + } + }], + "inputs": [[{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "Point", + "coordinates": [103.91959190368653, 1.3218898930028449] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "Point", + "coordinates": [103.92658710479737, 1.3294838757599914] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "Point", + "coordinates": [103.91602993011475, 1.330642277859313] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "Point", + "coordinates": [103.91246795654297, 1.3363484728438336] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "Point", + "coordinates": [103.8917827606201, 1.3479324368661275] + } + }]], + "expected": { + "outputs": [1048.1155337, 956.2168839, 3.6580301, 736.057893, 2696.576472], + "serialized": ["distance", { + "properties": {}, + "geometry": { + "type": "MultiLineString", + "coordinates": [[[103.87667655944823, 1.3198734077978092], [103.87895107269286, 1.3198305038395005], [103.88148307800293, 1.320860198634505], [103.88474464416504, 1.3220186047688565], [103.88603210449219, 1.322136590548516]], [[103.88659000396729, 1.3221794944670043], [103.8875126838684, 1.322190220446512], [103.88829588890076, 1.3222974802390178], [103.88919711112976, 1.3224583699190876], [103.89040946960449, 1.3228123271785267], [103.89161109924317, 1.3230912025594926], [103.89283418655396, 1.3233486259602608], [103.89425039291382, 1.323606049334287], [103.89545202255249, 1.3238205687922547], [103.89678239822388, 1.3240565401745568], [103.89828443527222, 1.3243568673559299], [103.90021562576294, 1.3247644541867095], [103.90227556228638, 1.3251505890171647], [103.9038634300232, 1.3255152718573336], [103.90473783016205, 1.3258102358799509], [103.90523135662079, 1.3259550363872928], [103.90625596046448, 1.326287541223903], [103.90744686126709, 1.3265985940951497], [103.90831589698792, 1.3268989209681999], [103.9093565940857, 1.3272850554657019], [103.9100432395935, 1.327714093725527], [103.91063332557678, 1.3280358723715427], [103.91147017478943, 1.3285185402619937], [103.91221046447754, 1.3288724966550625], [103.91329407691956, 1.3293658903304729], [103.91475319862366, 1.3300738028229565], [103.91640543937683, 1.330856796706907], [103.91727447509766, 1.3312643824659285], [103.91828298568726, 1.3317041459724615]]] + }, + "type": "Feature" + }], + "compiled": { + "type": "number", + "isFeatureConstant": false, + "isZoomConstant": true, + "result": "success" + } + } +} diff --git a/test/integration/expression-tests/distance/point-to-point-distance/test.json b/test/integration/expression-tests/distance/point-to-point-distance/test.json new file mode 100644 index 00000000000..dc9968dc9a8 --- /dev/null +++ b/test/integration/expression-tests/distance/point-to-point-distance/test.json @@ -0,0 +1,88 @@ +{ + "expression": ["distance", { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [103.91959190368653, 1.3321439094005239] + } + }], + "inputs": [[{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "Point", + "coordinates": [103.91959190368653, 1.3218898930028449] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "Point", + "coordinates": [103.92658710479737, 1.3294838757599914] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "Point", + "coordinates": [103.91602993011475, 1.330642277859313] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "Point", + "coordinates": [103.91246795654297, 1.3363484728438336] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "Point", + "coordinates": [103.8917827606201, 1.3479324368661275] + } + }]], + "expected": { + "outputs": [1133.83, 832.206, 429.781, 919.082, 3553.3], + "serialized": ["distance", { + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [103.91959190368653, 1.3321439094005239] + }, + "type": "Feature" + }], + "compiled": { + "type": "number", + "isFeatureConstant": false, + "isZoomConstant": true, + "result": "success" + } + } +} diff --git a/test/integration/expression-tests/distance/point-to-points-distance/test.json b/test/integration/expression-tests/distance/point-to-points-distance/test.json new file mode 100644 index 00000000000..40cf0cea774 --- /dev/null +++ b/test/integration/expression-tests/distance/point-to-points-distance/test.json @@ -0,0 +1,88 @@ +{ + "expression": ["distance", { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "MultiPoint", + "coordinates": [[103.88174057006836, 1.3316290644037233], [103.88568878173828, 1.330084528768254], [103.88139724731446, 1.3288832226055889], [103.88448715209961, 1.3271670699311869], [103.88156890869139, 1.3263089931473214], [103.88895034790039, 1.3285399921660488], [103.91641616821289, 1.360631830379095], [103.91899108886719, 1.3602886044036287], [103.91710281372069, 1.3596021523062254], [103.91435623168946, 1.3620047337924648], [103.91332626342774, 1.3599453783793346], [103.95761489868164, 1.351021484651125], [103.95967483520508, 1.3518795527836272], [103.95538330078125, 1.3556550489612674], [103.95418167114258, 1.355483435626243], [103.95452499389649, 1.353767301607359]] + } + }], + "inputs": [[{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "Point", + "coordinates": [103.91959190368653, 1.3218898930028449] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "Point", + "coordinates": [103.92658710479737, 1.3294838757599914] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "Point", + "coordinates": [103.91602993011475, 1.330642277859313] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "Point", + "coordinates": [103.91246795654297, 1.3363484728438336] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "Point", + "coordinates": [103.8917827606201, 1.3479324368661275] + } + }]], + "expected": { + "outputs": [3488.48, 3493.58, 3022.62, 2610.96, 2086.8], + "serialized": ["distance", { + "properties": {}, + "geometry": { + "type": "MultiPoint", + "coordinates": [[103.88174057006836, 1.3316290644037233], [103.88568878173828, 1.330084528768254], [103.88139724731446, 1.3288832226055889], [103.88448715209961, 1.3271670699311869], [103.88156890869139, 1.3263089931473214], [103.88895034790039, 1.3285399921660488], [103.91641616821289, 1.360631830379095], [103.91899108886719, 1.3602886044036287], [103.91710281372069, 1.3596021523062254], [103.91435623168946, 1.3620047337924648], [103.91332626342774, 1.3599453783793346], [103.95761489868164, 1.351021484651125], [103.95967483520508, 1.3518795527836272], [103.95538330078125, 1.3556550489612674], [103.95418167114258, 1.355483435626243], [103.95452499389649, 1.353767301607359]] + }, + "type": "Feature" + }], + "compiled": { + "type": "number", + "isFeatureConstant": false, + "isZoomConstant": true, + "result": "success" + } + } +} diff --git a/test/integration/expression-tests/distance/points-to-line-distance/test.json b/test/integration/expression-tests/distance/points-to-line-distance/test.json new file mode 100644 index 00000000000..9ae5667057f --- /dev/null +++ b/test/integration/expression-tests/distance/points-to-line-distance/test.json @@ -0,0 +1,64 @@ +{ + "expression": ["distance", { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "MultiPoint", + "coordinates": [[103.88174057006836, 1.3316290644037233], [103.88568878173828, 1.330084528768254], [103.88139724731446, 1.3288832226055889], [103.88448715209961, 1.3271670699311869], [103.88156890869139, 1.3263089931473214], [103.88895034790039, 1.3285399921660488], [103.91641616821289, 1.360631830379095], [103.91899108886719, 1.3602886044036287], [103.91710281372069, 1.3596021523062254], [103.91435623168946, 1.3620047337924648], [103.91332626342774, 1.3599453783793346], [103.95761489868164, 1.351021484651125], [103.95967483520508, 1.3518795527836272], [103.95538330078125, 1.3556550489612674], [103.95418167114258, 1.355483435626243], [103.95452499389649, 1.353767301607359]] + } + }], + "inputs": [[{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "LineString", + "coordinates": [[103.88373613357544, 1.3323584281174479], [103.88704061508179, 1.3331092434795238], [103.88867139816284, 1.3334739251442105], [103.88972282409668, 1.3337957030387755], [103.89111757278441, 1.334331999436213], [103.89274835586547, 1.3351900734288747], [103.89476537704467, 1.3366702503621644]] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "LineString", + "coordinates": [[103.90201807022095, 1.3571781167763333], [103.90379905700684, 1.3606103787570532], [103.90506505966187, 1.363012959238619], [103.9055585861206, 1.3638924747085997], [103.90648126602173, 1.365887472021871], [103.90686750411988, 1.3668527927080132]] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "LineString", + "coordinates": [[103.95070552825928, 1.3499059956258364], [103.95280838012696, 1.3506782573132619], [103.95396709442139, 1.3515792289717337], [103.95486831665039, 1.3527376206128572], [103.95525455474852, 1.3542392385837099], [103.95538330078125, 1.35514020891972]] + } + }]], + "expected": { + "outputs": [236.275, 968.383, 56.9283], + "serialized": ["distance", { + "properties": {}, + "geometry": { + "type": "MultiPoint", + "coordinates": [[103.88174057006836, 1.3316290644037233], [103.88568878173828, 1.330084528768254], [103.88139724731446, 1.3288832226055889], [103.88448715209961, 1.3271670699311869], [103.88156890869139, 1.3263089931473214], [103.88895034790039, 1.3285399921660488], [103.91641616821289, 1.360631830379095], [103.91899108886719, 1.3602886044036287], [103.91710281372069, 1.3596021523062254], [103.91435623168946, 1.3620047337924648], [103.91332626342774, 1.3599453783793346], [103.95761489868164, 1.351021484651125], [103.95967483520508, 1.3518795527836272], [103.95538330078125, 1.3556550489612674], [103.95418167114258, 1.355483435626243], [103.95452499389649, 1.353767301607359]] + }, + "type": "Feature" + }], + "compiled": { + "type": "number", + "isFeatureConstant": false, + "isZoomConstant": true, + "result": "success" + } + } +} diff --git a/test/integration/expression-tests/distance/points-to-lines-distance/test.json b/test/integration/expression-tests/distance/points-to-lines-distance/test.json new file mode 100644 index 00000000000..eff3774112e --- /dev/null +++ b/test/integration/expression-tests/distance/points-to-lines-distance/test.json @@ -0,0 +1,40 @@ +{ + "expression": ["distance", { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "MultiPoint", + "coordinates": [[103.88174057006836, 1.3316290644037233], [103.88568878173828, 1.330084528768254], [103.88139724731446, 1.3288832226055889], [103.88448715209961, 1.3271670699311869], [103.88156890869139, 1.3263089931473214], [103.88895034790039, 1.3285399921660488], [103.91641616821289, 1.360631830379095], [103.91899108886719, 1.3602886044036287], [103.91710281372069, 1.3596021523062254], [103.91435623168946, 1.3620047337924648], [103.91332626342774, 1.3599453783793346], [103.95761489868164, 1.351021484651125], [103.95967483520508, 1.3518795527836272], [103.95538330078125, 1.3556550489612674], [103.95418167114258, 1.355483435626243], [103.95452499389649, 1.353767301607359]] + } + }], + "inputs": [[{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "MultiLineString", + "coordinates": [[[103.88373613357544, 1.3323584281174479], [103.88704061508179, 1.3331092434795238], [103.88867139816284, 1.3334739251442105], [103.88972282409668, 1.3337957030387755], [103.89111757278441, 1.334331999436213], [103.89274835586547, 1.3351900734288747], [103.89476537704467, 1.3366702503621644]], [[103.90201807022095, 1.3571781167763333], [103.90379905700684, 1.3606103787570532], [103.90506505966187, 1.363012959238619], [103.9055585861206, 1.3638924747085997], [103.90648126602173, 1.365887472021871], [103.90686750411988, 1.3668527927080132]], [[103.95070552825928, 1.3499059956258364], [103.95280838012696, 1.3506782573132619], [103.95396709442139, 1.3515792289717337], [103.95486831665039, 1.3527376206128572], [103.95525455474852, 1.3542392385837099], [103.95538330078125, 1.35514020891972]]] + } + }]], + "expected": { + "outputs": [56.9283], + "serialized": ["distance", { + "properties": {}, + "geometry": { + "type": "MultiPoint", + "coordinates": [[103.88174057006836, 1.3316290644037233], [103.88568878173828, 1.330084528768254], [103.88139724731446, 1.3288832226055889], [103.88448715209961, 1.3271670699311869], [103.88156890869139, 1.3263089931473214], [103.88895034790039, 1.3285399921660488], [103.91641616821289, 1.360631830379095], [103.91899108886719, 1.3602886044036287], [103.91710281372069, 1.3596021523062254], [103.91435623168946, 1.3620047337924648], [103.91332626342774, 1.3599453783793346], [103.95761489868164, 1.351021484651125], [103.95967483520508, 1.3518795527836272], [103.95538330078125, 1.3556550489612674], [103.95418167114258, 1.355483435626243], [103.95452499389649, 1.353767301607359]] + }, + "type": "Feature" + }], + "compiled": { + "type": "number", + "isFeatureConstant": false, + "isZoomConstant": true, + "result": "success" + } + } +} diff --git a/test/integration/expression-tests/distance/points-to-points-distance/test.json b/test/integration/expression-tests/distance/points-to-points-distance/test.json new file mode 100644 index 00000000000..f6fcc7a0079 --- /dev/null +++ b/test/integration/expression-tests/distance/points-to-points-distance/test.json @@ -0,0 +1,52 @@ +{ + "expression": ["distance", { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "MultiPoint", + "coordinates": [[103.88174057006836, 1.3316290644037233], [103.88568878173828, 1.330084528768254], [103.88139724731446, 1.3288832226055889], [103.88448715209961, 1.3271670699311869], [103.88156890869139, 1.3263089931473214], [103.88895034790039, 1.3285399921660488], [103.91641616821289, 1.360631830379095], [103.91899108886719, 1.3602886044036287], [103.91710281372069, 1.3596021523062254], [103.91435623168946, 1.3620047337924648], [103.91332626342774, 1.3599453783793346], [103.95761489868164, 1.351021484651125], [103.95967483520508, 1.3518795527836272], [103.95538330078125, 1.3556550489612674], [103.95418167114258, 1.355483435626243], [103.95452499389649, 1.353767301607359]] + } + }], + "inputs": [[{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "MultiPoint", + "coordinates": [[103.9174461364746, 1.3414111009062396], [103.91487121582031, 1.3372923534446709], [103.92053604125977, 1.338150426403194], [103.91693115234375, 1.3338600586126377], [103.92448425292969, 1.3350613623490613], [103.92105102539061, 1.3328303692289015], [103.8841438293457, 1.3596021523062254], [103.88311386108399, 1.3582292475259675], [103.88843536376953, 1.3592589261843265], [103.88620376586913, 1.3575427948432913], [103.8863754272461, 1.354625368768736], [103.92173767089844, 1.3616615080124246], [103.9222526550293, 1.3602886044036287], [103.91984939575196, 1.3601169913975755]] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "MultiPoint", + "coordinates": [[103.92173767089844, 1.3616615080124246], [103.9222526550293, 1.3602886044036287], [103.91984939575196, 1.3601169913975755]] + } + }]], + "expected": { + "outputs": [97.3869, 97.3861], + "serialized": ["distance", { + "properties": {}, + "geometry": { + "type": "MultiPoint", + "coordinates": [[103.88174057006836, 1.3316290644037233], [103.88568878173828, 1.330084528768254], [103.88139724731446, 1.3288832226055889], [103.88448715209961, 1.3271670699311869], [103.88156890869139, 1.3263089931473214], [103.88895034790039, 1.3285399921660488], [103.91641616821289, 1.360631830379095], [103.91899108886719, 1.3602886044036287], [103.91710281372069, 1.3596021523062254], [103.91435623168946, 1.3620047337924648], [103.91332626342774, 1.3599453783793346], [103.95761489868164, 1.351021484651125], [103.95967483520508, 1.3518795527836272], [103.95538330078125, 1.3556550489612674], [103.95418167114258, 1.355483435626243], [103.95452499389649, 1.353767301607359]] + }, + "type": "Feature" + }], + "compiled": { + "type": "number", + "isFeatureConstant": false, + "isZoomConstant": true, + "result": "success" + } + } +} diff --git a/test/integration/expression-tests/distance/points-to-polygons-distance/test.json b/test/integration/expression-tests/distance/points-to-polygons-distance/test.json new file mode 100644 index 00000000000..c2c8e8e3d9c --- /dev/null +++ b/test/integration/expression-tests/distance/points-to-polygons-distance/test.json @@ -0,0 +1,52 @@ +{ + "expression": ["distance", { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "MultiPolygon", + "coordinates": [[[[103.88809204101563, 1.3621763466641713], [103.88465881347656, 1.3565131154538628], [103.8896369934082, 1.3535956881386369], [103.90422821044922, 1.3575427948432913], [103.90079498291016, 1.364064087445756], [103.88809204101563, 1.3621763466641713]]], [[[103.87899398803711, 1.3395233425123459], [103.87521743774414, 1.330256143886628], [103.8819122314453, 1.3275103005613949], [103.88998031616211, 1.3299129136379467], [103.89392852783203, 1.3369491241772669], [103.88757705688477, 1.341239486566936], [103.87899398803711, 1.3395233425123459]]], [[[103.91864776611328, 1.3503350299269142], [103.91469955444336, 1.3393517280407568], [103.92414093017578, 1.3324871393386304], [103.93529891967774, 1.335232977120653], [103.93667221069336, 1.3432988578436807], [103.93598556518555, 1.351021484651125], [103.91864776611328, 1.3503350299269142]]]] + } + }], + "inputs": [[{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "MultiPoint", + "coordinates": [[103.89710426330567, 1.3539389150639312], [103.89427185058594, 1.3505924504712264], [103.8947868347168, 1.3469027533998386], [103.89315605163574, 1.342011750998951], [103.89813423156738, 1.33746396806039], [103.89504432678223, 1.3371207388169673], [103.89684677124024, 1.3424407866891553], [103.8907527923584, 1.3466453324652597], [103.90019416809082, 1.3497343818841974], [103.90122413635254, 1.346044683512217], [103.90088081359863, 1.341239486566936]] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "MultiPoint", + "coordinates": [[103.9116096496582, 1.3415827152334823], [103.91263961791992, 1.3388797881819073], [103.91062259674072, 1.338021715478541], [103.9130687713623, 1.3377642936089936], [103.8913106918335, 1.3353616881914719]] + } + }]], + "expected": { + "outputs": [125.617, 0], + "serialized": ["distance", { + "properties": {}, + "geometry": { + "type": "MultiPolygon", + "coordinates": [[[[103.88809204101563, 1.3621763466641713], [103.88465881347656, 1.3565131154538628], [103.8896369934082, 1.3535956881386369], [103.90422821044922, 1.3575427948432913], [103.90079498291016, 1.364064087445756], [103.88809204101563, 1.3621763466641713]]], [[[103.87899398803711, 1.3395233425123459], [103.87521743774414, 1.330256143886628], [103.8819122314453, 1.3275103005613949], [103.88998031616211, 1.3299129136379467], [103.89392852783203, 1.3369491241772669], [103.88757705688477, 1.341239486566936], [103.87899398803711, 1.3395233425123459]]], [[[103.91864776611328, 1.3503350299269142], [103.91469955444336, 1.3393517280407568], [103.92414093017578, 1.3324871393386304], [103.93529891967774, 1.335232977120653], [103.93667221069336, 1.3432988578436807], [103.93598556518555, 1.351021484651125], [103.91864776611328, 1.3503350299269142]]]] + }, + "type": "Feature" + }], + "compiled": { + "type": "number", + "isFeatureConstant": false, + "isZoomConstant": true, + "result": "success" + } + } +} diff --git a/test/integration/expression-tests/distance/polygon-to-polygons-distance/test.json b/test/integration/expression-tests/distance/polygon-to-polygons-distance/test.json new file mode 100644 index 00000000000..dc2b5098373 --- /dev/null +++ b/test/integration/expression-tests/distance/polygon-to-polygons-distance/test.json @@ -0,0 +1,88 @@ +{ + "expression": ["distance", { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "MultiPolygon", + "coordinates": [[[[103.88809204101563, 1.3621763466641713], [103.88465881347656, 1.3565131154538628], [103.8896369934082, 1.3535956881386369], [103.90422821044922, 1.3575427948432913], [103.90079498291016, 1.364064087445756], [103.88809204101563, 1.3621763466641713]]], [[[103.87899398803711, 1.3395233425123459], [103.87521743774414, 1.330256143886628], [103.8819122314453, 1.3275103005613949], [103.88998031616211, 1.3299129136379467], [103.89392852783203, 1.3369491241772669], [103.88757705688477, 1.341239486566936], [103.87899398803711, 1.3395233425123459]]], [[[103.91864776611328, 1.3503350299269142], [103.91469955444336, 1.3393517280407568], [103.92414093017578, 1.3324871393386304], [103.93529891967774, 1.335232977120653], [103.93667221069336, 1.3432988578436807], [103.93598556518555, 1.351021484651125], [103.91864776611328, 1.3503350299269142]]]] + } + }], + "inputs": [[{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "Polygon", + "coordinates": [[[103.89933586120604, 1.3423549795571295], [103.90757560729979, 1.3423549795571295], [103.90757560729979, 1.3493053474771307], [103.89933586120604, 1.3493053474771307], [103.89933586120604, 1.3423549795571295]]] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "Polygon", + "coordinates": [[[103.88174057006836, 1.33746396806039], [103.88096809387207, 1.3306851816303256], [103.89015197753905, 1.3329161766939824], [103.888521194458, 1.336434280186183], [103.88671875, 1.3384936555025502], [103.88431549072266, 1.3378930045471449], [103.88174057006836, 1.33746396806039]]] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "Polygon", + "coordinates": [[[103.92388343811035, 1.3539389150639312], [103.91633033752442, 1.3341174808912555], [103.93160820007324, 1.333173599071337], [103.9368438720703, 1.339437535278059], [103.92388343811035, 1.3539389150639312]]] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "Polygon", + "coordinates": [[[103.90088081359863, 1.3581434409513023], [103.90474319458008, 1.355740855624212], [103.91392707824707, 1.3597737653488802], [103.9098072052002, 1.3628627980287112], [103.90088081359863, 1.3581434409513023]]] + } + }], [{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "Polygon", + "coordinates": [[[103.87710571289063, 1.3415827152334823], [103.87384414672852, 1.3264806085279129], [103.88362884521485, 1.3247644541867095], [103.89736175537108, 1.3340316734680562], [103.89684677124024, 1.3407246434768526], [103.88809204101563, 1.3448433851623303], [103.87710571289063, 1.3415827152334823]]] + } + }]], + "expected": { + "outputs": [738.312, 0, 0, 0, 0], + "serialized": ["distance", { + "properties": {}, + "geometry": { + "type": "MultiPolygon", + "coordinates": [[[[103.88809204101563, 1.3621763466641713], [103.88465881347656, 1.3565131154538628], [103.8896369934082, 1.3535956881386369], [103.90422821044922, 1.3575427948432913], [103.90079498291016, 1.364064087445756], [103.88809204101563, 1.3621763466641713]]], [[[103.87899398803711, 1.3395233425123459], [103.87521743774414, 1.330256143886628], [103.8819122314453, 1.3275103005613949], [103.88998031616211, 1.3299129136379467], [103.89392852783203, 1.3369491241772669], [103.88757705688477, 1.341239486566936], [103.87899398803711, 1.3395233425123459]]], [[[103.91864776611328, 1.3503350299269142], [103.91469955444336, 1.3393517280407568], [103.92414093017578, 1.3324871393386304], [103.93529891967774, 1.335232977120653], [103.93667221069336, 1.3432988578436807], [103.93598556518555, 1.351021484651125], [103.91864776611328, 1.3503350299269142]]]] + }, + "type": "Feature" + }], + "compiled": { + "type": "number", + "isFeatureConstant": false, + "isZoomConstant": true, + "result": "success" + } + } +} diff --git a/test/integration/expression-tests/distance/polygons-to-polygons-distance/test.json b/test/integration/expression-tests/distance/polygons-to-polygons-distance/test.json new file mode 100644 index 00000000000..0f539b70000 --- /dev/null +++ b/test/integration/expression-tests/distance/polygons-to-polygons-distance/test.json @@ -0,0 +1,40 @@ +{ + "expression": ["distance", { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "MultiPolygon", + "coordinates": [[[[103.88809204101563, 1.3621763466641713], [103.88465881347656, 1.3565131154538628], [103.8896369934082, 1.3535956881386369], [103.90422821044922, 1.3575427948432913], [103.90079498291016, 1.364064087445756], [103.88809204101563, 1.3621763466641713]]], [[[103.87899398803711, 1.3395233425123459], [103.87521743774414, 1.330256143886628], [103.8819122314453, 1.3275103005613949], [103.88998031616211, 1.3299129136379467], [103.89392852783203, 1.3369491241772669], [103.88757705688477, 1.341239486566936], [103.87899398803711, 1.3395233425123459]]], [[[103.91864776611328, 1.3503350299269142], [103.91469955444336, 1.3393517280407568], [103.92414093017578, 1.3324871393386304], [103.93529891967774, 1.335232977120653], [103.93667221069336, 1.3432988578436807], [103.93598556518555, 1.351021484651125], [103.91864776611328, 1.3503350299269142]]]] + } + }], + "inputs": [[{ + "zoom": 13, + "canonicalID": { + "z": 13, + "x": 6460, + "y": 4065 + } + }, { + "geometry": { + "type": "MultiPolygon", + "coordinates": [[[[103.89873504638672, 1.3544537553607755], [103.89607429504393, 1.3513647119405166], [103.89856338500977, 1.350935677821201], [103.90491485595702, 1.3514505187552757], [103.90491485595702, 1.3531666544136976], [103.89873504638672, 1.3544537553607755]]], [[[103.89435768127442, 1.3438995074725529], [103.89358520507813, 1.3407246434768526], [103.89839172363281, 1.3395233425123459], [103.89907836914063, 1.3451866133226467], [103.89521598815918, 1.3480182438020019], [103.89126777648926, 1.3475892090924009], [103.8933277130127, 1.3451866133226467], [103.88972282409668, 1.3451866133226467], [103.89092445373535, 1.3439853145503565], [103.89272689819336, 1.3429556294180168], [103.89435768127442, 1.3438995074725529]]], [[[103.90268325805664, 1.341925943851875], [103.9083480834961, 1.341925943851875], [103.9083480834961, 1.3463879115035189], [103.90268325805664, 1.3463879115035189], [103.90268325805664, 1.341925943851875]]], [[[103.90294075012206, 1.325279300613958], [103.9090347290039, 1.325279300613958], [103.9090347290039, 1.3305135665417978], [103.90294075012206, 1.3305135665417978], [103.90294075012206, 1.325279300613958]]]] + } + }]], + "expected": { + "outputs": [171.183], + "serialized": ["distance", { + "properties": {}, + "geometry": { + "type": "MultiPolygon", + "coordinates": [[[[103.88809204101563, 1.3621763466641713], [103.88465881347656, 1.3565131154538628], [103.8896369934082, 1.3535956881386369], [103.90422821044922, 1.3575427948432913], [103.90079498291016, 1.364064087445756], [103.88809204101563, 1.3621763466641713]]], [[[103.87899398803711, 1.3395233425123459], [103.87521743774414, 1.330256143886628], [103.8819122314453, 1.3275103005613949], [103.88998031616211, 1.3299129136379467], [103.89392852783203, 1.3369491241772669], [103.88757705688477, 1.341239486566936], [103.87899398803711, 1.3395233425123459]]], [[[103.91864776611328, 1.3503350299269142], [103.91469955444336, 1.3393517280407568], [103.92414093017578, 1.3324871393386304], [103.93529891967774, 1.335232977120653], [103.93667221069336, 1.3432988578436807], [103.93598556518555, 1.351021484651125], [103.91864776611328, 1.3503350299269142]]]] + }, + "type": "Feature" + }], + "compiled": { + "type": "number", + "isFeatureConstant": false, + "isZoomConstant": true, + "result": "success" + } + } +} diff --git a/test/integration/render-tests/distance/filter-with-distance-expression/expected.png b/test/integration/render-tests/distance/filter-with-distance-expression/expected.png new file mode 100644 index 00000000000..4d15441009c Binary files /dev/null and b/test/integration/render-tests/distance/filter-with-distance-expression/expected.png differ diff --git a/test/integration/render-tests/distance/filter-with-distance-expression/style.json b/test/integration/render-tests/distance/filter-with-distance-expression/style.json new file mode 100644 index 00000000000..e974dc4b5fc --- /dev/null +++ b/test/integration/render-tests/distance/filter-with-distance-expression/style.json @@ -0,0 +1,380 @@ +{ + "version": 8, + "metadata": { + "test": { + "width": 125, + "height": 125 + } + }, + "zoom": 13, + "center": [ + -73.97850765457153, + 40.75663615846253 + ], + "sources": { + "points": { + "type": "geojson", + "data": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.98010969161987, + 40.75646549167777 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97986292839049, + 40.758009603779705 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97816777229309, + 40.757318821220274 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.9764940738678, + 40.75658739656873 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97747039794922, + 40.75539271899818 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97716999053955, + 40.75848095717076 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97945523262024, + 40.75536021046494 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97729873657227, + 40.75366161748887 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.98553848266602, + 40.75793646243674 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97905826568604, + 40.76175595827059 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97186994552612, + 40.76290989043682 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97068977355957, + 40.75575843890192 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.98214817047119, + 40.75187357799962 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.9878988265991, + 40.75466940037548 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.98674011230469, + 40.76172345284903 + ] + } + } + ] + } + }, + "center": { + "type": "geojson", + "data": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [ + -73.97860765457153, + 40.75663615846253 + ] + } + } + ] + } + }, + "boundary": { + "type": "geojson", + "data": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -73.97504593980587, + 40.75663615846253 + ], + [ + -73.9751494367638, + 40.75728181967787 + ], + [ + -73.9754539127706, + 40.75788995167545 + ], + [ + -73.9759416727875, + 40.758425213519445 + ], + [ + -73.97658436997524, + 40.75885649983152 + ], + [ + -73.97734465310938, + 40.75915874804255 + ], + [ + -73.97817833729766, + 40.75931439442866 + ], + [ + -73.9790369718454, + 40.75931439442866 + ], + [ + -73.97987065603368, + 40.75915874804255 + ], + [ + -73.98063093916782, + 40.75885649983152 + ], + [ + -73.98127363635557, + 40.758425213519445 + ], + [ + -73.98176139637246, + 40.75788995167545 + ], + [ + -73.98206587237927, + 40.75728181967787 + ], + [ + -73.9821693693372, + 40.75663615846253 + ], + [ + -73.98206587237927, + 40.75599049097636 + ], + [ + -73.98176139637246, + 40.755382341602825 + ], + [ + -73.98127363635557, + 40.75484705525835 + ], + [ + -73.98063093916782, + 40.7544157429341 + ], + [ + -73.97987065603368, + 40.75411347315821 + ], + [ + -73.9790369718454, + 40.75395781459483 + ], + [ + -73.97817833729766, + 40.75395781459483 + ], + [ + -73.97734465310938, + 40.75411347315821 + ], + [ + -73.97658436997524, + 40.7544157429341 + ], + [ + -73.9759416727875, + 40.75484705525835 + ], + [ + -73.9754539127706, + 40.755382341602825 + ], + [ + -73.9751494367638, + 40.75599049097636 + ], + [ + -73.97504593980587, + 40.75663615846253 + ] + ] + ] + } + } + ] + } + } + }, + "layers": [ + { + "id": "border", + "type": "fill", + "source": "boundary", + "paint": { + "fill-color": "black", + "fill-opacity": 0.5 + } + }, + { + "id": "center", + "type": "circle", + "source": "center", + "paint": { + "circle-radius": 5, + "circle-color": "red" + } + }, + { + "id": "circle", + "type": "circle", + "source": "points", + "filter": [ + "<", + [ + "distance", + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [ + -73.97860765457153, + 40.75663615846253 + ] + } + } + ], + 300 + ], + "paint": { + "circle-radius": 5, + "circle-color": "green" + } + } + ] +} \ No newline at end of file diff --git a/test/integration/render-tests/distance/paint-circle/expected.png b/test/integration/render-tests/distance/paint-circle/expected.png new file mode 100644 index 00000000000..c434f88c2e4 Binary files /dev/null and b/test/integration/render-tests/distance/paint-circle/expected.png differ diff --git a/test/integration/render-tests/distance/paint-circle/style.json b/test/integration/render-tests/distance/paint-circle/style.json new file mode 100644 index 00000000000..15eceda4000 --- /dev/null +++ b/test/integration/render-tests/distance/paint-circle/style.json @@ -0,0 +1,384 @@ +{ + "version": 8, + "metadata": { + "test": { + "width": 300, + "height": 300 + } + }, + "zoom": 13, + "center": [ + -73.97860765457153, + 40.75663615846253 + ], + "sources": { + "points": { + "type": "geojson", + "data": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.98010969161987, + 40.75646549167777 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97986292839049, + 40.758009603779705 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97816777229309, + 40.757318821220274 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.9764940738678, + 40.75658739656873 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97747039794922, + 40.75539271899818 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97716999053955, + 40.75848095717076 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97945523262024, + 40.75536021046494 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97729873657227, + 40.75366161748887 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.98553848266602, + 40.75793646243674 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97905826568604, + 40.76175595827059 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97186994552612, + 40.76290989043682 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97068977355957, + 40.75575843890192 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.98214817047119, + 40.75187357799962 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.99002313613892, + 40.75419801995909 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.98674011230469, + 40.76172345284903 + ] + } + } + ] + } + }, + "center": { + "type": "geojson", + "data": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [ + -73.97860765457153, + 40.75663615846253 + ] + } + } + ] + } + }, + "boundary": { + "type": "geojson", + "data": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -73.96910974852973, + 40.75663615846253 + ], + [ + -73.96938574041758, + 40.75835790776813 + ], + [ + -73.97019767643575, + 40.75997955448142 + ], + [ + -73.97149836981414, + 40.76140686495245 + ], + [ + -73.97321222898142, + 40.76255690397866 + ], + [ + -73.97523965067244, + 40.76336285128514 + ], + [ + -73.97746280850788, + 40.76377788125359 + ], + [ + -73.97975250063519, + 40.76377788125359 + ], + [ + -73.98197565847063, + 40.76336285128514 + ], + [ + -73.98400308016164, + 40.76255690397866 + ], + [ + -73.98571693932892, + 40.76140686495245 + ], + [ + -73.98701763270732, + 40.75997955448142 + ], + [ + -73.98782956872549, + 40.75835790776813 + ], + [ + -73.98810556061333, + 40.75663615846253 + ], + [ + -73.98782956872549, + 40.75491436456426 + ], + [ + -73.98701763270732, + 40.75329259428858 + ], + [ + -73.98571693932892, + 40.751865109592046 + ], + [ + -73.98400308016164, + 40.75071488559027 + ], + [ + -73.98197565847063, + 40.74990878493372 + ], + [ + -73.97975250063519, + 40.749493668371485 + ], + [ + -73.97746280850788, + 40.749493668371485 + ], + [ + -73.97523965067244, + 40.74990878493372 + ], + [ + -73.97321222898142, + 40.75071488559027 + ], + [ + -73.97149836981414, + 40.751865109592046 + ], + [ + -73.97019767643575, + 40.75329259428858 + ], + [ + -73.96938574041758, + 40.75491436456426 + ], + [ + -73.96910974852973, + 40.75663615846253 + ] + ] + ] + } + } + ] + } + } + }, + "layers": [ + { + "id": "border", + "type": "fill", + "source": "boundary", + "paint": { + "fill-color": "black", + "fill-opacity": 0.5 + } + }, + { + "id": "center", + "type": "circle", + "source": "center", + "paint": { + "circle-radius": 5, + "circle-color": "red" + } + }, + { + "id": "circle", + "type": "circle", + "source": "points", + "paint": { + "circle-radius": 3, + "circle-color": [ + "case", + [ + "<", + [ + "distance", + { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [ + -73.97860765457153, + 40.75663615846253 + ] + } + } + ], + 800 + ], + "green", + "blue" + ] + } + } + ] +} \ No newline at end of file diff --git a/test/integration/render-tests/distance/paint-line/expected.png b/test/integration/render-tests/distance/paint-line/expected.png new file mode 100644 index 00000000000..49f65544085 Binary files /dev/null and b/test/integration/render-tests/distance/paint-line/expected.png differ diff --git a/test/integration/render-tests/distance/paint-line/style.json b/test/integration/render-tests/distance/paint-line/style.json new file mode 100644 index 00000000000..69885a5c2dc --- /dev/null +++ b/test/integration/render-tests/distance/paint-line/style.json @@ -0,0 +1,571 @@ +{ + "version": 8, + "metadata": { + "test": { + "width": 300, + "height": 300 + } + }, + "zoom": 13, + "center": [ + -73.97882951965332, + 40.75453936473234 + ], + "sources": { + "lines": { + "type": "geojson", + "data": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -73.97605419158934, + 40.757887701496706 + ], + [ + -73.9734363555908, + 40.75710752159198 + ] + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -73.9874267578125, + 40.755774693073164 + ], + [ + -73.98828506469727, + 40.75346656097219 + ] + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -73.98270606994629, + 40.75323899431278 + ], + [ + -73.97798538208008, + 40.75353157987466 + ] + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -73.97725582122803, + 40.755742184726685 + ], + [ + -73.97545337677002, + 40.75629482445485 + ] + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -73.97635459899902, + 40.754116747135726 + ], + [ + -73.97502422332764, + 40.75366161748887 + ] + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -73.98519515991211, + 40.75723755221195 + ], + [ + -73.98343563079834, + 40.75674993607564 + ] + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -73.98326396942139, + 40.75486445336327 + ], + [ + -73.98549556732178, + 40.752036129031076 + ] + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -73.97493839263916, + 40.75219867966512 + ], + [ + -73.97433757781982, + 40.7508982634657 + ] + ] + } + } + ] + } + }, + "center": { + "type": "geojson", + "data": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -73.9877700805664, + 40.74976037842817 + ], + [ + -73.98648262023926, + 40.75169477140605 + ], + [ + -73.98558139801025, + 40.752913897733926 + ], + [ + -73.98416519165039, + 40.75484819896946 + ], + [ + -73.98319959640503, + 40.75613228383523 + ], + [ + -73.98139715194702, + 40.75868412570509 + ], + [ + -73.97931575775146, + 40.75782268685437 + ], + [ + -73.97824287414551, + 40.757270059827206 + ], + [ + -73.97907972335815, + 40.756051013376364 + ], + [ + -73.97564649581909, + 40.75460438258571 + ], + [ + -73.97423028945923, + 40.75398671041169 + ], + [ + -73.97614002227783, + 40.75143468822972 + ], + [ + -73.97435903549194, + 40.7507357096525 + ] + ] + } + } + ] + } + }, + "boundary": { + "type": "geojson", + "data": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "MultiPolygon", + "coordinates": [ + [ + [ + [ + -73.980915406985, + 40.757460062068475 + ], + [ + -73.97993559617679, + 40.75705453718075 + ], + [ + -73.97978285721045, + 40.75697586289132 + ], + [ + -73.98013295216039, + 40.7564658767395 + ], + [ + -73.9802661238222, + 40.756019807558545 + ], + [ + -73.98009242653058, + 40.755581806995224 + ], + [ + -73.97965678803773, + 40.7552651674539 + ], + [ + -73.9762311554221, + 40.75382171882893 + ], + [ + -73.97584453587778, + 40.753653094999805 + ], + [ + -73.97717274502423, + 40.75187817755506 + ], + [ + -73.97732688933066, + 40.75141629100844 + ], + [ + -73.97714793303804, + 40.75095956456846 + ], + [ + -73.97668610118902, + 40.750636182251725 + ], + [ + -73.97490511440313, + 40.749937195280495 + ], + [ + -73.97418126210347, + 40.749846537544585 + ], + [ + -73.97352531319592, + 40.750095515074946 + ], + [ + -73.97318781786828, + 40.750589024054165 + ], + [ + -73.97329768786464, + 40.751138557905904 + ], + [ + -73.97381295658076, + 40.75153421443528 + ], + [ + -73.97449936785367, + 40.75180360585742 + ], + [ + -73.97319756671283, + 40.7535432351504 + ], + [ + -73.97304319297578, + 40.7539917982632 + ], + [ + -73.97320425720197, + 40.75443900640337 + ], + [ + -73.97363796104085, + 40.754766027529854 + ], + [ + -73.97505416740071, + 40.75538369246371 + ], + [ + -73.97506943113952, + 40.755390236318846 + ], + [ + -73.97749399824558, + 40.75641184744637 + ], + [ + -73.97718964534327, + 40.75685520148255 + ], + [ + -73.97705577268336, + 40.75727443033833 + ], + [ + -73.97719501885582, + 40.75769265102434 + ], + [ + -73.9775753472124, + 40.758013643518126 + ], + [ + -73.97864823081835, + 40.75856626436385 + ], + [ + -73.97874655265649, + 40.758611784703874 + ], + [ + -73.98082794685205, + 40.7594732133289 + ], + [ + -73.98142855938701, + 40.759583004529844 + ], + [ + -73.98202066406688, + 40.759449302909445 + ], + [ + -73.98244386765893, + 40.75910832520998 + ], + [ + -73.98423886695231, + 40.756567038356934 + ], + [ + -73.98519669908008, + 40.75529328560552 + ], + [ + -73.98520332852566, + 40.7552843514961 + ], + [ + -73.98661831357845, + 40.75335173054083 + ], + [ + -73.9875183856405, + 40.75213416813068 + ], + [ + -73.98754262111453, + 40.75209964365882 + ], + [ + -73.98883008144168, + 40.75016526245955 + ], + [ + -73.98894178359876, + 40.749615932583 + ], + [ + -73.98860593502222, + 40.749121772064484 + ], + [ + -73.98795081845319, + 40.74887153633583 + ], + [ + -73.98722666615446, + 40.748960809814065 + ], + [ + -73.98671007969114, + 40.74935549193148 + ], + [ + -73.98543424256412, + 40.75127243312102 + ], + [ + -73.98454563260901, + 40.752474506162116 + ], + [ + -73.98454326113499, + 40.75247772965659 + ], + [ + -73.98313031781153, + 40.75440758620425 + ], + [ + -73.98216808897534, + 40.75568720281612 + ], + [ + -73.98215288069312, + 40.75570806533946 + ], + [ + -73.980915406985, + 40.757460062068475 + ] + ] + ] + ] + } + } + ] + } + } + }, + "layers": [ + { + "id": "border", + "type": "fill", + "source": "boundary", + "paint": { + "fill-color": "black", + "fill-opacity": 0.5 + } + }, + { + "id": "center", + "type": "line", + "source": "center", + "paint": { + "line-color": "red" + } + }, + { + "id": "circle", + "type": "line", + "source": "lines", + "paint": { + "line-color": [ + "case", + [ + "<", + [ + "distance", + { + "type": "Feature", + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -73.9877700805664, + 40.74976037842817 + ], + [ + -73.98648262023926, + 40.75169477140605 + ], + [ + -73.98558139801025, + 40.752913897733926 + ], + [ + -73.98416519165039, + 40.75484819896946 + ], + [ + -73.98319959640503, + 40.75613228383523 + ], + [ + -73.98139715194702, + 40.75868412570509 + ], + [ + -73.97931575775146, + 40.75782268685437 + ], + [ + -73.97824287414551, + 40.757270059827206 + ], + [ + -73.97907972335815, + 40.756051013376364 + ], + [ + -73.97564649581909, + 40.75460438258571 + ], + [ + -73.97423028945923, + 40.75398671041169 + ], + [ + -73.97614002227783, + 40.75143468822972 + ], + [ + -73.97435903549194, + 40.7507357096525 + ] + ] + } + } + ], + 100 + ], + "red", + "blue" + ] + } + } + ] +} \ No newline at end of file diff --git a/test/integration/render-tests/distance/paint-polygon/expected.png b/test/integration/render-tests/distance/paint-polygon/expected.png new file mode 100644 index 00000000000..7da3382254a Binary files /dev/null and b/test/integration/render-tests/distance/paint-polygon/expected.png differ diff --git a/test/integration/render-tests/distance/paint-polygon/style.json b/test/integration/render-tests/distance/paint-polygon/style.json new file mode 100644 index 00000000000..d4d971fa584 --- /dev/null +++ b/test/integration/render-tests/distance/paint-polygon/style.json @@ -0,0 +1,1480 @@ +{ + "version": 8, + "metadata": { + "test": { + "width": 500, + "height": 800 + } + }, + "zoom": 15, + "center": [ + -74.0156, 40.7068 + ], + "sources": { + "polygons": { + "type": "geojson", + "data": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -74.01458144187927, + 40.704993544667936 + ], + [ + -74.01387333869934, + 40.704993544667936 + ], + [ + -74.01387333869934, + 40.70539207464748 + ], + [ + -74.01458144187927, + 40.70539207464748 + ], + [ + -74.01458144187927, + 40.704993544667936 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -74.0144956111908, + 40.70438354518276 + ], + [ + -74.01401281356812, + 40.70438354518276 + ], + [ + -74.01401281356812, + 40.70445674541596 + ], + [ + -74.0144956111908, + 40.70445674541596 + ], + [ + -74.0144956111908, + 40.70438354518276 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -74.01309013366699, + 40.70529447568931 + ], + [ + -74.01313304901123, + 40.70479834544056 + ], + [ + -74.01241421699523, + 40.704936611619054 + ], + [ + -74.01240348815918, + 40.705400207887536 + ], + [ + -74.01269316673279, + 40.70569300386812 + ], + [ + -74.01309013366699, + 40.70529447568931 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -74.01807904243469, + 40.705969532223364 + ], + [ + -74.0187120437622, + 40.705782469049886 + ], + [ + -74.0179181098938, + 40.70554660603872 + ], + [ + -74.01764988899231, + 40.70579060224226 + ], + [ + -74.01770353317261, + 40.70620539373668 + ], + [ + -74.01807904243469, + 40.705969532223364 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -74.01639461517334, + 40.703594604229664 + ], + [ + -74.01562213897705, + 40.703594604229664 + ], + [ + -74.01562213897705, + 40.70422901109288 + ], + [ + -74.01639461517334, + 40.70422901109288 + ], + [ + -74.01639461517334, + 40.703594604229664 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -74.01465654373169, + 40.703000858998855 + ], + [ + -74.01409864425659, + 40.703000858998855 + ], + [ + -74.01409864425659, + 40.703220464016084 + ], + [ + -74.01465654373169, + 40.703220464016084 + ], + [ + -74.01465654373169, + 40.703000858998855 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -74.01522517204285, + 40.70356207038148 + ], + [ + -74.01349782943726, + 40.70356207038148 + ], + [ + -74.01349782943726, + 40.703895541571974 + ], + [ + -74.01522517204285, + 40.703895541571974 + ], + [ + -74.01522517204285, + 40.70356207038148 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -74.0171617269516, + 40.70469261228682 + ], + [ + -74.01734948158263, + 40.7043957452272 + ], + [ + -74.01685059070587, + 40.70429814480899 + ], + [ + -74.01658773422241, + 40.70435914508713 + ], + [ + -74.01678085327148, + 40.70465194564456 + ], + [ + -74.0171617269516, + 40.70469261228682 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -74.01637315750122, + 40.708897409073174 + ], + [ + -74.0164589881897, + 40.707953996144724 + ], + [ + -74.013991355896, + 40.70749855063713 + ], + [ + -74.01386260986328, + 40.70798652784752 + ], + [ + -74.01379823684692, + 40.70868595561338 + ], + [ + -74.01596546173096, + 40.70943417253246 + ], + [ + -74.01637315750122, + 40.708897409073174 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -74.01611566543579, + 40.71016611573151 + ], + [ + -74.01568651199341, + 40.71016611573151 + ], + [ + -74.01568651199341, + 40.7107841948341 + ], + [ + -74.01611566543579, + 40.7107841948341 + ], + [ + -74.01611566543579, + 40.71016611573151 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -74.01330471038818, + 40.71062154299493 + ], + [ + -74.01281118392944, + 40.71062154299493 + ], + [ + -74.01281118392944, + 40.7109793765167 + ], + [ + -74.01330471038818, + 40.7109793765167 + ], + [ + -74.01330471038818, + 40.71062154299493 + ] + ] + ] + } + } + + ] + } + }, + "route": { + "type": "geojson", + "data": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "LineString", + "coordinates": [ + [ -74.013841, 40.702449 ], + [ -74.013863, 40.702462 ], + [ -74.013977, 40.702548 ], + [ -74.01404, 40.702595 ], + [ -74.014152, 40.702685 ], + [ -74.014213, 40.702749 ], + [ -74.014284, 40.702835 ], + [ -74.014333, 40.702911 ], + [ -74.014368, 40.702978 ], + [ -74.014407, 40.703066 ], + [ -74.014438, 40.703152 ], + [ -74.014449, 40.703209 ], + [ -74.01445, 40.703263 ], + [ -74.01445, 40.703332 ], + [ -74.014442, 40.703401 ], + [ -74.014404, 40.703614 ], + [ -74.014245, 40.704524 ], + [ -74.01422, 40.704633 ], + [ -74.014329, 40.704667 ], + [ -74.01445, 40.704705 ], + [ -74.014548, 40.704733 ], + [ -74.014641, 40.704756 ], + [ -74.014727, 40.704776 ], + [ -74.014841, 40.704799 ], + [ -74.014977, 40.704827 ], + [ -74.015033, 40.704838 ], + [ -74.015365, 40.704905 ], + [ -74.015454, 40.704921 ], + [ -74.015541, 40.704933 ], + [ -74.015638, 40.704945 ], + [ -74.015699, 40.70495 ], + [ -74.015755, 40.704953 ], + [ -74.01583, 40.704952 ], + [ -74.015909, 40.704949 ], + [ -74.016073, 40.704935 ], + [ -74.016157, 40.704927 ], + [ -74.016224, 40.704921 ], + [ -74.016284, 40.70491 ], + [ -74.016416, 40.704882 ], + [ -74.016424, 40.704918 ], + [ -74.016437, 40.704962 ], + [ -74.016453, 40.705007 ], + [ -74.016462, 40.705041 ], + [ -74.016467, 40.705072 ], + [ -74.016463, 40.705112 ], + [ -74.016457, 40.70515 ], + [ -74.016447, 40.705189 ], + [ -74.016151, 40.705949 ], + [ -74.016121, 40.706032 ], + [ -74.01609, 40.706121 ], + [ -74.01606, 40.706214 ], + [ -74.016037, 40.706296 ], + [ -74.016016, 40.706383 ], + [ -74.016003, 40.70645 ], + [ -74.015986, 40.706549 ], + [ -74.015971, 40.706613 ], + [ -74.015953, 40.706677 ], + [ -74.015888, 40.706844 ], + [ -74.015805, 40.707053 ], + [ -74.015735, 40.707222 ], + [ -74.015697, 40.707307 ], + [ -74.015597, 40.70752 ], + [ -74.015512, 40.707701 ], + [ -74.015476, 40.707784 ], + [ -74.015442, 40.707859 ], + [ -74.015363, 40.708065 ], + [ -74.015197, 40.708495 ], + [ -74.014864, 40.709446 ], + [ -74.01476, 40.709725 ], + [ -74.014744, 40.709777 ], + [ -74.014729, 40.709827 ], + [ -74.01472, 40.709873 ], + [ -74.014712, 40.709925 ], + [ -74.014709, 40.709998 ], + [ -74.014699, 40.710139 ], + [ -74.014689, 40.710215 ], + [ -74.014674, 40.710286 ], + [ -74.014655, 40.710373 ], + [ -74.014631, 40.710477 ], + [ -74.014602, 40.710583 ], + [ -74.014523, 40.710825 ], + [ -74.014492, 40.710899 ], + [ -74.014463, 40.710966 ], + [ -74.014434, 40.711033 ], + [ -74.014406, 40.711098 ], + [ -74.01438, 40.711171 ], + [ -74.01436, 40.71125 ], + [ -74.014147, 40.712245 ] + ] + } + } + ] + } + }, + "boundary": { + "type": "geojson", + "data": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "MultiPolygon", + "coordinates": [ + [ + [ + [ + -74.0151711019407, + 40.70708248153554 + ], + [ + -74.01513669040085, + 40.70715945454981 + ], + [ + -74.01495320586922, + 40.70755022788697 + ], + [ + -74.01491377266709, + 40.70764071839986 + ], + [ + -74.0148810615757, + 40.707712875375907 + ], + [ + -74.01487264250203, + 40.707732967604218 + ], + [ + -74.01462764250204, + 40.70836896880789 + ], + [ + -74.01462371533762, + 40.70837965125844 + ], + [ + -74.0142919254227, + 40.709327197095749 + ], + [ + -74.01418921264924, + 40.70960274397049 + ], + [ + -74.01418200426355, + 40.709624062706328 + ], + [ + -74.01415100426354, + 40.70972606286091 + ], + [ + -74.01414228154686, + 40.709761040301319 + ], + [ + -74.01413328154685, + 40.70980704034693 + ], + [ + -74.01413085669339, + 40.709820919977548 + ], + [ + -74.0141228566934, + 40.70987292001823 + ], + [ + -74.01411915165584, + 40.70991100075199 + ], + [ + -74.01411636078629, + 40.70997891192715 + ], + [ + -74.014107445332, + 40.710104616078528 + ], + [ + -74.01410062631857, + 40.71015644061677 + ], + [ + -74.01407015652336, + 40.710298038166488 + ], + [ + -74.01404833135662, + 40.71039261400213 + ], + [ + -74.01402352268247, + 40.710483291093428 + ], + [ + -74.01395185417192, + 40.7107028367914 + ], + [ + -74.01392751803896, + 40.71076093110875 + ], + [ + -74.01384233684309, + 40.7109580368456 + ], + [ + -74.01383336576522, + 40.71098081405313 + ], + [ + -74.01380736576523, + 40.71105381418158 + ], + [ + -74.01379749274386, + 40.711086267327718 + ], + [ + -74.01377749274387, + 40.71116526742827 + ], + [ + -74.01377452183337, + 40.71117798717853 + ], + [ + -74.01356152183337, + 40.71217298825462 + ], + [ + -74.01356973267557, + 40.712348300666068 + ], + [ + -74.01366582723498, + 40.712507886077677 + ], + [ + -74.01383517598602, + 40.712627449247438 + ], + [ + -74.0140519971165, + 40.7126887880178 + ], + [ + -74.01428328157479, + 40.712682564282037 + ], + [ + -74.01449381839872, + 40.7126097255296 + ], + [ + -74.01465155526535, + 40.71248136061004 + ], + [ + -74.01473247816664, + 40.712317011667497 + ], + [ + -74.01494411522629, + 40.71132837957097 + ], + [ + -74.01495836129088, + 40.711272105835977 + ], + [ + -74.01497455088455, + 40.71122665051681 + ], + [ + -74.01505566315692, + 40.711038963278529 + ], + [ + -74.01505731843706, + 40.71103507336031 + ], + [ + -74.01508831843704, + 40.71096107351153 + ], + [ + -74.01509877012852, + 40.7109329971876 + ], + [ + -74.01517777012852, + 40.710690997580119 + ], + [ + -74.01518277861777, + 40.710674297126818 + ], + [ + -74.01521177861778, + 40.71056829727215 + ], + [ + -74.01521526423329, + 40.71055447168172 + ], + [ + -74.0152392642333, + 40.710450471802719 + ], + [ + -74.01524039909495, + 40.710445382104499 + ], + [ + -74.01527439909494, + 40.71028738227625 + ], + [ + -74.01527920752534, + 40.71025962213679 + ], + [ + -74.01528920752533, + 40.71018362218774 + ], + [ + -74.01529128065282, + 40.71016313620123 + ], + [ + -74.01530128065282, + 40.71002213625232 + ], + [ + -74.01530406315996, + 40.70995810091367 + ], + [ + -74.0153080756424, + 40.70993202285155 + ], + [ + -74.01531227007016, + 40.7099105846882 + ], + [ + -74.01533474044436, + 40.709836648092849 + ], + [ + -74.01543478735076, + 40.70956825631728 + ], + [ + -74.01543728466237, + 40.709561346894478 + ], + [ + -74.01576840153629, + 40.70861572483216 + ], + [ + -74.01600745770782, + 40.707995155322468 + ], + [ + -74.01603693842432, + 40.70793012446802 + ], + [ + -74.01607320926228, + 40.70784662844005 + ], + [ + -74.01625579413079, + 40.70745777266373 + ], + [ + -74.01625875406399, + 40.70745131375989 + ], + [ + -74.01629675406396, + 40.70736631394408 + ], + [ + -74.01630089636346, + 40.707356693457288 + ], + [ + -74.01637089636347, + 40.707187693799088 + ], + [ + -74.01637295743514, + 40.707182612894317 + ], + [ + -74.01645595743516, + 40.7069736133011 + ], + [ + -74.01645689000667, + 40.70697124138866 + ], + [ + -74.01652189000666, + 40.706804241707718 + ], + [ + -74.01653309799375, + 40.706770755996959 + ], + [ + -74.01655109799376, + 40.706706756087047 + ], + [ + -74.01655499022424, + 40.70669165437923 + ], + [ + -74.01656999022424, + 40.70662765445482 + ], + [ + -74.0165741736369, + 40.70660703985817 + ], + [ + -74.01659054000223, + 40.70651173105705 + ], + [ + -74.01660131513352, + 40.7064561977443 + ], + [ + -74.01661892836694, + 40.70638323119675 + ], + [ + -74.01663829648115, + 40.70631417975625 + ], + [ + -74.01666455846079, + 40.70623276812648 + ], + [ + -74.01672192222928, + 40.70607102529516 + ], + [ + -74.01701585967143, + 40.705316322464629 + ], + [ + -74.0170292385679, + 40.705274794782159 + ], + [ + -74.0170392385679, + 40.70523579483239 + ], + [ + -74.01704593206589, + 40.705203438957628 + ], + [ + -74.01705193206588, + 40.70516543898813 + ], + [ + -74.0170544389246, + 40.70514598878137 + ], + [ + -74.01705843892461, + 40.70510598880179 + ], + [ + -74.01705575132216, + 40.705017428401308 + ], + [ + -74.01705075132216, + 40.70498642837589 + ], + [ + -74.01704354286332, + 40.70495253482977 + ], + [ + -74.01703454286332, + 40.70491853478461 + ], + [ + -74.01702569710665, + 40.70488998001849 + ], + [ + -74.01701301415571, + 40.70485431046822 + ], + [ + -74.01700625809827, + 40.704831440776249 + ], + [ + -74.01700089451123, + 40.70480730460531 + ], + [ + -74.01693588676315, + 40.704665544615099 + ], + [ + -74.0168129594481, + 40.70454789928016 + ], + [ + -74.0166458076577, + 40.704467475393588 + ], + [ + -74.01645305344586, + 40.70443323296857 + ], + [ + -74.0162561711821, + 40.70444898695817 + ], + [ + -74.0161343216639, + 40.70447483386707 + ], + [ + -74.01611792676465, + 40.70447783961842 + ], + [ + -74.01600381100126, + 40.7044884195725 + ], + [ + -74.01586093076117, + 40.70450061679901 + ], + [ + -74.01580996404405, + 40.704502552802697 + ], + [ + -74.01577071796528, + 40.7045030759015 + ], + [ + -74.01571770931192, + 40.70449926797011 + ], + [ + -74.01564186909559, + 40.70448988592864 + ], + [ + -74.01557560970953, + 40.70448074664236 + ], + [ + -74.01550988993013, + 40.70446893195469 + ], + [ + -74.01489045061949, + 40.70434368366864 + ], + [ + -74.01487543241945, + 40.704340191041698 + ], + [ + -74.01499190295306, + 40.70367360138647 + ], + [ + -74.01502978449573, + 40.70346126556211 + ], + [ + -74.01503285796554, + 40.70344037060329 + ], + [ + -74.01504085796553, + 40.703371370644109 + ], + [ + -74.0150431246645, + 40.70332922865779 + ], + [ + -74.01504212466452, + 40.70320622865265 + ], + [ + -74.0150358884247, + 40.70314390850314 + ], + [ + -74.01502488842469, + 40.7030869084474 + ], + [ + -74.01501015744576, + 40.7030334693425 + ], + [ + -74.01497915744578, + 40.70294746918944 + ], + [ + -74.01496925079012, + 40.702922792713739 + ], + [ + -74.0149302507901, + 40.7028347925245 + ], + [ + -74.0149194659434, + 40.70281243589099 + ], + [ + -74.0148844659434, + 40.70274543572444 + ], + [ + -74.01486588776636, + 40.70271354255982 + ], + [ + -74.01481688776636, + 40.702637542334517 + ], + [ + -74.0147867803573, + 40.70259644165009 + ], + [ + -74.01471578035729, + 40.70251044134207 + ], + [ + -74.01469376421812, + 40.702485646223099 + ], + [ + -74.0146327642181, + 40.70242164597008 + ], + [ + -74.01458343847715, + 40.702376430492538 + ], + [ + -74.01447143847715, + 40.70228643007562 + ], + [ + -74.01445754668859, + 40.702275635500829 + ], + [ + -74.01428054668858, + 40.70214263486312 + ], + [ + -74.01422763864254, + 40.702107347156388 + ], + [ + -74.01420563864254, + 40.70209434708718 + ], + [ + -74.01399885793953, + 40.70201555583395 + ], + [ + -74.01376804479618, + 40.70200275269269 + ], + [ + -74.01354833842129, + 40.702057886862238 + ], + [ + -74.01337318711878, + 40.70217256451488 + ], + [ + -74.01326925608669, + 40.702329326768339 + ], + [ + -74.01325236788253, + 40.70250430778853 + ], + [ + -74.0133250935823, + 40.702670868264707 + ], + [ + -74.01344840162615, + 40.70277910857115 + ], + [ + -74.01344545331142, + 40.702781363605627 + ], + [ + -74.01361538926793, + 40.70290905505382 + ], + [ + -74.0136939472981, + 40.70297218137762 + ], + [ + -74.01372069041695, + 40.70300023961846 + ], + [ + -74.0137647430682, + 40.70305359872867 + ], + [ + -74.01379001203522, + 40.70309279310317 + ], + [ + -74.01381075121489, + 40.7031324937183 + ], + [ + -74.01383932636424, + 40.70319696954107 + ], + [ + -74.0138561345278, + 40.703243598562128 + ], + [ + -74.01385670324058, + 40.70331366395001 + ], + [ + -74.01385235754623, + 40.7033511455829 + ], + [ + -74.01381621550429, + 40.703553734576107 + ], + [ + -74.01365857519974, + 40.704455940680109 + ], + [ + -74.01363563146812, + 40.70455597479642 + ], + [ + -74.01363498646063, + 40.70470715797282 + ], + [ + -74.01370047731099, + 40.70484995726059 + ], + [ + -74.01382470026995, + 40.70496822928328 + ], + [ + -74.01399361191557, + 40.70504860353307 + ], + [ + -74.01422361191557, + 40.70512060308374 + ], + [ + -74.01424081586814, + 40.70512575210333 + ], + [ + -74.01433881586815, + 40.70515375192642 + ], + [ + -74.0143640405315, + 40.70516047074901 + ], + [ + -74.01445704053148, + 40.705183470601358 + ], + [ + -74.01446704363791, + 40.70518587047451 + ], + [ + -74.01455304363792, + 40.70520587034545 + ], + [ + -74.01457414286804, + 40.70521045508977 + ], + [ + -74.01521214286805, + 40.70533945424825 + ], + [ + -74.01522813602975, + 40.70534250805011 + ], + [ + -74.01531713602975, + 40.70535850794499 + ], + [ + -74.01534782313047, + 40.70536337910113 + ], + [ + -74.01543482313046, + 40.70537537902143 + ], + [ + -74.01544546939071, + 40.70537677164958 + ], + [ + -74.01554246939071, + 40.70538877156963 + ], + [ + -74.01557423879058, + 40.70539203625961 + ], + [ + -74.01563523879058, + 40.70539703622606 + ], + [ + -74.01565718887346, + 40.705398523240749 + ], + [ + -74.01571318887345, + 40.70540152322056 + ], + [ + -74.01574552677285, + 40.705402172560358 + ], + [ + -74.01558214032856, + 40.70582167874488 + ], + [ + -74.01557820372038, + 40.70583226095144 + ], + [ + -74.0155172037204, + 40.70600426125293 + ], + [ + -74.01551384062543, + 40.706014194530357 + ], + [ + -74.0154838406254, + 40.706107194679507 + ], + [ + -74.01547983388035, + 40.706120485774508 + ], + [ + -74.01545683388037, + 40.706202485889637 + ], + [ + -74.01545355113277, + 40.706215069345748 + ], + [ + -74.01543255113275, + 40.70630206945151 + ], + [ + -74.01542917788899, + 40.70631756891734 + ], + [ + -74.01541617788898, + 40.70638456898317 + ], + [ + -74.01539960315644, + 40.70648061371105 + ], + [ + -74.01538878395782, + 40.7065267756787 + ], + [ + -74.01537765590375, + 40.70656634110651 + ], + [ + -74.01531957658183, + 40.70671555959396 + ], + [ + -74.01523805187868, + 40.70692084518066 + ], + [ + -74.0151711019407, + 40.70708248153554 + ] + ] + ] + ] + } + } + ] + } + } + }, + "layers": [ + { + "id": "border", + "type": "fill", + "source": "boundary", + "paint": { + "fill-color": "black", + "fill-opacity": 0.5 + } + }, + { + "id": "center", + "type": "line", + "source": "route", + "paint": { + "line-color": "red" + } + }, + { + "id": "polygons", + "type": "fill", + "source": "polygons", + "paint": { + "fill-color": [ + "case", + [ + "<", + [ + "distance", + { + "type": "Feature", + "geometry": { + "type": "LineString", + "coordinates": [ + [ -74.013841, 40.702449 ], + [ -74.013863, 40.702462 ], + [ -74.013977, 40.702548 ], + [ -74.01404, 40.702595 ], + [ -74.014152, 40.702685 ], + [ -74.014213, 40.702749 ], + [ -74.014284, 40.702835 ], + [ -74.014333, 40.702911 ], + [ -74.014368, 40.702978 ], + [ -74.014407, 40.703066 ], + [ -74.014438, 40.703152 ], + [ -74.014449, 40.703209 ], + [ -74.01445, 40.703263 ], + [ -74.01445, 40.703332 ], + [ -74.014442, 40.703401 ], + [ -74.014404, 40.703614 ], + [ -74.014245, 40.704524 ], + [ -74.01422, 40.704633 ], + [ -74.014329, 40.704667 ], + [ -74.01445, 40.704705 ], + [ -74.014548, 40.704733 ], + [ -74.014641, 40.704756 ], + [ -74.014727, 40.704776 ], + [ -74.014841, 40.704799 ], + [ -74.014977, 40.704827 ], + [ -74.015033, 40.704838 ], + [ -74.015365, 40.704905 ], + [ -74.015454, 40.704921 ], + [ -74.015541, 40.704933 ], + [ -74.015638, 40.704945 ], + [ -74.015699, 40.70495 ], + [ -74.015755, 40.704953 ], + [ -74.01583, 40.704952 ], + [ -74.015909, 40.704949 ], + [ -74.016073, 40.704935 ], + [ -74.016157, 40.704927 ], + [ -74.016224, 40.704921 ], + [ -74.016284, 40.70491 ], + [ -74.016416, 40.704882 ], + [ -74.016424, 40.704918 ], + [ -74.016437, 40.704962 ], + [ -74.016453, 40.705007 ], + [ -74.016462, 40.705041 ], + [ -74.016467, 40.705072 ], + [ -74.016463, 40.705112 ], + [ -74.016457, 40.70515 ], + [ -74.016447, 40.705189 ], + [ -74.016151, 40.705949 ], + [ -74.016121, 40.706032 ], + [ -74.01609, 40.706121 ], + [ -74.01606, 40.706214 ], + [ -74.016037, 40.706296 ], + [ -74.016016, 40.706383 ], + [ -74.016003, 40.70645 ], + [ -74.015986, 40.706549 ], + [ -74.015971, 40.706613 ], + [ -74.015953, 40.706677 ], + [ -74.015888, 40.706844 ], + [ -74.015805, 40.707053 ], + [ -74.015735, 40.707222 ], + [ -74.015697, 40.707307 ], + [ -74.015597, 40.70752 ], + [ -74.015512, 40.707701 ], + [ -74.015476, 40.707784 ], + [ -74.015442, 40.707859 ], + [ -74.015363, 40.708065 ], + [ -74.015197, 40.708495 ], + [ -74.014864, 40.709446 ], + [ -74.01476, 40.709725 ], + [ -74.014744, 40.709777 ], + [ -74.014729, 40.709827 ], + [ -74.01472, 40.709873 ], + [ -74.014712, 40.709925 ], + [ -74.014709, 40.709998 ], + [ -74.014699, 40.710139 ], + [ -74.014689, 40.710215 ], + [ -74.014674, 40.710286 ], + [ -74.014655, 40.710373 ], + [ -74.014631, 40.710477 ], + [ -74.014602, 40.710583 ], + [ -74.014523, 40.710825 ], + [ -74.014492, 40.710899 ], + [ -74.014463, 40.710966 ], + [ -74.014434, 40.711033 ], + [ -74.014406, 40.711098 ], + [ -74.01438, 40.711171 ], + [ -74.01436, 40.71125 ], + [ -74.014147, 40.712245 ] + ] + } + } + ], + 50 + ], + "red", + "blue" + ] + } + } + ] +} \ No newline at end of file diff --git a/test/integration/render-tests/distance/symbol-style/expected.png b/test/integration/render-tests/distance/symbol-style/expected.png new file mode 100644 index 00000000000..c939751e3a1 Binary files /dev/null and b/test/integration/render-tests/distance/symbol-style/expected.png differ diff --git a/test/integration/render-tests/distance/symbol-style/style.json b/test/integration/render-tests/distance/symbol-style/style.json new file mode 100644 index 00000000000..99ef2e6f070 --- /dev/null +++ b/test/integration/render-tests/distance/symbol-style/style.json @@ -0,0 +1,728 @@ +{ + "version": 8, + "metadata": { + "test": { + "width": 300, + "height": 300 + } + }, + "zoom": 13, + "center": [ + -73.97892951965332, + 40.75452936473234 + ], + "sources": { + "points": { + "type": "geojson", + "data": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97986292839049, + 40.758009603779705 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97816777229309, + 40.757318821220274 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.9764940738678, + 40.75658739656873 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97747039794922, + 40.75539271899818 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97716999053955, + 40.75848095717076 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97945523262024, + 40.75536021046494 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97729873657227, + 40.75366161748887 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.98553848266602, + 40.75793646243674 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97068977355957, + 40.75575843890192 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.99002313613892, + 40.75419801995909 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.98244857788086, + 40.75592098043558 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.98504495620728, + 40.75418176540237 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.98532390594482, + 40.75206863918968 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.98150444030762, + 40.758944180522946 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97450923919678, + 40.75254003470314 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.97485256195068, + 40.75382416414898 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.9749813079834, + 40.75058941088087 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.98774862289429, + 40.75031306787843 + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [ + -73.98122549057007, + 40.75418176540237 + ] + } + } + ] + } + }, + "center": { + "type": "geojson", + "data": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -73.9877700805664, + 40.74976037842817 + ], + [ + -73.98648262023926, + 40.75169477140605 + ], + [ + -73.98558139801025, + 40.752913897733926 + ], + [ + -73.98416519165039, + 40.75484819896946 + ], + [ + -73.98319959640503, + 40.75613228383523 + ], + [ + -73.98139715194702, + 40.75868412570509 + ], + [ + -73.97931575775146, + 40.75782268685437 + ], + [ + -73.97824287414551, + 40.757270059827206 + ], + [ + -73.97907972335815, + 40.756051013376364 + ], + [ + -73.97564649581909, + 40.75460438258571 + ], + [ + -73.97423028945923, + 40.75398671041169 + ], + [ + -73.97614002227783, + 40.75143468822972 + ], + [ + -73.97435903549194, + 40.7507357096525 + ] + ] + } + } + ] + } + }, + "boundary": { + "type": "geojson", + "data": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "MultiPolygon", + "coordinates": [ + [ + [ + [ + -73.980915406985, + 40.757460062068475 + ], + [ + -73.97993559617679, + 40.75705453718075 + ], + [ + -73.97978285721045, + 40.75697586289132 + ], + [ + -73.98013295216039, + 40.7564658767395 + ], + [ + -73.9802661238222, + 40.756019807558545 + ], + [ + -73.98009242653058, + 40.755581806995224 + ], + [ + -73.97965678803773, + 40.7552651674539 + ], + [ + -73.9762311554221, + 40.75382171882893 + ], + [ + -73.97584453587778, + 40.753653094999805 + ], + [ + -73.97717274502423, + 40.75187817755506 + ], + [ + -73.97732688933066, + 40.75141629100844 + ], + [ + -73.97714793303804, + 40.75095956456846 + ], + [ + -73.97668610118902, + 40.750636182251725 + ], + [ + -73.97490511440313, + 40.749937195280495 + ], + [ + -73.97418126210347, + 40.749846537544585 + ], + [ + -73.97352531319592, + 40.750095515074946 + ], + [ + -73.97318781786828, + 40.750589024054165 + ], + [ + -73.97329768786464, + 40.751138557905904 + ], + [ + -73.97381295658076, + 40.75153421443528 + ], + [ + -73.97449936785367, + 40.75180360585742 + ], + [ + -73.97319756671283, + 40.7535432351504 + ], + [ + -73.97304319297578, + 40.7539917982632 + ], + [ + -73.97320425720197, + 40.75443900640337 + ], + [ + -73.97363796104085, + 40.754766027529854 + ], + [ + -73.97505416740071, + 40.75538369246371 + ], + [ + -73.97506943113952, + 40.755390236318846 + ], + [ + -73.97749399824558, + 40.75641184744637 + ], + [ + -73.97718964534327, + 40.75685520148255 + ], + [ + -73.97705577268336, + 40.75727443033833 + ], + [ + -73.97719501885582, + 40.75769265102434 + ], + [ + -73.9775753472124, + 40.758013643518126 + ], + [ + -73.97864823081835, + 40.75856626436385 + ], + [ + -73.97874655265649, + 40.758611784703874 + ], + [ + -73.98082794685205, + 40.7594732133289 + ], + [ + -73.98142855938701, + 40.759583004529844 + ], + [ + -73.98202066406688, + 40.759449302909445 + ], + [ + -73.98244386765893, + 40.75910832520998 + ], + [ + -73.98423886695231, + 40.756567038356934 + ], + [ + -73.98519669908008, + 40.75529328560552 + ], + [ + -73.98520332852566, + 40.7552843514961 + ], + [ + -73.98661831357845, + 40.75335173054083 + ], + [ + -73.9875183856405, + 40.75213416813068 + ], + [ + -73.98754262111453, + 40.75209964365882 + ], + [ + -73.98883008144168, + 40.75016526245955 + ], + [ + -73.98894178359876, + 40.749615932583 + ], + [ + -73.98860593502222, + 40.749121772064484 + ], + [ + -73.98795081845319, + 40.74887153633583 + ], + [ + -73.98722666615446, + 40.748960809814065 + ], + [ + -73.98671007969114, + 40.74935549193148 + ], + [ + -73.98543424256412, + 40.75127243312102 + ], + [ + -73.98454563260901, + 40.752474506162116 + ], + [ + -73.98454326113499, + 40.75247772965659 + ], + [ + -73.98313031781153, + 40.75440758620425 + ], + [ + -73.98216808897534, + 40.75568720281612 + ], + [ + -73.98215288069312, + 40.75570806533946 + ], + [ + -73.980915406985, + 40.757460062068475 + ] + ] + ] + ] + } + } + ] + } + } + }, + "sprite": "local://sprites/sprite", + "glyphs": "local://glyphs/{fontstack}/{range}.pbf", + "layers": [ + { + "id": "border", + "type": "fill", + "source": "boundary", + "paint": { + "fill-color": "black", + "fill-opacity": 0.5 + } + }, + { + "id": "center", + "type": "line", + "source": "center", + "paint": { + "line-color": "red" + } + }, + { + "id": "circle", + "type": "symbol", + "source": "points", + "layout": { + "icon-image": "dot.sdf", + "text-field": [ + "case", + [ + "<", + [ + "distance", + { + "type": "Feature", + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -73.9877700805664, + 40.74976037842817 + ], + [ + -73.98648262023926, + 40.75169477140605 + ], + [ + -73.98558139801025, + 40.752913897733926 + ], + [ + -73.98416519165039, + 40.75484819896946 + ], + [ + -73.98319959640503, + 40.75613228383523 + ], + [ + -73.98139715194702, + 40.75868412570509 + ], + [ + -73.97931575775146, + 40.75782268685437 + ], + [ + -73.97824287414551, + 40.757270059827206 + ], + [ + -73.97907972335815, + 40.756051013376364 + ], + [ + -73.97564649581909, + 40.75460438258571 + ], + [ + -73.97423028945923, + 40.75398671041169 + ], + [ + -73.97614002227783, + 40.75143468822972 + ], + [ + -73.97435903549194, + 40.7507357096525 + ] + ] + } + } + ], + 100 + ], + "In", + "Out" + ], + "text-font": [ + "Open Sans Semibold", + "Arial Unicode MS Bold" + ], + "text-size": 10 + }, + "paint": { + "text-color": "red", + "icon-color": "blue", + "icon-opacity": [ + "case", + [ + "<", + [ + "distance", + { + "type": "Feature", + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -73.9877700805664, + 40.74976037842817 + ], + [ + -73.98648262023926, + 40.75169477140605 + ], + [ + -73.98558139801025, + 40.752913897733926 + ], + [ + -73.98416519165039, + 40.75484819896946 + ], + [ + -73.98319959640503, + 40.75613228383523 + ], + [ + -73.98139715194702, + 40.75868412570509 + ], + [ + -73.97931575775146, + 40.75782268685437 + ], + [ + -73.97824287414551, + 40.757270059827206 + ], + [ + -73.97907972335815, + 40.756051013376364 + ], + [ + -73.97564649581909, + 40.75460438258571 + ], + [ + -73.97423028945923, + 40.75398671041169 + ], + [ + -73.97614002227783, + 40.75143468822972 + ], + [ + -73.97435903549194, + 40.7507357096525 + ] + ] + } + } + ], + 100 + ], + 1, + 0.5 + ] + } + } + ] +} \ No newline at end of file