WGS84 স্থানাঙ্কের সাথে জিওজসন বহুভুজগুলি মার্জ করুন


9

আমার কাছে কিছু সংলগ্ন বহুভুজ সহ একটি জিওজসন ফাইল রয়েছে এবং আমি সেগুলিকে একটিতে মিশতে চাই। আমি জানি এটি একটি পুনরাবৃত্ত প্রশ্ন তবে আমি এই জিওজসনের মতো অক্ষাংশ এবং দ্রাঘিমাংশ স্থানাঙ্ক সহ বহুভুজগুলির জন্য তথ্য খুঁজে পাচ্ছি না:

{
"type": "FeatureCollection",
"features": [{
    "type": "Feature",
    "id": "16966",
    "properties": {
        "Name": "BEYNES"
    },
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
                [1.874862143378, 48.834371283832],
                [1.8656030688715, 48.831612507285],
                [1.8515105581603, 48.834338209867],
                [1.8466221791684, 48.828669687135],
                [1.8415374906793, 48.828818416443],
                [1.8392188748285, 48.830163082204],
                [1.8419058888315, 48.843509743804],
                [1.8472716401406, 48.849200964455],
                [1.8375210341485, 48.856814659389],
                [1.8383984699903, 48.87125874614],
                [1.8572939822902, 48.871944300476],
                [1.874663272221, 48.877028568925],
                [1.8831026195664, 48.874535338148],
                [1.9127169447188, 48.860849357594],
                [1.9030441003473, 48.846352529476],
                [1.8932786620468, 48.847377864779],
                [1.8885787644301, 48.846659731042],
                [1.8820915893247, 48.834609966105],
                [1.874862143378, 48.834371283832]
            ]
        ]
    }
}, {
    "type": "Feature",
    "id": "19484",
    "properties": {
        "Name": "VILLIERS-LE-MAHIEU"
    },
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
                [1.7780400297013, 48.832305931728],
                [1.7734339848429, 48.83177307884],
                [1.7611156919393, 48.841036344684],
                [1.7664174460888, 48.850202460021],
                [1.7590182348483, 48.858733519882],
                [1.7586155859222, 48.868766940337],
                [1.7751309254077, 48.872615718624],
                [1.7866538204874, 48.862012015338],
                [1.7869427495986, 48.855458134055],
                [1.7916969548512, 48.854399942691],
                [1.7780400297013, 48.832305931728]
            ]
        ]
    }
}, {
    "type": "Feature",
    "id": "19635",
    "properties": {
        "Name": "THOIRY"
    },
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
                [1.7916969548512, 48.854399942691],
                [1.7869427495986, 48.855458134055],
                [1.7866538204874, 48.862012015338],
                [1.7751309254077, 48.872615718624],
                [1.7890825137274, 48.88596098882],
                [1.809924587051, 48.885828200975],
                [1.8232153433812, 48.876452907166],
                [1.8120930366694, 48.869687419516],
                [1.8059996841005, 48.860128943481],
                [1.7916969548512, 48.854399942691]
            ]
        ]
    }
}, {
    "type": "Feature",
    "id": "22025",
    "properties": {
        "Name": "SAINT-GERMAIN-DE-LA-GRANGE"
    },
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
                [1.9130661363292, 48.819937951319],
                [1.9012689316149, 48.821961792363],
                [1.8902265103296, 48.83135783825],
                [1.8813533302838, 48.831553995346],
                [1.8820915893247, 48.834609966105],
                [1.8885787644301, 48.846659731042],
                [1.8932786620468, 48.847377864779],
                [1.918172631346, 48.835751243515],
                [1.9217370910726, 48.82612360123],
                [1.9178385858043, 48.820341013587],
                [1.9130661363292, 48.819937951319]
            ]
        ]
    }
}, {
    "type": "Feature",
    "id": "22141",
    "properties": {
        "Name": "MARCQ"
    },
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
                [1.8248465610939, 48.850691703059],
                [1.8126901224641, 48.853063092402],
                [1.8059996841005, 48.860128943481],
                [1.8120930366694, 48.869687419516],
                [1.8232153433812, 48.876452907166],
                [1.832123740674, 48.878689723796],
                [1.8383984699903, 48.87125874614],
                [1.8375210341485, 48.856814659389],
                [1.8246539514431, 48.853792824064],
                [1.8248465610939, 48.850691703059]
            ]
        ]
    }
}, {
    "type": "Feature",
    "id": "23142",
    "properties": {
        "Name": "PLAISIR"
    },
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
                [1.9859353011511, 48.799648360798],
                [1.9700422200803, 48.799863243499],
                [1.9568703127355, 48.789270428369],
                [1.9412379043212, 48.791543482649],
                [1.9149109434793, 48.802631449948],
                [1.9130661363292, 48.819937951319],
                [1.9178385858043, 48.820341013587],
                [1.9217370910726, 48.82612360123],
                [1.9308900413011, 48.82617879826],
                [1.9432582596776, 48.836964867387],
                [1.9687926794162, 48.834831269347],
                [1.9700860589995, 48.83487839014],
                [1.9668984852354, 48.821791311587],
                [1.9864791162903, 48.799688951127],
                [1.9859353011511, 48.799648360798]
            ]
        ]
    }
}, {
    "type": "Feature",
    "id": "25041",
    "properties": {
        "Name": "NEAUPHLE-LE-CHATEAU"
    },
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
                [1.9149109434793, 48.802631449948],
                [1.898492103809, 48.809622894015],
                [1.8936915762635, 48.808670122548],
                [1.8889579820032, 48.809057956502],
                [1.9012689316149, 48.821961792363],
                [1.9130661363292, 48.819937951319],
                [1.9149109434793, 48.802631449948]
            ]
        ]
    }
}, {
    "type": "Feature",
    "id": "25042",
    "properties": {
        "Name": "VICQ"
    },
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
                [1.8479013041869, 48.812707864194],
                [1.8290034942099, 48.811265015475],
                [1.8111878056542, 48.814965840962],
                [1.8138162274863, 48.821557956532],
                [1.8061163949282, 48.830053068487],
                [1.8260692281346, 48.8296929387],
                [1.8327204785815, 48.833814514469],
                [1.8392188748285, 48.830163082204],
                [1.8415374906793, 48.828818416443],
                [1.8479013041869, 48.812707864194]
            ]
        ]
    }
}, {
    "type": "Feature",
    "id": "28635",
    "properties": {
        "Name": "ANDELU"
    },
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
                [1.8232153433812, 48.876452907166],
                [1.809924587051, 48.885828200975],
                [1.7890825137274, 48.88596098882],
                [1.7831043145867, 48.891413707227],
                [1.8056581682382, 48.898808951748],
                [1.8355241961203, 48.88517153445],
                [1.832123740674, 48.878689723796],
                [1.8232153433812, 48.876452907166]
            ]
        ]
    }
}, {
    "type": "Feature",
    "id": "29431",
    "properties": {
        "Name": "GOUPILLIERES"
    },
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
                [1.7586155859222, 48.868766940337],
                [1.7399133540032, 48.871449653856],
                [1.7412768098614, 48.874270196957],
                [1.7500295563815, 48.875450216663],
                [1.7522176666426, 48.87802738985],
                [1.7483369243043, 48.879497893862],
                [1.7704322974105, 48.896069058229],
                [1.7831043145867, 48.891413707227],
                [1.7890825137274, 48.88596098882],
                [1.7751309254077, 48.872615718624],
                [1.7586155859222, 48.868766940337]
            ]
        ]
    }
}, {
    "type": "Feature",
    "id": "30394",
    "properties": {
        "Name": "SAULX-MARCHAIS"
    },
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
                [1.8392188748285, 48.830163082204],
                [1.8327204785815, 48.833814514469],
                [1.8339180317868, 48.843621026126],
                [1.8248465610939, 48.850691703059],
                [1.8246539514431, 48.853792824064],
                [1.8375210341485, 48.856814659389],
                [1.8472716401406, 48.849200964455],
                [1.8419058888315, 48.843509743804],
                [1.8392188748285, 48.830163082204]
            ]
        ]
    }
}, {
    "type": "Feature",
    "id": "34743",
    "properties": {
        "Name": "OSMOY"
    },
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
                [1.7164466657999, 48.854920532859],
                [1.7052218923542, 48.860142271734],
                [1.7018533752573, 48.865673293225],
                [1.7198777076843, 48.872271383422],
                [1.7292022608762, 48.871219483604],
                [1.7274882838909, 48.859337782823],
                [1.7164466657999, 48.854920532859]
            ]
        ]
    }
}, {
    "type": "Feature",
    "id": "35495",
    "properties": {
        "Name": "FLEXANVILLE"
    },
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
                [1.7400314884878, 48.837820948808],
                [1.7329083268502, 48.84610157804],
                [1.7189195066054, 48.848587971564],
                [1.7164466657999, 48.854920532859],
                [1.7274882838909, 48.859337782823],
                [1.7292022608762, 48.871219483604],
                [1.7314395279166, 48.873968471423],
                [1.7399133540032, 48.871449653856],
                [1.7586155859222, 48.868766940337],
                [1.7590182348483, 48.858733519882],
                [1.7664174460888, 48.850202460021],
                [1.7611156919393, 48.841036344684],
                [1.7400314884878, 48.837820948808]
            ]
        ]
    }
}, {
    "type": "Feature",
    "id": "36858",
    "properties": {
        "Name": "THIVERVAL-GRIGNON"
    },
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
                [1.9687926794162, 48.834831269347],
                [1.9432582596776, 48.836964867387],
                [1.9308900413011, 48.82617879826],
                [1.9217370910726, 48.82612360123],
                [1.918172631346, 48.835751243515],
                [1.8932786620468, 48.847377864779],
                [1.9030441003473, 48.846352529476],
                [1.9127169447188, 48.860849357594],
                [1.9217113433858, 48.85832247492],
                [1.9613817024309, 48.851891899558],
                [1.970646933861, 48.840972240396],
                [1.9687926794162, 48.834831269347]
            ]
        ]
    }
}, {
    "type": "Feature",
    "id": "37629",
    "properties": {
        "Name": "NEAUPHLE-LE-VIEUX"
    },
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
                [1.8726237069958, 48.798651240921],
                [1.8711691241023, 48.799177186792],
                [1.8417552547252, 48.800622726785],
                [1.8479013041869, 48.812707864194],
                [1.8415374906793, 48.828818416443],
                [1.8466221791684, 48.828669687135],
                [1.8515105581603, 48.834338209867],
                [1.8656030688715, 48.831612507285],
                [1.874862143378, 48.834371283832],
                [1.8658960165459, 48.822530967257],
                [1.8689494730467, 48.8130077893],
                [1.8850727051194, 48.805432976807],
                [1.8858999508989, 48.804316374995],
                [1.8758215111851, 48.805049510395],
                [1.8726237069958, 48.798651240921]
            ]
        ]
    }
}, {
    "type": "Feature",
    "id": "38841",
    "properties": {
        "Name": "MONTAINVILLE"
    },
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
                [1.8383984699903, 48.87125874614],
                [1.832123740674, 48.878689723796],
                [1.8355241961203, 48.88517153445],
                [1.8585137392849, 48.890942160516],
                [1.8687589726649, 48.885193372296],
                [1.874663272221, 48.877028568925],
                [1.8572939822902, 48.871944300476],
                [1.8383984699903, 48.87125874614]
            ]
        ]
    }
}, {
    "type": "Feature",
    "id": "43121",
    "properties": {
        "Name": "VILLIERS-SAINT-FREDERIC"
    },
    "geometry": {
        "type": "Polygon",
        "coordinates": [
            [
                [1.8850727051194, 48.805432976807],
                [1.8689494730467, 48.8130077893],
                [1.8658960165459, 48.822530967257],
                [1.874862143378, 48.834371283832],
                [1.8820915893247, 48.834609966105],
                [1.8813533302838, 48.831553995346],
                [1.8902265103296, 48.83135783825],
                [1.9012689316149, 48.821961792363],
                [1.8889579820032, 48.809057956502],
                [1.8936915762635, 48.808670122548],
                [1.8940011070565, 48.805632849681],
                [1.8850727051194, 48.805432976807]
            ]
        ]
    }
}]

}

