Polygons in sentinel 2

Hello,

I’m trying to show several polygons with all the plots that a person has. The problem that the coordinates of several polygons intersect. And it doesn’t show me anything, it just tells me that there is an error.

Is there a way to show several polygons that their coordinates are intertwined?

Hi Cesar,

Please can you provide more context to your question. e.g. which API you are using, the error message that you return and what you are trying to achieve.

Hello William,

Thank you very much and sorry for not providing more explanations. Below I put the code where the polygon goes, currently it only has one, I have the problem when a coordinate overlaps between two polygons.

  L.GridLayer.SHProcessLayer = L.GridLayer.extend({
    createTile: function (coords, done) {
      const tile = L.DomUtil.create("img", "leaflet-tile");
      const tileSize = this.options.tileSize;
      tile.width = tileSize;
      tile.height = tileSize;
      const nwPoint = coords.multiplyBy(tileSize);
      const sePoint = nwPoint.add([tileSize, tileSize]);
      const nw = L.CRS.EPSG4326.project(
        this._map.unproject(nwPoint, coords.z)
      );
      const se = L.CRS.EPSG4326.project(
        this._map.unproject(sePoint, coords.z)
      );

      authTokenPromise.then((authToken) => {
        //   https://docs.sentinel-hub.com/api/latest/reference/#tag/process
        const payload = {
          input: {
            bounds: {
              bbox: [nw.x, nw.y, se.x, se.y], 
              geometry: { 
                type: "Polygon",
                coordinates: [
                [
                    [-4.138209753619,36.781121901881],
                    [-4.1382479868344,36.781130052444],
                    [-4.1382989982619,36.781143189402],
                    [-4.1388678814169,36.781383001533],
                    [-4.1389990766495,36.781449020759],
                    [-4.1390483236863,36.78148601932],
                    [-4.1390827255336,36.781521456332],
                    [-4.1391557394582,36.781590587759],
                    [-4.1391899401398,36.781612401664],
                    [-4.1392539820748,36.781647554529],
                    [-4.139360465779,36.781689114522],
                    [-4.1394837099379,36.781718591163],
                    [-4.1395814982552,36.781744905311],
                    [-4.1396664840529,36.781764529024],
                    [-4.1400460971174,36.781805174551],
                    [-4.1401097853361,36.781816486769],
                    [-4.1401651327224,36.78183639379],
                    [-4.140172074615,36.781836884969],
                    [-4.1403186347153,36.782119630888],
                    [-4.140286931841,36.782125617243],
                    [-4.139964101983,36.782201947049],
                    [-4.1396371884614,36.782288534629],
                    [-4.1395580373068,36.78230547278],
                    [-4.139496716976,36.78231116996],
                    [-4.1394097899294,36.782303486268],
                    [-4.1393460505811,36.782288768484],
                    [-4.1392757079691,36.782257081535],
                    [-4.1391392564447,36.782193667405],
                    [-4.1389904550234,36.782154216299],
                    [-4.1388103765285,36.782147424442],
                    [-4.1386582994593,36.78217272438],
                    [-4.1384919555518,36.782235630567],
                    [-4.1382518668176,36.782323085674],
                    [-4.1381843212469,36.782337357541],
                    [-4.1381038717354,36.782338127],
                    [-4.1380273793207,36.782320124347],
                    [-4.137509312295,36.782152206318],
                    [-4.1371220649926,36.782024764502],
                    [-4.1370431795444,36.781988048411],
                    [-4.1370000831485,36.781937365554],
                    [-4.1369800227384,36.781869430225],
                    [-4.1369712778983,36.781850778813],
                    [-4.1369473953402,36.781800260241],
                    [-4.1369922678615,36.781786886914],
                    [-4.1369871339455,36.781776302246],
                    [-4.1370435718175,36.781763935585],
                    [-4.1370432859946,36.781744605239],
                    [-4.1370482975348,36.78173869935],
                    [-4.137049597568,36.781728141504],
                    [-4.137032306539,36.781660605992],
                    [-4.1371478334791,36.781619163345],
                    [-4.1379114726804,36.781283150429],
                    [-4.1380143781499,36.781225961538],
                    [-4.1380688429218,36.781186267357],
                    [-4.1381043042416,36.781150161469],
                    [-4.1381294566582,36.78113288888],
                    [-4.1381652960019,36.781122327681],
                    [-4.138209753619,36.781121901881]
                  ],
                  [
                    [-4.1389444635179,36.780830194869],
                    [-4.1389921867247,36.780849645915],
                    [-4.1390664244073,36.780848935129],
                    [-4.1391737789913,36.78085620224],
                    [-4.1392335319062,36.780852312198],
                    [-4.1392559434403,36.780886608434],
                    [-4.1392704307226,36.78090082498],
                    [-4.1392867871694,36.780920765529],
                    [-4.1393482189796,36.780971854909],
                    [-4.1393788716013,36.780993093814],
                    [-4.1394110966682,36.780999962784],
                    [-4.1394683014843,36.78100659287],
                    [-4.1395307533722,36.781005994402],
                    [-4.1396414682614,36.781010675695],
                    [-4.1397444039058,36.781011812282],
                    [-4.1398465047126,36.781208788694],
                    [-4.1397303441006,36.781314500425],
                    [-4.1396764425927,36.781351679197],
                    [-4.1393466524018,36.781649641623],
                    [-4.1392478389776,36.781611075646],
                    [-4.1391960136672,36.781579244529],
                    [-4.1391394584486,36.781529497931],
                    [-4.1390984768069,36.781476009651],
                    [-4.1390263471731,36.781430004734],
                    [-4.1389723165838,36.781399989975],
                    [-4.1384466019092,36.781180521562],
                    [-4.1385247396916,36.781177624776],
                    [-4.1385614658407,36.781150728924],
                    [-4.1386042068439,36.781112162947],
                    [-4.138658928102,36.781046938325],
                    [-4.1387439675439,36.780939948354],
                    [-4.1388128542192,36.780856339703],
                    [-4.1388764125184,36.780830846143],
                    [-4.1389444635179,36.780830194869]
                  ],       
                  [
                    [-4.1395622022748,36.780660195614],
                    [-4.1396724628648,36.78087264502],
                    [-4.1396740218989,36.780875073258],
                    [-4.1396735893927,36.780875195634],
                    [-4.1397324236509,36.780988700859],
                    [-4.1396374717697,36.780989397395],
                    [-4.1395374639243,36.780984613004],
                    [-4.1394846135071,36.78098282263],
                    [-4.1394287891904,36.78097302167],
                    [-4.1393915383341,36.780964190496],
                    [-4.1393670338388,36.78094834786],
                    [-4.1393467261625,36.780926722548],
                    [-4.1393321282391,36.780905042754],
                    [-4.1393304116252,36.780885536388],
                    [-4.1393366393797,36.78085132481],
                    [-4.1393852711848,36.780792793977],
                    [-4.1394279870422,36.780752569221],
                    [-4.1394523641327,36.780727450332],
                    [-4.1395622022748,36.780660195614]
                  ],
                  [
                    [-4.1388445436825,36.779310795456],
                    [-4.1388619973205,36.779311168451],
                    [-4.1390372922629,36.779648909715],
                    [-4.1388093983604,36.779642930065],
                    [-4.1380830561158,36.780030188264],
                    [-4.1380587184203,36.780021433366],
                    [-4.1379756051399,36.780029667748],
                    [-4.1379235719583,36.780054963495],
                    [-4.1378440545146,36.78009787968],
                    [-4.1377922040585,36.780135572263],
                    [-4.1377129062206,36.78019336465],
                    [-4.1376490931116,36.780255969089],
                    [-4.1375550431232,36.780358539282],
                    [-4.1375001098029,36.780396261202],
                    [-4.1374420215341,36.780429052885],
                    [-4.1373438258562,36.780459749093],
                    [-4.1371655989239,36.780498649508],
                    [-4.1371348490721,36.780503902447],
                    [-4.1370766501621,36.780529256867],
                    [-4.1370030402841,36.780554757971],
                    [-4.1368804415319,36.780603044442],
                    [-4.1367394587503,36.78065894671],
                    [-4.1365706975018,36.780712634479],
                    [-4.1364784831504,36.780730873502],
                    [-4.1364049093145,36.780758853972],
                    [-4.1362763644398,36.780822075319],
                    [-4.1362120006397,36.780847487575],
                    [-4.1360985390007,36.780888247934],
                    [-4.1358767462858,36.780946827382],
                    [-4.1358428976442,36.780952897557],
                    [-4.1358090498408,36.78095896857],
                    [-4.1357786461616,36.780956385267],
                    [-4.1357551315691,36.780936494172],
                    [-4.1357558985133,36.780895216649],
                    [-4.135755642027,36.780877840962],
                    [-4.1357721350989,36.780864255573],
                    [-4.1357924972574,36.78084668375],
                    [-4.1358020945371,36.780831584589],
                    [-4.1358018263162,36.780813420165],
                    [-4.135759173323,36.780584760157],
                    [-4.1357598874612,36.780566586513],
                    [-4.1357704075885,36.780547528579],
                    [-4.1357937847178,36.780534667386],
                    [-4.1358476577273,36.780525464056],
                    [-4.1358947271456,36.780521065233],
                    [-4.1359389559367,36.780523802762],
                    [-4.1359812091131,36.780525769157],
                    [-4.1360636132844,36.780520242968],
                    [-4.1361187888417,36.780514771261],
                    [-4.136381337725,36.780437045868],
                    [-4.1364876127198,36.780414969611],
                    [-4.1367376273044,36.780374972004],
                    [-4.1368698359091,36.78033609925],
                    [-4.1370223697922,36.780280485319],
                    [-4.1371097452706,36.780245049983],
                    [-4.1372193143536,36.780192854192],
                    [-4.1373119662404,36.780134802804],
                    [-4.1373766351418,36.780081531615],
                    [-4.1374631875173,36.779990442115],
                    [-4.1376587524173,36.779809553928],
                    [-4.1378070333224,36.779719378056],
                    [-4.1380722065797,36.779566405799],
                    [-4.1382874245293,36.779450015523],
                    [-4.1383802968602,36.779407004623],
                    [-4.1385179796863,36.779359051752],
                    [-4.1386409916664,36.779330796355],
                    [-4.1387361120238,36.779313337687],
                    [-4.1388445436825,36.779310795456]
                  ],
                  [
                    [-4.1383665681402,36.7802374828],
                    [-4.1382718216157,36.780292944181],
                    [-4.1381928540248,36.780373052549],
                    [-4.138126545623,36.780475357036],
                    [-4.1380906568261,36.780550093441],
                    [-4.1380790973427,36.780602279174],
                    [-4.1380968921242,36.780763293867],
                    [-4.1381140632921,36.780882158481],
                    [-4.1381212549654,36.780951522925],
                    [-4.1381042631703,36.781053355511],
                    [-4.1380332064201,36.781157967536],
                    [-4.1380051069263,36.781190420591],
                    [-4.1379825009321,36.781207878419],
                    [-4.1378959753787,36.781251235493],
                    [-4.1371351122639,36.781594146715],
                    [-4.1370657847004,36.781603162291],
                    [-4.1370929655376,36.7815867522],
                    [-4.1370094809389,36.781444715813],
                    [-4.1369774830216,36.781448988908],
                    [-4.1369546741853,36.7814075471],
                    [-4.1368908241959,36.781426010757],
                    [-4.1368710085375,36.781420249036],
                    [-4.1368512230539,36.781416470474],
                    [-4.1367772460484,36.781417177069],
                    [-4.1366051881972,36.781456513343],
                    [-4.1366009888635,36.7815061493],
                    [-4.1366367418736,36.781589127632],
                    [-4.1366958946442,36.781586578695],
                    [-4.1367111002556,36.781614207126],
                    [-4.1367242204494,36.781667644276],
                    [-4.1367296795833,36.781703300894],
                    [-4.1367309494417,36.781759800792],
                    [-4.136713726306,36.781803069017],
                    [-4.136707218596,36.781846235821],
                    [-4.1366827878614,36.781885262803],
                    [-4.1366530203687,36.781925777572],
                    [-4.1366283138694,36.781946128835],
                    [-4.1365858746148,36.781975270199],
                    [-4.1365468157819,36.781991448111],
                    [-4.1364882815958,36.782019306206],
                    [-4.1362821043674,36.782088805599],
                    [-4.1362269304865,36.782102263583],
                    [-4.1361823228334,36.782105562701],
                    [-4.1361464969007,36.782098721391],
                    [-4.1361087372629,36.782081840237],
                    [-4.1360888579019,36.782066225589],
                    [-4.1360796193677,36.782053826238],
                    [-4.1360795321959,36.78205370973],
                    [-4.1360623526461,36.781986791126],
                    [-4.1360623266622,36.781986466746],
                    [-4.1360474295048,36.781800812609],
                    [-4.1360433701489,36.781767804672],
                    [-4.1358589263586,36.781252317596],
                    [-4.1357900774019,36.781125817906],
                    [-4.1357753445298,36.781095786383],
                    [-4.1357747720457,36.781056998286],
                    [-4.135794036175,36.78103095152],
                    [-4.1358276937091,36.781011952259],
                    [-4.1358897357219,36.780979749824],
                    [-4.136221613845,36.780872194074],
                    [-4.136507453524,36.780850400286],
                    [-4.1366458303717,36.780826760803],
                    [-4.1368241687834,36.780795299328],
                    [-4.1371251411513,36.780718029911],
                    [-4.1372848750895,36.780679307192],
                    [-4.137395326787,36.780643534065],
                    [-4.1375087515456,36.780600294339],
                    [-4.1375852976045,36.780564845592],
                    [-4.1376799343261,36.78050194611],
                    [-4.1377652143286,36.780431697376],
                    [-4.1378230092308,36.780379069917],
                    [-4.1378839230394,36.780328891651],
                    [-4.1379635142439,36.7802909342],
                    [-4.1380249410249,36.780275467911],
                    [-4.138120530769,36.780277032813],
                    [-4.138203607169,36.780266319064],
                    [-4.1382834548598,36.780245717183],
                    [-4.1383665681402,36.7802374828]
                  ],
                  [
                    [-4.1368096664136,36.781769141586],
                    [-4.1368116881288,36.781791397216],
                    [-4.1368406501206,36.781790567408],
                    [-4.1368525163816,36.78178898239],
                    [-4.136876342781,36.78178461458],
                    [-4.1369013384559,36.781812792026],
                    [-4.1369656896832,36.781948250294],
                    [-4.1369832422276,36.781975669178],
                    [-4.1370137900756,36.782012159795],
                    [-4.13704551139,36.782031397102],
                    [-4.1371000775829,36.782049266483],
                    [-4.1374863567754,36.782176610231],
                    [-4.1379185285669,36.782315008033],
                    [-4.138021137317,36.782344487188],
                    [-4.1380684573542,36.78235552867],
                    [-4.1381028499814,36.782362095892],
                    [-4.1381443529774,36.782366296902],
                    [-4.1381843589654,36.782365913849],
                    [-4.1382199937907,36.782359826072],
                    [-4.1385057530034,36.78226053907],
                    [-4.1386550104003,36.782207386066],
                    [-4.1386862908266,36.782196741049],
                    [-4.1387646867716,36.782183347605],
                    [-4.1388160552683,36.782178258113],
                    [-4.1389769039997,36.782184189148],
                    [-4.1391202932258,36.782217299344],
                    [-4.1392453973291,36.782270125454],
                    [-4.1393044025781,36.782298296194],
                    [-4.1393331659188,36.782310664531],
                    [-4.1393662316906,36.782324141794],
                    [-4.1394035169127,36.782332979673],
                    [-4.1394364125318,36.782334963669],
                    [-4.1394692922253,36.782335798507],
                    [-4.1395078355712,36.782333130547],
                    [-4.139549236308,36.782330434927],
                    [-4.1395777440006,36.782325564203],
                    [-4.1396546429376,36.782307585858],
                    [-4.1399706599844,36.782225247065],
                    [-4.140330671129,36.782149200568],
                    [-4.1403339451005,36.782149169555],
                    [-4.1404298558715,36.782334201754],
                    [-4.1403882103831,36.782348067938],
                    [-4.1403266553589,36.782368669819],
                    [-4.140256709211,36.782390163534],
                    [-4.1401806761246,36.78240964224],
                    [-4.1401041283893,36.782424257766],
                    [-4.140030561259,36.782435870055],
                    [-4.1399618011504,36.782446624876],
                    [-4.1398950334203,36.782455738519],
                    [-4.1398271031202,36.782462068533],
                    [-4.1397592759175,36.782468121944],
                    [-4.139692700133,36.782475070542],
                    [-4.1396251495332,36.782476709204],
                    [-4.1395545160691,36.782466929199],
                    [-4.1394817276176,36.782447885514],
                    [-4.1394088612145,36.782423523511],
                    [-4.139336293207,36.782396635202],
                    [-4.1392648307727,36.78236910484],
                    [-4.1391954990183,36.782341284463],
                    [-4.1391293046104,36.782313433074],
                    [-4.1390652836302,36.782288536305],
                    [-4.1390026967937,36.782269664449],
                    [-4.1389414493854,36.782258081496],
                    [-4.1388811063845,36.78225451332],
                    [-4.138818079498,36.782259353031],
                    [-4.1387496890314,36.782272357555],
                    [-4.138680247474,36.782290148983],
                    [-4.1386146372849,36.782309346895],
                    [-4.1385540880891,36.782329757669],
                    [-4.138496927697,36.782351939539],
                    [-4.1384332964753,36.782376526177],
                    [-4.1383540455761,36.782405409379],
                    [-4.138257592496,36.782445634135],
                    [-4.1381877921932,36.782461896704],
                    [-4.1381248365529,36.78247115284],
                    [-4.138063617643,36.782476606107],
                    [-4.1379999813922,36.782478116526],
                    [-4.1379315699708,36.782474620434],
                    [-4.1378617503896,36.782466814367],
                    [-4.1377951293428,36.782455553279],
                    [-4.137733192942,36.782442804404],
                    [-4.1376872047894,36.782432427607],
                    [-4.1376755103574,36.78242974456],
                    [-4.1376154565321,36.782415806292],
                    [-4.137547874081,36.782400137161],
                    [-4.1374806109804,36.782383382574],
                    [-4.1374218672467,36.782366726893],
                    [-4.1373672800991,36.7823507535],
                    [-4.1373052917305,36.782334489254],
                    [-4.1372071304184,36.782312261283],
                    [-4.1369912385637,36.782237782202],
                    [-4.1365320301038,36.782135425747],
                    [-4.1364060224313,36.78209139896],
                    [-4.136520473135,36.782055508487],
                    [-4.1365981063268,36.782020642282],
                    [-4.1366819588911,36.78195338924],
                    [-4.1367301984231,36.781893660632],
                    [-4.1367648567566,36.781821489089],
                    [-4.1367955278185,36.781781684266],
                    [-4.1368096664136,36.781769141586]
                  ],
                  [
                    [-4.1398465047126,36.781208788694],
                    [-4.1401508700751,36.781795975412],
                    [-4.1401279363485,36.781787632903],
                    [-4.1400630352684,36.781777479065],
                    [-4.1396738676719,36.781732715509],
                    [-4.1396204481234,36.781722051213],
                    [-4.1395708557521,36.781712150508],
                    [-4.1394341435505,36.781677539952],
                    [-4.1393466524018,36.781649641623],
                    [-4.1396764425927,36.781351679197],
                    [-4.1397303441006,36.781314500425],
                    [-4.1398465047126,36.781208788694]
                  ],
                  [
                    [-4.1388206032892,36.779660432318],
                    [-4.1390463748937,36.779666376765],
                    [-4.1393296195353,36.780212097367],
                    [-4.1393168027664,36.780207823434],
                    [-4.1392381712899,36.780190327048],
                    [-4.1391287069807,36.780179762497],
                    [-4.1390131046035,36.780172574176],
                    [-4.1389101454897,36.780183513399],
                    [-4.1388032343084,36.780206104306],
                    [-4.138702680801,36.780240246314],
                    [-4.1386330833403,36.78027575122],
                    [-4.1385759321683,36.780316114277],
                    [-4.1385190022785,36.780371406343],
                    [-4.1384438073825,36.780446780611],
                    [-4.1383301429014,36.780570634135],
                    [-4.1382268133075,36.78069604753],
                    [-4.1381845877914,36.780769447861],
                    [-4.1381487442567,36.780856058071],
                    [-4.1381255934388,36.780733145836],
                    [-4.1381180480491,36.780660363252],
                    [-4.1381191787679,36.780590967795],
                    [-4.1381335026031,36.780538792121],
                    [-4.1381773709723,36.780442967683],
                    [-4.1382283748562,36.780392175024],
                    [-4.1382920329,36.780322181099],
                    [-4.1383645724089,36.780269448028],
                    [-4.1384522043736,36.780216570789],
                    [-4.1385291326473,36.780169000133],
                    [-4.1384688893911,36.780178249563],
                    [-4.1383598802192,36.7802068109],
                    [-4.1383333255102,36.780189393304],
                    [-4.138310534276,36.780181435525],
                    [-4.1382831262891,36.780178552988],
                    [-4.1382635268838,36.78017496721],
                    [-4.1382456742672,36.78015603249],
                    [-4.1381862306445,36.780097086752],
                    [-4.1381487660497,36.780065207858],
                    [-4.1381101028426,36.780042456018],
                    [-4.1388206032892,36.779660432318]
                  ],
                  [
                    [-4.138215217782,36.780181121204],
                    [-4.1382380173981,36.78019470827],
                    [-4.1382544710751,36.780197066099],
                    [-4.1382779328616,36.780197470945],
                    [-4.1382983142986,36.78020104918],
                    [-4.1383205540036,36.78021512072],
                    [-4.1381919747631,36.780242288146],
                    [-4.1381275196002,36.780249679308],
                    [-4.1380741914145,36.780250188928],
                    [-4.1380208623906,36.780250699386],
                    [-4.1379703404662,36.780251183022],
                    [-4.1379034118036,36.780281177664],
                    [-4.1378089829532,36.780349822941],
                    [-4.1376841470709,36.780450371419],
                    [-4.1375898179652,36.780525789274],
                    [-4.1375286024081,36.780562503688],
                    [-4.1374448998798,36.780597174594],
                    [-4.1373080342894,36.780643644707],
                    [-4.1370535177844,36.780707044588],
                    [-4.1368045811127,36.780768133578],
                    [-4.1366058662932,36.780808418683],
                    [-4.1364910208019,36.780825322469],
                    [-4.1364179775405,36.780821503673],
                    [-4.1363954570417,36.780817202919],
                    [-4.1363961376523,36.780791174593],
                    [-4.1364666294622,36.780763223459],
                    [-4.136635537394,36.780719453996],
                    [-4.1368073806685,36.78066573689],
                    [-4.1370954742414,36.780551394313],
                    [-4.1371690841194,36.780525893209],
                    [-4.1373290368254,36.780502046693],
                    [-4.1374027204642,36.780481504324],
                    [-4.1374823125069,36.780443546873],
                    [-4.1375556658987,36.780400689361],
                    [-4.1376194790077,36.780338084923],
                    [-4.137695401453,36.780260486097],
                    [-4.1377897448079,36.780177751678],
                    [-4.1378965269079,36.780102337176],
                    [-4.1379945390221,36.780059244133],
                    [-4.1380746792413,36.780058477189],
                    [-4.1381088782465,36.780077988585],
                    [-4.1381556266378,36.780112257998],
                    [-4.138215217782,36.780181121204]
                  ]                  

                ]
              },
              properties: {
                crs: "http://www.opengis.net/def/crs/EPSG/0/4326",
              },
            },
            data: [
              {
                dataFilter: {
                  timeRange: {
                    from: fromDate,
                    to: toDate,
                  },
                  maxCloudCoverage: 20,// nubes,
                  mosaickingOrder: "mostRecent",    
                },
                processing: {},
                type: dataset,
              },
            ],
          },
          output: {
            width: 512,
            height: 512,
            responses: [
              {
                identifier: "default",
                format: {type: "image/png"},
              },
            ],
          },
          
          evalscript: this.options.evalscript,
        };

Keep going…
I obtain the coordinates from a public database in the name of the farmer. So I can’t modify them much…
I hope you can see what I mean.

Thank you so much

Hi Cesar,

In that case, either you can run separate requests for each of the polygons that you have obtained or you can perform a Union of the three intersecting polygons. This page does a good job explaining how this operation works. You will be able to do this either using ArcGIS or QGIS.

Hi William,

I used the option of showing the plots separately, but the farmers asked me to show all the farms together to see them better.

And I thought about the option of joining the polygons, but when they asked me to show them all together, but separately, it gave me these headaches.

Although I thought that two polygons could be superimposed, as if they were independent layers, although I understand that not in the same request.

I’ll keep thinking about it to see what I can do.

A thousand thanks for your help.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.