2

I've mananged to import my great-britain osm file successfully into postgres and I can query everything fine.

osm2pgsql -s -j -G -l --number-processes 8 -K -U james -C 10000 -d osm myfile.osm

I'm trying to extract (amongst other things) is a set of data including national parks and their hiking routes. My problem is one particular area in osm (snowdonia national park) which consists of an inner boundary and an outer boundary seems to be missing the outer boundary which means the corresponding polygon entry comes up with an incorrect boundary.

The geojson I get from the query for this particular polygon seems to be incomplete, I wonder if anyone knows where I'm doing wrong.

{"type":"MultiPolygon","coordinates":[[[[-3.9963966,52.9877843],[-3.9954848,52.9879351],[-3.9939865,52.9884287],[-3.9935573,52.988687],[-3.9918407,52.989772],[-3.9910682,52.9904437],[-3.9901241,52.9915287],[-3.9907249,52.9919936],[-3.9917549,52.9926653],[-3.9919266,52.9943185],[-3.9925274,52.995145],[-3.9931282,52.9955066],[-3.9928707,52.9960232],[-3.9931282,52.9970564],[-3.9943298,52.9975213],[-3.9943298,52.9985028],[-3.9952739,52.9988127],[-3.9960464,52.9995359],[-3.9963897,53.0008789],[-3.9961323,53.001602],[-3.9950165,53.0022219],[-3.9943298,53.0029966],[-3.9938148,53.003978],[-3.9945015,53.0041329],[-3.9945015,53.0047527],[-3.9904674,53.0082647],[-3.9890083,53.0089877],[-3.9889225,53.009814],[-3.9878925,53.0101755],[-3.9878925,53.010537],[-3.9873775,53.0107952],[-3.985407,53.0106425],[-3.9833435,53.0106402],[-3.9632276,53.0108168],[-3.9629173,53.011081],[-3.9626094,53.0112339],[-3.9616764,53.0115022],[-3.9616033,53.0115975],[-3.9615477,53.0116914],[-3.9613063,53.0117398],[-3.9611634,53.0117847],[-3.9610489,53.0118141],[-3.9608522,53.0118492],[-3.9607342,53.011888],[-3.9606323,53.0119138],[-3.9605465,53.0119332],[-3.9604285,53.0119396],[-3.9603319,53.0119461],[-3.9602388,53.0119819],[-3.9601871,53.011988],[-3.9600967,53.0120248],[-3.9599585,53.0118214],[-3.9594829,53.0119449],[-3.9588916,53.0121381],[-3.9584308,53.0122811],[-3.9580039,53.012392],[-3.9573345,53.0124737],[-3.9564081,53.0126867],[-3.955923,53.0127305],[-3.955729,53.0128997],[-3.9555495,53.0129581],[-3.9554671,53.0129785],[-3.9554089,53.0130515],[-3.9552391,53.0131099],[-3.9551615,53.0132791],[-3.9551372,53.0133492],[-3.954754,53.0134163],[-3.9540556,53.0135826],[-3.9538567,53.0136147],[-3.9534007,53.0137285],[-3.9531873,53.0137956],[-3.9527896,53.0138482],[-3.9526925,53.0139036],[-3.9526043,53.0140081],[-3.9524832,53.0141005],[-3.9522243,53.0141747],[-3.9520905,53.0141809],[-3.9520082,53.0142284],[-3.9519447,53.0142831],[-3.9518041,53.0143491],[-3.9516755,53.0144141],[-3.951636,53.0144843],[-3.9515692,53.0146411],[-3.9509706,53.0150218],[-3.9504236,53.0151538],[-3.9502092,53.0151487],[-3.9500154,53.0151765],[-3.9498251,53.0151673],[-3.9492368,53.015452],[-3.9486521,53.0155562],[-3.9482679,53.0156903],[-3.9481582,53.0156924],[-3.9479472,53.0156171],[-3.9478289,53.0154242],[-3.9477877,53.0153932],[-3.9475734,53.0153581],[-3.9475596,53.0152694],[-3.9474379,53.0151085],[-3.947259,53.0150631],[-3.9472492,53.0149898],[-3.9471944,53.0149558],[-3.9470492,53.0149591],[-3.9470335,53.0149999],[-3.946968,53.0150393],[-3.9469013,53.0150604],[-3.9468831,53.0151465],[-3.9468298,53.0152085],[-3.9467401,53.0152297],[-3.9466164,53.0152661],[-3.9465606,53.0153114],[-3.946489,53.0153829],[-3.9464114,53.0153989],[-3.9463472,53.0154179],[-3.9462235,53.0154865],[-3.946067,53.0155171],[-3.9460222,53.0155477],[-3.9459058,53.0156652],[-3.9458318,53.0157119],[-3.945314,53.0160263],[-3.9450739,53.016089],[-3.9449162,53.0161219],[-3.9447962,53.0161343],[-3.9445682,53.0162466],[-3.9444979,53.0162546],[-3.9443293,53.0162773],[-3.9441365,53.0163327],[-3.9439922,53.0163976],[-3.9437812,53.0164874],[-3.9436478,53.0165421],[-3.943535,53.0165705],[-3.9433689,53.0166537],[-3.9432476,53.0167018],[-3.9431324,53.016742],[-3.9430621,53.0167989],[-3.9429942,53.0168361],[-3.9428545,53.0168717],[-3.9426486,53.016963],[-3.9423818,53.0170177],[-3.9419234,53.0173029],[-3.9417391,53.0173518],[-3.941704,53.0173934],[-3.9416458,53.0174131],[-3.9416263,53.0174226],[-3.9416103,53.0174445],[-3.9415259,53.0174758],[-3.9411929,53.0175338],[-3.9411176,53.0176835],[-3.9409651,53.0179321],[-3.9404989,53.0183875],[-3.9398192,53.0180182],[-3.9393979,53.0182068],[-3.9392437,53.0182659],[-3.9385357,53.0182764],[-3.9380913,53.0182351],[-3.9374336,53.0180825],[-3.9371297,53.0179545],[-3.9370638,53.017857],[-3.9370182,53.0177504],[-3.9367396,53.0176163],[-3.9365421,53.0174639],[-3.9363344,53.0173877],[-3.9362584,53.0173725],[-3.9357482,53.0173721],[-3.9353111,53.0173116],[-3.9348653,53.0172841],[-3.9345374,53.0172976],[-3.9329759,53.0173817],[-3.9313757,53.0172744],[-3.9311717,53.0174679],[-3.9309243,53.0176407],[-3.9305596,53.0178448],[-3.9299264,53.0181221],[-3.9289791,53.0187743],[-3.9287673,53.0188798],[-3.9271555,53.0195361],[-3.9264969,53.0197159],[-3.9257371,53.019856],[-3.9243896,53.0202308],[-3.9231762,53.0202445],[-3.9220189,53.0201821],[-3.9209298,53.0202095],[-3.9192037,53.0203172],[-3.9187161,53.0203314],[-3.9179045,53.0201203],[-3.9172148,53.0200893],[-3.9171204,53.0202765],[-3.916933,53.020502],[-3.916472,53.0207671],[-3.9163571,53.0208746],[-3.9163129,53.0209446],[-3.9160115,53.0212797],[-3.9150027,53.0225631],[-3.9113418,53.0217327],[-3.9058458,53.0208068],[-3.903381,53.0209806],[-3.8989686,53.0205555],[-3.8986521,53.0196135],[-3.8985356,53.0191909],[-3.8984684,53.0189474],[-3.898427,53.0186345],[-3.8982185,53.0182479],[-3.8981549,53.0172575],[-3.8976824,53.0159954],[-3.8975501,53.0153746],[-3.8975875,53.0146507],[-3.8963944,53.0135584],[-3.8961077,53.0134607],[-3.8952121,53.0128099],[-3.8932037,53.0118521],[-3.8926371,53.0119058],[-3.892161,53.0120076],[-3.8901952,53.0114135],[-3.8891033,53.0114729],[-3.8877683,53.0115966],[-3.8882564,53.0107514],[-3.8887808,53.0100781],[-3.8895826,53.0093195],[-3.8900567,53.0090925],[-3.8910559,53.0081914],[-3.8919055,53.0068145],[-3.8925435,53.0060445],[-3.8927022,53.0048064],[-3.8928469,53.0036051],[-3.8929976,53.0028661],[-3.8929274,53.0027815],[-3.8928895,53.0023976],[-3.8924841,53.0015485],[-3.8922169,53.001212],[-3.8926233,53.0007749],[-3.8930314,53.0006472],[-3.8931936,53.0004724],[-3.8933491,53.0003756],[-3.8934045,53.0003251],[-3.8934396,53.0002682],[-3.8934477,53.0002129],[-3.8936518,52.9998729],[-3.8944567,52.9988444],[-3.895513,52.9976008],[-3.8956098,52.9974376],[-3.896045,52.9968119],[-3.8960609,52.9964206],[-3.8961594,52.9961529],[-3.8961794,52.995804],[-3.8965655,52.9951667],[-3.8965421,52.9948875],[-3.8961068,52.9949343],[-3.8950096,52.9949826],[-3.8944477,52.9950447],[-3.8942044,52.995086],[-3.892953,52.9953301],[-3.8921387,52.9951598],[-3.8906326,52.9946283],[-3.8898909,52.9945063],[-3.8896233,52.9946283],[-3.8894263,52.9944653],[-3.8893481,52.9943361],[-3.8886218,52.9940784],[-3.8883924,52.9938391],[-3.888257,52.9937471],[-3.8880651,52.9936869],[-3.8877975,52.9936641],[-3.8868216,52.9935242],[-3.8865454,52.9934907],[-3.8857106,52.9930133],[-3.8847982,52.9924865],[-3.8840875,52.9926526],[-3.883456,52.9924014],[-3.8829643,52.9912009],[-3.8827322,52.9908617],[-3.8810775,52.9900271],[-3.879498,52.9892704],[-3.8781466,52.9887765],[-3.8770472,52.988394],[-3.874936,52.9875318],[-3.8748083,52.9874501],[-3.8742893,52.9872626],[-3.8731887,52.9868196],[-3.8733268,52.9830386],[-3.8740381,52.9822228],[-3.8746058,52.9813728],[-3.8748459,52.9809083],[-3.8749341,52.9804274],[-3.8749575,52.9802998],[-3.8763159,52.9792391],[-3.8764197,52.9791048],[-3.8765928,52.9789983],[-3.8767351,52.9789658],[-3.8768813,52.9788709],[-3.8769774,52.9786601],[-3.877112,52.97863],[-3.8772159,52.9785907],[-3.8773082,52.9785027],[-3.8773274,52.9783822],[-3.8778467,52.9783128],[-3.8777967,52.9781738],[-3.878012,52.9780233],[-3.8782967,52.9779445],[-3.8785774,52.9779353],[-3.8787159,52.9778241],[-3.8789351,52.9777361],[-3.8789544,52.977669],[-3.8792044,52.9775925],[-3.8793467,52.9775393],[-3.8794159,52.9774466],[-3.8796774,52.9772938],[-3.8797428,52.9773146],[-3.8797082,52.9773748],[-3.8797121,52.977442],[-3.8798236,52.9775092],[-3.8799121,52.97753],[-3.8799774,52.9773934],[-3.8800236,52.9773818],[-3.8802351,52.9773725],[-3.8802967,52.9774327],[-3.8804813,52.9773656],[-3.8806313,52.9773401],[-3.8806351,52.9774582],[-3.8806044,52.9775555],[-3.8807428,52.9776041],[-3.8809544,52.97731],[-3.8811274,52.9772174],[-3.8807082,52.9768372],[-3.8809657,52.9760103],[-3.8816523,52.9756485],[-3.882339,52.9756485],[-3.8833689,52.9754935],[-3.8841414,52.9751317],[-3.8861155,52.9744081],[-3.8874888,52.973943],[-3.887918,52.9735295],[-3.8890338,52.9733227],[-3.8904929,52.9722373],[-3.8916087,52.9717204],[-3.8928068,52.9719352],[-3.8931178,52.9718549],[-3.8933769,52.9718141],[-3.8934287,52.9718059],[-3.893562,52.9717836],[-3.8938109,52.9718757],[-3.8943839,52.971782],[-3.8946682,52.9716818],[-3.8949418,52.9716075],[-3.8951886,52.971572],[-3.8954407,52.9716237],[-3.8956553,52.9715946],[-3.8959771,52.9714589],[-3.89624,52.9714298],[-3.8968462,52.9714428],[-3.8970125,52.9713362],[-3.8983893,52.9708934],[-3.8995909,52.9703765],[-3.9006209,52.9703248],[-3.901565,52.9704799],[-3.9031958,52.9713586],[-3.9053416,52.9717204],[-3.9066528,52.9718565],[-3.907525,52.9717971],[-3.9078431,52.9716892],[-3.9084649,52.9715826],[-3.9099626,52.97139],[-3.911249,52.9714821],[-3.9121853,52.9714616],[-3.9127389,52.9713718],[-3.9129463,52.971445],[-3.9132124,52.9712986],[-3.9145771,52.9710874],[-3.9155518,52.9704874],[-3.9165104,52.9702674],[-3.9168929,52.9699806],[-3.9171501,52.9696889],[-3.9183792,52.9693531],[-3.9187109,52.9692921],[-3.9189382,52.9691614],[-3.9190449,52.969089],[-3.9191207,52.9690375],[-3.9198326,52.9689849],[-3.9204581,52.9687768],[-3.9207424,52.968573],[-3.9211705,52.9685216],[-3.9218882,52.9680321],[-3.922275,52.9679812],[-3.9239534,52.967704],[-3.9244527,52.9677728],[-3.9255292,52.9680692],[-3.9261713,52.9681138],[-3.9268643,52.9682063],[-3.9272061,52.9680912],[-3.9273685,52.9681379],[-3.9275085,52.9681693],[-3.9276519,52.9681496],[-3.9279286,52.9680476],[-3.9283147,52.9679627],[-3.9286124,52.9679664],[-3.9288487,52.9679655],[-3.9291478,52.9679608],[-3.9293133,52.9678996],[-3.9293975,52.9678312],[-3.9296082,52.9678174],[-3.9300207,52.9679292],[-3.9307509,52.9677949],[-3.9307476,52.9677133],[-3.9309981,52.9676913],[-3.9313714,52.9676533],[-3.9318937,52.9677291],[-3.9321916,52.9677094],[-3.9323747,52.9676196],[-3.9327173,52.9673788],[-3.9332186,52.9671727],[-3.9337195,52.9670083],[-3.9338954,52.9667629],[-3.9339653,52.9664724],[-3.9340334,52.9662577],[-3.9341382,52.9662548],[-3.9344042,52.9663004],[-3.9346963,52.9661564],[-3.9350205,52.9660363],[-3.9352326,52.9660245],[-3.935495,52.9660218],[-3.9356973,52.9660871],[-3.9375678,52.9662944],[-3.9392157,52.9662059],[-3.9405149,52.9655989],[-3.9418275,52.9656494],[-3.9425128,52.9649909],[-3.9437345,52.9650325],[-3.9438962,52.9650194],[-3.9440811,52.9649829],[-3.9441793,52.9649636],[-3.9445423,52.964821],[-3.9448291,52.9646683],[-3.9449606,52.9645303],[-3.9448838,52.9643275],[-3.9448494,52.9640473],[-3.9448189,52.963857],[-3.9446915,52.9635568],[-3.9447333,52.9633568],[-3.944835,52.9632581],[-3.9450163,52.9632127],[-3.9452056,52.9631975],[-3.9454897,52.9632258],[-3.9456675,52.9631785],[-3.9459698,52.9630699],[-3.946168,52.9629043],[-3.9464741,52.9626465],[-3.9467916,52.9624898],[-3.9472889,52.9622836],[-3.9478101,52.9622248],[-3.9481939,52.9622355],[-3.9486163,52.962292],[-3.9490136,52.9623246],[-3.9493875,52.9622956],[-3.949608,52.9622317],[-3.9499419,52.9621665],[-3.9502114,52.9621497],[-3.9510462,52.9619445],[-3.9513675,52.9618466],[-3.9515338,52.9617663],[-3.9516856,52.9616596],[-3.9519184,52.9614188],[-3.9520209,52.9613103],[-3.9521096,52.9611981],[-3.9525774,52.9614021],[-3.9553039,52.9633426],[-3.9572799,52.9648924],[-3.957905,52.965832],[-3.9575338,52.966095],[-3.9569585,52.9662426],[-3.9562096,52.966477],[-3.9557153,52.9667615],[-3.9554202,52.9670161],[-3.9550453,52.9671659],[-3.9543181,52.9673219],[-3.9537425,52.9673938],[-3.952451,52.9675397],[-3.9521281,52.967667],[-3.9519315,52.9677918],[-3.9517221,52.9679874],[-3.951619,52.9680837],[-3.9511634,52.9686883],[-3.9510303,52.9688055],[-3.9507122,52.9691203],[-3.9506199,52.9693224],[-3.9506652,52.9693891],[-3.9507578,52.969507],[-3.950861,52.9696196],[-3.9508796,52.9696779],[-3.9508707,52.9697333],[-3.9507696,52.9698534],[-3.9506592,52.9699359],[-3.9505542,52.9699716],[-3.9502406,52.9701764],[-3.9501709,52.9702588],[-3.9502224,52.9703607],[-3.9503881,52.9705688],[-3.9504145,52.970723],[-3.9504002,52.9708576],[-3.95015,52.9712554],[-3.9498447,52.971489],[-3.9494062,52.9717463],[-3.949345,52.97194],[-3.9492509,52.9721934],[-3.9484047,52.9728642],[-3.947227,52.9733227],[-3.9459634,52.9755074],[-3.9464752,52.9762902],[-3.9508524,52.9782323],[-3.9538876,52.9794771],[-3.9539602,52.9805006],[-3.954454,52.9811389],[-3.9545265,52.9812935],[-3.9545067,52.9814679],[-3.9545102,52.9816734],[-3.9543553,52.9818168],[-3.9541643,52.9820745],[-3.9541446,52.9822528],[-3.9543816,52.9824748],[-3.9547174,52.9827127],[-3.9550071,52.9828356],[-3.9556985,52.9834937],[-3.9559359,52.9835845],[-3.9578225,52.9836169],[-3.9582283,52.9836338],[-3.9583982,52.9837077],[-3.9584838,52.9838227],[-3.9585233,52.9839931],[-3.9584755,52.9841972],[-3.9583784,52.984449],[-3.9583389,52.9846869],[-3.9583455,52.984893],[-3.9583136,52.9851901],[-3.958327,52.9853651],[-3.9585299,52.9855233],[-3.9586985,52.9855933],[-3.9588827,52.985606],[-3.9591337,52.9855652],[-3.9593875,52.9855399],[-3.9598449,52.9855882],[-3.9601526,52.9855908],[-3.9603933,52.9855352],[-3.9609069,52.9852537],[-3.961571,52.9849071],[-3.9620789,52.9846393],[-3.9624683,52.9845507],[-3.9627861,52.984551],[-3.9630634,52.9845894],[-3.9640966,52.9847828],[-3.9658454,52.985017],[-3.9658953,52.9850516],[-3.9660245,52.9851281],[-3.9663137,52.9852397],[-3.9664835,52.985252],[-3.9666685,52.9851924],[-3.9667109,52.9852751],[-3.9667919,52.9853136],[-3.9669455,52.985233],[-3.967097,52.9852169],[-3.9672723,52.9852658],[-3.9679317,52.9853271],[-3.9696561,52.9851388],[-3.9712869,52.9847254],[-3.9717161,52.9849838],[-3.972746,52.9850355],[-3.9739693,52.9857306],[-3.9741437,52.9857322],[-3.9743833,52.9858035],[-3.9747726,52.9859451],[-3.9749464,52.9860652],[-3.9750449,52.9863113],[-3.9755367,52.9862734],[-3.9757615,52.9862228],[-3.9760233,52.9864355],[-3.9762651,52.9865339],[-3.9765098,52.9864295],[-3.9766408,52.9864072],[-3.9769036,52.9862436],[-3.9768902,52.9862154],[-3.9769668,52.9861648],[-3.977031,52.9861634],[-3.977152,52.9861069],[-3.9771792,52.9860503],[-3.9772632,52.9860221],[-3.977278,52.9859359],[-3.9773867,52.9859745],[-3.9774657,52.9860489],[-3.9775744,52.9860845],[-3.9776534,52.9861678],[-3.9777967,52.9861946],[-3.9778658,52.9862689],[-3.9780966,52.9862588],[-3.9782709,52.9861619],[-3.9784685,52.9861589],[-3.9785623,52.9861083],[-3.9788241,52.9861589],[-3.9791205,52.986147],[-3.9791798,52.9860994],[-3.9792786,52.9860816],[-3.9794959,52.9861619],[-3.979807,52.9861306],[-3.9798368,52.9860399],[-3.9800443,52.9859478],[-3.9801381,52.9859715],[-3.9803999,52.9859269],[-3.9806864,52.986031],[-3.9808001,52.9860221],[-3.9809615,52.9860909],[-3.9812595,52.9860459],[-3.981546,52.9860578],[-3.9818967,52.9859656],[-3.9819955,52.9860191],[-3.9822474,52.9860548],[-3.9822277,52.9861262],[-3.9824005,52.9861708],[-3.9824302,52.9862392],[-3.9825142,52.986257],[-3.9824993,52.986373],[-3.9826377,52.9864622],[-3.9827364,52.9865871],[-3.9828501,52.9866169],[-3.9829192,52.9867596],[-3.9830724,52.986825],[-3.9834145,52.9868532],[-3.9837145,52.9867834],[-3.9838232,52.9867061],[-3.9841245,52.9866258],[-3.9842628,52.986489],[-3.984579,52.9864503],[-3.9850878,52.9862719],[-3.9851965,52.9861738],[-3.9853002,52.9861708],[-3.9853595,52.9861202],[-3.9853348,52.9860756],[-3.985483,52.9860489],[-3.9856608,52.9858883],[-3.9863968,52.9855612],[-3.9865047,52.9854164],[-3.9963966,52.9877843]]],[[[-4.084334,52.9128366],[-4.0842393,52.9130282],[-4.0840704,52.9129997],[-4.0840433,52.9131912],[-4.0840569,52.9133706],[-4.0839555,52.9135662],[-4.0829417,52.9140756],[-4.0824483,52.9142305],[-4.0821036,52.9143487],[-4.0819481,52.9144221],[-4.0817589,52.9144058],[-4.0817521,52.9142264],[-4.0811574,52.9142183],[-4.0804882,52.9139371],[-4.0802314,52.913448],[-4.0802314,52.9126125],[-4.0805558,52.9119644],[-4.0809816,52.9117036],[-4.0818873,52.9110066],[-4.0815021,52.9106602],[-4.0815426,52.9105338],[-4.0817656,52.9104645],[-4.0825361,52.9106968],[-4.0829484,52.9111248],[-4.0833404,52.9113205],[-4.0836378,52.9113816],[-4.0838203,52.9114957],[-4.0840366,52.9117525],[-4.0840028,52.9121478],[-4.0840907,52.9125228],[-4.084334,52.9128366]]]]}
  • It's a valid/simple MultiPolygon with two elements. What did you expect? – Mike T Feb 11 '15 at 6:05
1

Osm2PgSql will only import polygons into the planet_polygon table if they are closed. You may find the missing data in the planet_lines table

Use OverPass Turbo or OSm to get the osm_id of the missing geometry and search for it in the polygons and lines table's. This will tell you if they were actually imported. If they are not in those tables, they were never imported so you need to go back to your source data.

You can then query both tables and join close the geometry in the ways if need be using PostGIS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.