কাঁচা বহুভুজ

সমস্ত বহুভুজগুলির বাহ্যিক রূপের সাথে কোনও মাস্টার বহুভুজ তৈরির উপায় আছে কি?

উত্তর:


13

আপনি এর জন্য মানচিত্রটি ব্যবহার করতে পারেন , এবং তারপরে কমান্ড লাইন থেকে দ্রবীভূত করতে পারেন :

mapshaper --dissolve -i your_data.geojson

2
দুর্দান্ত সরঞ্জাম যদি আপনি সিনট্যাক্স ত্রুটিগুলি পান তবে এটির মতো চেষ্টা করুনmapshaper -i your_data.geojson --dissolve
কাইল হটচিসিস

কাইলহটচকিসকে দুর্দান্ত টিপস, ধন্যবাদ
রিকার্ডো

4

কিউজিসের সাথে এটি করা সহজ।

  1. কিউজিস খুলুন
  2. জিওজসন ফাইলকে কুইগিসে টানুন এবং ফেলে দিন
  3. ভেক্টর মেনুতে "দ্রবীভূত" সরঞ্জামটি ব্যবহার করুন (এটি একটি সাবমেনুর অভ্যন্তরে)। ড্রপডাউন থেকে "সমস্ত দ্রবীভূত করুন" বিকল্পটি ব্যবহার করুন
  4. এটি একটি শেফফাইল তৈরি করবে (মানচিত্রে আউটপুট দিতে বাক্সটি চেক করুন)
  5. যা আপনি আবার স্তর প্যানে ডান ক্লিক করে এবং "সংরক্ষণাগার হিসাবে" এবং তারপরে ফর্ম্যাট হিসাবে জিওজসন বেছে নিয়ে একটি জিওজসন ফাইল হিসাবে সংরক্ষণ করতে পারেন which

"ডিসলভ" আপনার অপারেশনটির নাম। এটি আলসিয়ো আপনাকে গুগল করার আরও ইঙ্গিত দেয়।


1
আপনার প্রস্তাবের জন্য til_b ধন্যবাদ, আমি জয়রেম একটি ব্যবহার করি তবে আপনার দেখতে দেখতে খুব সুন্দর তবে কম স্কেলেবল
হেনরি_1310

হ্যাঁ এটি কম স্কেলযোগ্য। এর আগে মানচিত্রের সম্পর্কে জানতাম না - তাই আমি নতুন জিনিসগুলিও শিখেছি!
টিল_বি

দ্রবীভূত সরঞ্জামে আমাকে নির্দেশ করার জন্য ধন্যবাদ। আমি আপনার পদক্ষেপগুলি অনুসরণ করেছিলাম এবং নীচের ত্রুটিটি বাদ দিয়ে প্রায় যা চাইছিলাম তা পেয়েছিলাম। এটির চেয়ে পছন্দসই স্তরটি ছাপিয়ে গেছে, 44 বৈশিষ্ট্যটি বাদ দিয়ে। ঠিক কীভাবে অবৈধ ছিল তা কীভাবে খুঁজে বের করবেন সে সম্পর্কে কোনও পরামর্শ? ত্রুটি বার্তা: বৈশিষ্ট্য (44) অবৈধ জ্যামিতি আছে এবং এড়িয়ে গেছে। দয়া করে জ্যামিতি ঠিক করুন বা "অবৈধ ইনপুট বৈশিষ্ট্যগুলি উপেক্ষা করুন" বিকল্পে প্রসেসিং সেটিংটি পরিবর্তন করুন।
carpiediem

1
বুঝেছি. টুলবক্স> ভেক্টর জ্যামিতি> জ্যামিতিগুলি ঠিক করুন
carpiediem

2

যদি কেউ অ্যালগরিদমভাবে করতে চায় তবে এখানে একটি অজগর স্নিপেট রয়েছে:

#!/usr/bin/env python

from json import load, JSONEncoder
from argparse import ArgumentParser, FileType
from re import compile
import sys

from shapely.geometry import Polygon, mapping
from shapely.ops import cascaded_union


parser = ArgumentParser(description="Group (merge) the GeoJSON geometries of same vehicles with different day index.")

defaults = dict(outfile=sys.stdout)

parser.set_defaults(**defaults)

parser.add_argument('infile', type=FileType('r'), help='GeoJSON file whose vehicles will be merged')

parser.add_argument('-o', '--outfile', dest='outfile', type=FileType('wb', 0), help='Outfile')


if __name__ == '__main__':
    args = parser.parse_args()
    infile = args.infile
    outfile = args.outfile

    file = load(infile)

    polygons = []

    for feat in file['features']:
        polygon = Polygon([ (coor[0], coor[1]) for coor in  feat['geometry']['coordinates'][0] ])
        polygons.append(polygon)

    new_geometry = mapping(cascaded_union(polygons)) # This line merges the polygones

    new_feature = dict(type='Feature', id="", properties=dict(Name=""),geometry=dict(type=new_geometry['type'], coordinates=new_geometry['coordinates']))

    outjson = dict(type='FeatureCollection', features=[new_feature])

    encoder = JSONEncoder(separators=(',', ':'))
    encoded = encoder.iterencode(outjson)

    output = outfile

    for token in encoded:
        output.write(token)

যা উপরের ইনপুটটির জন্য নিম্নলিখিত আউটপুটটি প্রদান করে

ভাবমূর্তি

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "id": "",
      "properties": {
        "Name": ""
      },
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              1.7780400297013,
              48.832305931728
            ],
            [
              1.7734339848429,
              48.83177307884
            ],
            [
              1.7611156919393,
              48.841036344684
            ],
            [
              1.7400314884878,
              48.837820948808
            ],
            [
              1.7329083268502,
              48.84610157804
            ],
            [
              1.7189195066054,
              48.848587971564
            ],
            [
              1.7164466657999,
              48.854920532859
            ],
            [
              1.7052218923542,
              48.860142271734
            ],
            [
              1.7018533752573,
              48.865673293225
            ],
            [
              1.7198777076843,
              48.872271383422
            ],
            [
              1.7292022608762,
              48.871219483604
            ],
            [
              1.7314395279166,
              48.873968471423
            ],
            [
              1.7399133540032,
              48.871449653856
            ],
            [
              1.7412768098614,
              48.874270196957
            ],
            [
              1.7500295563815,
              48.875450216663
            ],
            [
              1.7522176666426,
              48.87802738985
            ],
            [
              1.7483369243043,
              48.879497893862
            ],
            [
              1.7704322974105,
              48.896069058229
            ],
            [
              1.7831043145867,
              48.891413707227
            ],
            [
              1.8056581682382,
              48.898808951748
            ],
            [
              1.8355241961203,
              48.88517153445
            ],
            [
              1.8585137392849,
              48.890942160516
            ],
            [
              1.8687589726649,
              48.885193372296
            ],
            [
              1.874663272221,
              48.877028568925
            ],
            [
              1.8831026195664,
              48.874535338148
            ],
            [
              1.9127169447188,
              48.860849357594
            ],
            [
              1.9217113433858,
              48.85832247492
            ],
            [
              1.9613817024309,
              48.851891899558
            ],
            [
              1.970646933861,
              48.840972240396
            ],
            [
              1.9687926794162,
              48.834831269347
            ],
            [
              1.9700860589995,
              48.83487839014
            ],
            [
              1.9668984852354,
              48.821791311587
            ],
            [
              1.9864791162903,
              48.799688951127
            ],
            [
              1.9859353011511,
              48.799648360798
            ],
            [
              1.9700422200803,
              48.799863243499
            ],
            [
              1.9568703127355,
              48.789270428369
            ],
            [
              1.9412379043212,
              48.791543482649
            ],
            [
              1.9149109434793,
              48.802631449948
            ],
            [
              1.898492103809,
              48.809622894015
            ],
            [
              1.8936915762635,
              48.808670122548
            ],
            [
              1.8940011070565,
              48.805632849681
            ],
            [
              1.8850727051194,
              48.805432976807
            ],
            [
              1.8858999508989,
              48.804316374995
            ],
            [
              1.8758215111851,
              48.805049510395
            ],
            [
              1.8726237069958,
              48.798651240921
            ],
            [
              1.8711691241023,
              48.799177186792
            ],
            [
              1.8417552547252,
              48.800622726785
            ],
            [
              1.8479013041869,
              48.812707864194
            ],
            [
              1.8290034942099,
              48.811265015475
            ],
            [
              1.8111878056542,
              48.814965840962
            ],
            [
              1.8138162274863,
              48.821557956532
            ],
            [
              1.8061163949282,
              48.830053068487
            ],
            [
              1.8260692281346,
              48.8296929387
            ],
            [
              1.8327204785815,
              48.833814514469
            ],
            [
              1.8339180317868,
              48.843621026126
            ],
            [
              1.8248465610939,
              48.850691703059
            ],
            [
              1.8126901224641,
              48.853063092402
            ],
            [
              1.8059996841005,
              48.860128943481
            ],
            [
              1.7916969548512,
              48.854399942691
            ],
            [
              1.7780400297013,
              48.832305931728
            ]
          ]
        ]
      }
    }
  ]
}
আমাদের সাইট ব্যবহার করে, আপনি স্বীকার করেছেন যে আপনি আমাদের কুকি নীতি এবং গোপনীয়তা নীতিটি পড়েছেন এবং বুঝতে পেরেছেন ।
Licensed under cc by-sa 3.0 with attribution required.