0

I'm joining several together several geographic areas from a geojson file and am being left with unexpected internal edges.

import geopandas as gpd
from shapely.ops import unary_union

utlas = gpd.read_file('Counties_and_Unitary_Authorities_(December_2021)_UK_BUC.geojson')

utlas_extract = utlas.loc[
    utlas['CTYUA21NM'].isin(['Nottingham', 'Nottinghamshire', 'Derby', 'Derbyshire'])
]

comb_auth = unary_union(
    utlas_extract['geometry'].to_list()
)

gpd.GeoSeries(comb_auth).plot(edgecolor='black')

Output map

The original file is published by the UK's Office for National Statistics and is available from here. Or the contents of utlas_extract are as follows:

{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "OBJECTID": 15, "CTYUA21CD": "E06000015", "CTYUA21NM": "Derby", "CTYUA21NMW": " ", "BNG_E": 435609, "BNG_N": 335375, "LONG": -1.47189, "LAT": 52.9146, "GlobalID": "{1EE723F8-3573-4015-94E5-309FF5470969}", "SHAPE_Length": 0.48686017434828832, "SHAPE_Area": 0.010462188225935753 }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -1.388263158999962, 52.901468313000066 ], [ -1.383074406999924, 52.925931570000046 ], [ -1.423964123999951, 52.935651069000073 ], [ -1.409280628999966, 52.950322644000039 ], [ -1.468552191999947, 52.950662306000027 ], [ -1.474630539999964, 52.965928030000043 ], [ -1.495405481999967, 52.965879363000056 ], [ -1.508028820999925, 52.937451810000027 ], [ -1.544068498999934, 52.924207739000053 ], [ -1.556852229999947, 52.914678774000038 ], [ -1.541691004999961, 52.889539927000044 ], [ -1.503112225999928, 52.884845448000078 ], [ -1.494512787999952, 52.870078996000075 ], [ -1.464086400999975, 52.872559915000068 ], [ -1.446226830999933, 52.861309424000069 ], [ -1.42356744999995, 52.865078049000033 ], [ -1.418912588999945, 52.884546472000068 ], [ -1.402772273999972, 52.900462453000046 ], [ -1.388263158999962, 52.901468313000066 ] ] ] ] } },
{ "type": "Feature", "properties": { "OBJECTID": 18, "CTYUA21CD": "E06000018", "CTYUA21NM": "Nottingham", "CTYUA21NMW": " ", "BNG_E": 456082, "BNG_N": 339969, "LONG": -1.16667, "LAT": 52.954201, "GlobalID": "{66440BED-A509-4AA3-9EB6-F0114AFEE7C4}", "SHAPE_Length": 0.60735878205826554, "SHAPE_Area": 0.010152799062572791 }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -1.086115071999927, 52.948569884000051 ], [ -1.120106853999971, 52.967825394000045 ], [ -1.122786273999964, 52.983466949000046 ], [ -1.14248865999997, 52.986288405000039 ], [ -1.138254715999949, 52.994843579000076 ], [ -1.153655973999946, 52.997185218000027 ], [ -1.143512679999958, 53.006501144000026 ], [ -1.182746182999949, 53.018569146000061 ], [ -1.209882677999929, 53.018142664000038 ], [ -1.225147767999943, 53.008095802000071 ], [ -1.219107276999978, 52.991499258000033 ], [ -1.203352222999968, 52.987529486000028 ], [ -1.226178377999929, 52.981142183000031 ], [ -1.246838642999933, 52.984543195000072 ], [ -1.231978848999972, 52.967642707000039 ], [ -1.246890742999938, 52.953195703000063 ], [ -1.182301250999956, 52.917336271000067 ], [ -1.19900920799995, 52.909478868000065 ], [ -1.210899445999928, 52.912152759000037 ], [ -1.213919851999947, 52.904414788000054 ], [ -1.176425632999951, 52.88906770400007 ], [ -1.158603617999972, 52.900062114000036 ], [ -1.152288780999925, 52.937026452000055 ], [ -1.141883383999925, 52.931989531000056 ], [ -1.13176001599993, 52.942815926000037 ], [ -1.099676697999939, 52.941975135000064 ], [ -1.086115071999927, 52.948569884000051 ] ] ] ] } },
{ "type": "Feature", "properties": { "OBJECTID": 131, "CTYUA21CD": "E10000007", "CTYUA21NM": "Derbyshire", "CTYUA21NMW": " ", "BNG_E": 426752, "BNG_N": 353556, "LONG": -1.6021, "LAT": 53.078602, "GlobalID": "{50013D4D-5E3F-41A5-AA1A-9E510EC6F4DE}", "SHAPE_Length": 4.4373405951410634, "SHAPE_Area": 0.34262300924593908 }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -1.873492625999972, 53.540429652000057 ], [ -1.894109491999927, 53.533611779000069 ], [ -1.909620831999973, 53.538390987000071 ], [ -1.926780655999949, 53.520948751000049 ], [ -1.92197284599996, 53.509954685000082 ], [ -1.951332674999946, 53.504198840000072 ], [ -1.96338598899996, 53.509827262000044 ], [ -1.987819574999946, 53.481110400000034 ], [ -1.985792377999928, 53.455226773000049 ], [ -2.008234852999976, 53.441549300000077 ], [ -2.004216051999947, 53.435921786000051 ], [ -2.014227504999951, 53.439762755000061 ], [ -2.026255417999948, 53.429865162000056 ], [ -2.01369718199993, 53.415890111000067 ], [ -1.992329470999948, 53.415193133000059 ], [ -2.004642866999973, 53.386327278000067 ], [ -2.03377543299996, 53.375541570000053 ], [ -2.031058462999965, 53.370262387000082 ], [ -2.006785051999941, 53.354572113000074 ], [ -2.009481850999975, 53.260652456000059 ], [ -1.974858753999968, 53.231061053000076 ], [ -1.990264535999927, 53.22299890000005 ], [ -1.98740775899995, 53.213585849000026 ], [ -1.962364609999952, 53.226241737000066 ], [ -1.95670722999995, 53.213747610000041 ], [ -1.898632930999952, 53.199956980000081 ], [ -1.860731528999963, 53.188425566000035 ], [ -1.81254008999997, 53.154343116000064 ], [ -1.821876370999973, 53.136704070000064 ], [ -1.783725895999964, 53.102827982000065 ], [ -1.794239019999964, 53.088394058000063 ], [ -1.77565273099998, 53.059354643000063 ], [ -1.778981296999973, 53.044844375000082 ], [ -1.758931441999948, 53.037315774000035 ], [ -1.762404687999947, 52.999857683000073 ], [ -1.826780964999955, 52.97708576000008 ], [ -1.829799316999924, 52.945705986000064 ], [ -1.856575599999928, 52.923390961000052 ], [ -1.828209594999976, 52.884427756000036 ], [ -1.777220650999936, 52.883814741000037 ], [ -1.746003281999947, 52.868693160000078 ], [ -1.725322054999936, 52.859663185000045 ], [ -1.704345049999972, 52.866680593000069 ], [ -1.700608765999959, 52.860583525000038 ], [ -1.690271819999964, 52.864469378000081 ], [ -1.626754563999953, 52.854437175000044 ], [ -1.585352039999975, 52.83171462100006 ], [ -1.610494536999965, 52.816404310000053 ], [ -1.591826859999969, 52.809490592000031 ], [ -1.588870365999981, 52.799865986000043 ], [ -1.614345378999928, 52.788274048000062 ], [ -1.611129501999926, 52.781403561000047 ], [ -1.666536746999952, 52.784723033000034 ], [ -1.704158000999939, 52.732078778000073 ], [ -1.656607726999937, 52.721748474000037 ], [ -1.655041567999945, 52.698798581000062 ], [ -1.597541044999957, 52.70042176700008 ], [ -1.550041252999961, 52.720317020000039 ], [ -1.544640246999961, 52.731694499000071 ], [ -1.562492621999979, 52.750586837000071 ], [ -1.552787043999956, 52.763332953000031 ], [ -1.504980452999973, 52.767608663000033 ], [ -1.493983722999928, 52.759047373000044 ], [ -1.468445303999943, 52.766877352000051 ], [ -1.455882042999974, 52.777094663000071 ], [ -1.462778635999939, 52.786863461000053 ], [ -1.442391054999973, 52.792983277000076 ], [ -1.443561551999949, 52.80274417000004 ], [ -1.417704458999935, 52.801615501000072 ], [ -1.387936183999955, 52.833097656000064 ], [ -1.394322841999951, 52.836772874000076 ], [ -1.361210666999966, 52.855185672000061 ], [ -1.351172739999924, 52.853289454000048 ], [ -1.34486272099997, 52.867532886000049 ], [ -1.325332493999952, 52.865981743000077 ], [ -1.319306874999938, 52.872869429000048 ], [ -1.267889078999929, 52.873368652000067 ], [ -1.240055489999975, 52.880108857000039 ], [ -1.239705992999973, 52.892289237000057 ], [ -1.246215039999925, 52.90298591800007 ], [ -1.281801032999965, 52.910293268000032 ], [ -1.281031119999966, 52.949158338000075 ], [ -1.292501164999976, 52.955573678000064 ], [ -1.287749331999976, 52.969662454000058 ], [ -1.307443724999928, 53.003654790000041 ], [ -1.331986478999966, 53.031145030000062 ], [ -1.33586846299994, 53.052965847000053 ], [ -1.344427658999962, 53.065542545000028 ], [ -1.331635476999963, 53.080987888000038 ], [ -1.302882937999925, 53.088202197000044 ], [ -1.309251408999955, 53.096770175000074 ], [ -1.300618904999965, 53.102049375000036 ], [ -1.321780227999966, 53.130650307000053 ], [ -1.323446840999964, 53.162342453000065 ], [ -1.300711788999934, 53.164214540000046 ], [ -1.295961787999943, 53.171224863000077 ], [ -1.259925338999949, 53.164479444000051 ], [ -1.240445849999958, 53.178650614000048 ], [ -1.196936161999929, 53.184817905000045 ], [ -1.209424481999974, 53.217696765000028 ], [ -1.201996816999952, 53.23555532000006 ], [ -1.21302650299998, 53.247672497000053 ], [ -1.20245028599993, 53.261219543000038 ], [ -1.174689788999956, 53.265164710000079 ], [ -1.181541501999959, 53.270032064000077 ], [ -1.166487540999981, 53.277655368000069 ], [ -1.180117019999955, 53.287134747000039 ], [ -1.17662736699998, 53.305131654000036 ], [ -1.199742828999945, 53.311440185000038 ], [ -1.203239046999954, 53.304223241000045 ], [ -1.230687933999945, 53.308559736000063 ], [ -1.243868382999949, 53.301569792000066 ], [ -1.282011412999964, 53.309462591000056 ], [ -1.29567816399998, 53.31503697200003 ], [ -1.288589026999944, 53.326228056000048 ], [ -1.299023009999928, 53.332511637000039 ], [ -1.32466917499994, 53.328810014000055 ], [ -1.33775105199993, 53.315848052000035 ], [ -1.386738712999943, 53.317632135000053 ], [ -1.386571545999971, 53.334902507000038 ], [ -1.411033906999933, 53.341992493000078 ], [ -1.420866495999974, 53.334567952000043 ], [ -1.441972114999942, 53.337492490000045 ], [ -1.459880278999947, 53.330689369000027 ], [ -1.455223581999974, 53.321869142000082 ], [ -1.467912832999957, 53.317120057000068 ], [ -1.50213193999997, 53.317582077000054 ], [ -1.536768861999974, 53.304748674000052 ], [ -1.561729893999939, 53.306411318000073 ], [ -1.561731044999931, 53.315970893000042 ], [ -1.580533895999963, 53.311738090000063 ], [ -1.584902009999951, 53.321587952000073 ], [ -1.599093278999931, 53.311318200000073 ], [ -1.609201583999948, 53.322663962000036 ], [ -1.625493744999972, 53.316423979000035 ], [ -1.632726986999955, 53.320839214000046 ], [ -1.612303061999967, 53.343218670000056 ], [ -1.590547953999931, 53.345920985000078 ], [ -1.663548539999965, 53.366595166000081 ], [ -1.653817821999951, 53.391910827000061 ], [ -1.704965320999975, 53.405055975000039 ], [ -1.708532232999971, 53.417339474000073 ], [ -1.739761961999932, 53.420987916000058 ], [ -1.745322966999936, 53.462175396000077 ], [ -1.768437340999981, 53.464766933000078 ], [ -1.801470631999962, 53.480991762000031 ], [ -1.796288218999962, 53.503152991000036 ], [ -1.822228780999978, 53.521090923000031 ], [ -1.841820827999925, 53.519908780000037 ], [ -1.873492625999972, 53.540429652000057 ] ], [ [ -1.503112225999928, 52.884845449000068 ], [ -1.541691003999972, 52.889539928000033 ], [ -1.556852229999947, 52.914678774000038 ], [ -1.544068498999934, 52.924207739000053 ], [ -1.508028820999925, 52.937451810000027 ], [ -1.495405481999967, 52.965879364000045 ], [ -1.474630539999964, 52.965928030000043 ], [ -1.468552191999947, 52.950662307000073 ], [ -1.409280628999966, 52.950322644000039 ], [ -1.423964123999951, 52.935651069000073 ], [ -1.383074406999924, 52.925931570000046 ], [ -1.388263158999962, 52.901468313000066 ], [ -1.402772273999972, 52.900462453000046 ], [ -1.418912588999945, 52.884546473000057 ], [ -1.42356744999995, 52.865078050000079 ], [ -1.446226830999933, 52.861309425000059 ], [ -1.464086400999975, 52.872559915000068 ], [ -1.494512787999952, 52.870078997000064 ], [ -1.503112225999928, 52.884845449000068 ] ] ] ] } },
{ "type": "Feature", "properties": { "OBJECTID": 144, "CTYUA21CD": "E10000024", "CTYUA21NM": "Nottinghamshire", "CTYUA21NMW": " ", "BNG_E": 466570, "BNG_N": 359496, "LONG": -1.00656, "LAT": 53.128502, "GlobalID": "{362B7DD8-541F-4E6E-BAA2-BAEE8848FC0A}", "SHAPE_Length": 3.6456810850755459, "SHAPE_Area": 0.28043046112485426 }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -0.920246793999979, 53.465507651000053 ], [ -0.900470626999947, 53.475155868000058 ], [ -0.935564624999927, 53.502516530000037 ], [ -0.953259205999927, 53.484423530000072 ], [ -0.985978084999942, 53.471673372000055 ], [ -0.995669798999927, 53.436926684000071 ], [ -1.014346739999951, 53.426295497000069 ], [ -1.03051529499993, 53.425195311000039 ], [ -1.030949818999943, 53.430979526000044 ], [ -1.080439432999924, 53.426867860000073 ], [ -1.116041005999932, 53.407349355000065 ], [ -1.115579379999929, 53.397185751000052 ], [ -1.134607688999949, 53.390031565000072 ], [ -1.130537089999962, 53.37557122000004 ], [ -1.146032913999932, 53.369041146000029 ], [ -1.13853968199993, 53.355907515000069 ], [ -1.162613287999932, 53.356843862000062 ], [ -1.156843391999928, 53.344969500000047 ], [ -1.141007460999958, 53.346747679000032 ], [ -1.138718101999928, 53.341382812000063 ], [ -1.199742828999945, 53.311440185000038 ], [ -1.17662736699998, 53.305131654000036 ], [ -1.180117019999955, 53.287134747000039 ], [ -1.166487540999981, 53.277655368000069 ], [ -1.181541501999959, 53.270032064000077 ], [ -1.174689788999956, 53.265164710000079 ], [ -1.20245028599993, 53.261219543000038 ], [ -1.21302650299998, 53.247672497000053 ], [ -1.201996816999952, 53.23555532000006 ], [ -1.209424481999974, 53.217696765000028 ], [ -1.196936161999929, 53.184817905000045 ], [ -1.240445849999958, 53.178650614000048 ], [ -1.259925338999949, 53.164479444000051 ], [ -1.295961787999943, 53.171224863000077 ], [ -1.300711788999934, 53.164214540000046 ], [ -1.323446840999964, 53.162342453000065 ], [ -1.321780227999966, 53.130650307000053 ], [ -1.300618904999965, 53.102049375000036 ], [ -1.309251408999955, 53.096770175000074 ], [ -1.302882937999925, 53.088202197000044 ], [ -1.331635476999963, 53.080987888000038 ], [ -1.344427658999962, 53.065542545000028 ], [ -1.33586846299994, 53.052965847000053 ], [ -1.331986478999966, 53.031145030000062 ], [ -1.307443724999928, 53.003654790000041 ], [ -1.287749331999976, 52.969662454000058 ], [ -1.292501164999976, 52.955573678000064 ], [ -1.281031119999966, 52.949158338000075 ], [ -1.281801032999965, 52.910293268000032 ], [ -1.246215039999925, 52.90298591800007 ], [ -1.239705992999973, 52.892289237000057 ], [ -1.240055489999975, 52.880108857000039 ], [ -1.267889078999929, 52.873368652000067 ], [ -1.274363474999973, 52.836129518000064 ], [ -1.261926757999959, 52.81045333000003 ], [ -1.225886048999939, 52.791677565000043 ], [ -1.197729361999961, 52.789411548000032 ], [ -1.163275769999927, 52.806522229000052 ], [ -1.130893072999925, 52.805826913000033 ], [ -1.116941907999944, 52.819577208000055 ], [ -1.074435300999937, 52.824726634000058 ], [ -1.071738212999946, 52.814011213000072 ], [ -1.036289291999935, 52.815877284000067 ], [ -1.021933156999978, 52.822051888000033 ], [ -0.982709018999969, 52.820674866000047 ], [ -0.977074581999943, 52.840737663000027 ], [ -0.959503896999934, 52.843781732000082 ], [ -0.928121481999938, 52.866083310000079 ], [ -0.940573916999938, 52.876856132000057 ], [ -0.916924921999964, 52.878931583000053 ], [ -0.857633573999976, 52.905642320000027 ], [ -0.862893424999925, 52.913113845000055 ], [ -0.824360730999956, 52.941789611000047 ], [ -0.833908629999939, 52.945880504000058 ], [ -0.82002188499996, 52.960464430000059 ], [ -0.81285093799994, 52.957464213000037 ], [ -0.796150033999936, 52.976731504000043 ], [ -0.778278646999979, 52.976923380000073 ], [ -0.804086125999959, 53.01250540500007 ], [ -0.795824908999975, 53.010598078000044 ], [ -0.788413808999962, 53.025853357000074 ], [ -0.760826456999951, 53.029410339000037 ], [ -0.749551779999933, 53.055115654000076 ], [ -0.716203840999924, 53.059058703000062 ], [ -0.713466499999925, 53.066046555000071 ], [ -0.695132072999968, 53.066290225000046 ], [ -0.729617825999981, 53.097902021000039 ], [ -0.716755387999967, 53.116184798000063 ], [ -0.732407362999936, 53.127801589000057 ], [ -0.715375394999967, 53.136882864000029 ], [ -0.718160266999973, 53.177287791000026 ], [ -0.764018606999969, 53.182575434000057 ], [ -0.730569015999947, 53.210756450000076 ], [ -0.71475292699995, 53.207607771000028 ], [ -0.697616435999976, 53.220237292000036 ], [ -0.675872140999957, 53.217644356000051 ], [ -0.666577004999965, 53.239702497000053 ], [ -0.688027279999972, 53.258391241000027 ], [ -0.734150802999977, 53.254004046000034 ], [ -0.735083338999971, 53.243873984000061 ], [ -0.777074452999955, 53.24690817000004 ], [ -0.764279778999935, 53.272739239000032 ], [ -0.778125133999936, 53.283854298000051 ], [ -0.763502148999976, 53.299437588000046 ], [ -0.75096728099993, 53.293602370000031 ], [ -0.747138181999958, 53.304333197000062 ], [ -0.749955286999977, 53.324218319000067 ], [ -0.766473605999977, 53.330107498000075 ], [ -0.758616358999973, 53.353837588000033 ], [ -0.774459228999945, 53.364432470000054 ], [ -0.791132345999927, 53.363551541000049 ], [ -0.775235920999933, 53.377758776000064 ], [ -0.790442565999967, 53.385853849000057 ], [ -0.777139678999959, 53.396914390000063 ], [ -0.788624379999931, 53.41526127800006 ], [ -0.818092246999925, 53.426978800000029 ], [ -0.820515391999947, 53.44074788000006 ], [ -0.797483349999936, 53.45506444800003 ], [ -0.871919280999975, 53.466310804000045 ], [ -0.916249020999942, 53.460295691000056 ], [ -0.920246793999979, 53.465507651000053 ] ], [ [ -1.203352222999968, 52.987529486000028 ], [ -1.219107276999978, 52.991499259000079 ], [ -1.225147767999943, 53.00809580300006 ], [ -1.209882677999929, 53.018142665000028 ], [ -1.182746182999949, 53.018569147000051 ], [ -1.143512679999958, 53.006501144000026 ], [ -1.153655973999946, 52.997185218000027 ], [ -1.138254715999949, 52.994843580000065 ], [ -1.14248865999997, 52.986288406000028 ], [ -1.122786273999964, 52.983466950000036 ], [ -1.120106853999971, 52.967825395000034 ], [ -1.086115071999927, 52.948569884000051 ], [ -1.099676697999939, 52.941975136000053 ], [ -1.13176001599993, 52.942815927000026 ], [ -1.141883383999925, 52.931989531000056 ], [ -1.152288780999925, 52.937026453000044 ], [ -1.158603617999972, 52.900062115000026 ], [ -1.176425632999951, 52.889067705000059 ], [ -1.213919851999947, 52.904414788000054 ], [ -1.210899445999928, 52.912152760000026 ], [ -1.19900920799995, 52.909478868000065 ], [ -1.182301250999956, 52.917336271000067 ], [ -1.246890742999938, 52.953195704000052 ], [ -1.231978848999972, 52.967642707000039 ], [ -1.246838642999933, 52.984543195000072 ], [ -1.226178377999929, 52.981142183000031 ], [ -1.203352222999968, 52.987529486000028 ] ] ] ] } }
]
}

Is there something about the geojson that is leading to the internal edges?

I'm quite new to mapping, but the file's publisher say they've carried out a geometry and topology check on the file that hasn't picked up gaps/overlaps between geometries.

Running the geojson file through https://geojsonlint.com/, two types of issue are flagged: old-style CRS definition, and the fact that the right-hand rule isn't followed. But I still get the issue after running the geojson file through https://mapstertech.github.io/mapster-right-hand-rule-fixer/.

1
  • GeoJSON does not care about topology. All the polygons are independent objects and they do not necessarily share the same vertices. Topology checks usually test just the polygons, not the topology of the whole polygon layer.
    – user30184
    Commented Dec 5, 2023 at 18:02

1 Answer 1

2

I had a look and as expected there are indeed points in the different polygons that are close to each other, but not exactly the same. If you zoom in far enough on one of the "lines" of the result of the unary_union you'll see that it has a width. For the example I looked at the points were 0.0001 m apart. The Topology checker QGIS plugin finds them as well.

I typically apply a grid_size/tolerance to deal with this. It will round all coordinates to the precision specified and polygons narrower than the grid_size will be removed.

import geopandas as gpd
from matplotlib import pyplot as plt
import shapely

uk = """{
    "type": "FeatureCollection",
    "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
    "features": [
        { "type": "Feature", "properties": { "OBJECTID": 15, "CTYUA21CD": "E06000015", "CTYUA21NM": "Derby", "CTYUA21NMW": " ", "BNG_E": 435609, "BNG_N": 335375, "LONG": -1.47189, "LAT": 52.9146, "GlobalID": "{1EE723F8-3573-4015-94E5-309FF5470969}", "SHAPE_Length": 0.48686017434828832, "SHAPE_Area": 0.010462188225935753 }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -1.388263158999962, 52.901468313000066 ], [ -1.383074406999924, 52.925931570000046 ], [ -1.423964123999951, 52.935651069000073 ], [ -1.409280628999966, 52.950322644000039 ], [ -1.468552191999947, 52.950662306000027 ], [ -1.474630539999964, 52.965928030000043 ], [ -1.495405481999967, 52.965879363000056 ], [ -1.508028820999925, 52.937451810000027 ], [ -1.544068498999934, 52.924207739000053 ], [ -1.556852229999947, 52.914678774000038 ], [ -1.541691004999961, 52.889539927000044 ], [ -1.503112225999928, 52.884845448000078 ], [ -1.494512787999952, 52.870078996000075 ], [ -1.464086400999975, 52.872559915000068 ], [ -1.446226830999933, 52.861309424000069 ], [ -1.42356744999995, 52.865078049000033 ], [ -1.418912588999945, 52.884546472000068 ], [ -1.402772273999972, 52.900462453000046 ], [ -1.388263158999962, 52.901468313000066 ] ] ] ] } },
        { "type": "Feature", "properties": { "OBJECTID": 18, "CTYUA21CD": "E06000018", "CTYUA21NM": "Nottingham", "CTYUA21NMW": " ", "BNG_E": 456082, "BNG_N": 339969, "LONG": -1.16667, "LAT": 52.954201, "GlobalID": "{66440BED-A509-4AA3-9EB6-F0114AFEE7C4}", "SHAPE_Length": 0.60735878205826554, "SHAPE_Area": 0.010152799062572791 }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -1.086115071999927, 52.948569884000051 ], [ -1.120106853999971, 52.967825394000045 ], [ -1.122786273999964, 52.983466949000046 ], [ -1.14248865999997, 52.986288405000039 ], [ -1.138254715999949, 52.994843579000076 ], [ -1.153655973999946, 52.997185218000027 ], [ -1.143512679999958, 53.006501144000026 ], [ -1.182746182999949, 53.018569146000061 ], [ -1.209882677999929, 53.018142664000038 ], [ -1.225147767999943, 53.008095802000071 ], [ -1.219107276999978, 52.991499258000033 ], [ -1.203352222999968, 52.987529486000028 ], [ -1.226178377999929, 52.981142183000031 ], [ -1.246838642999933, 52.984543195000072 ], [ -1.231978848999972, 52.967642707000039 ], [ -1.246890742999938, 52.953195703000063 ], [ -1.182301250999956, 52.917336271000067 ], [ -1.19900920799995, 52.909478868000065 ], [ -1.210899445999928, 52.912152759000037 ], [ -1.213919851999947, 52.904414788000054 ], [ -1.176425632999951, 52.88906770400007 ], [ -1.158603617999972, 52.900062114000036 ], [ -1.152288780999925, 52.937026452000055 ], [ -1.141883383999925, 52.931989531000056 ], [ -1.13176001599993, 52.942815926000037 ], [ -1.099676697999939, 52.941975135000064 ], [ -1.086115071999927, 52.948569884000051 ] ] ] ] } },
        { "type": "Feature", "properties": { "OBJECTID": 131, "CTYUA21CD": "E10000007", "CTYUA21NM": "Derbyshire", "CTYUA21NMW": " ", "BNG_E": 426752, "BNG_N": 353556, "LONG": -1.6021, "LAT": 53.078602, "GlobalID": "{50013D4D-5E3F-41A5-AA1A-9E510EC6F4DE}", "SHAPE_Length": 4.4373405951410634, "SHAPE_Area": 0.34262300924593908 }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -1.873492625999972, 53.540429652000057 ], [ -1.894109491999927, 53.533611779000069 ], [ -1.909620831999973, 53.538390987000071 ], [ -1.926780655999949, 53.520948751000049 ], [ -1.92197284599996, 53.509954685000082 ], [ -1.951332674999946, 53.504198840000072 ], [ -1.96338598899996, 53.509827262000044 ], [ -1.987819574999946, 53.481110400000034 ], [ -1.985792377999928, 53.455226773000049 ], [ -2.008234852999976, 53.441549300000077 ], [ -2.004216051999947, 53.435921786000051 ], [ -2.014227504999951, 53.439762755000061 ], [ -2.026255417999948, 53.429865162000056 ], [ -2.01369718199993, 53.415890111000067 ], [ -1.992329470999948, 53.415193133000059 ], [ -2.004642866999973, 53.386327278000067 ], [ -2.03377543299996, 53.375541570000053 ], [ -2.031058462999965, 53.370262387000082 ], [ -2.006785051999941, 53.354572113000074 ], [ -2.009481850999975, 53.260652456000059 ], [ -1.974858753999968, 53.231061053000076 ], [ -1.990264535999927, 53.22299890000005 ], [ -1.98740775899995, 53.213585849000026 ], [ -1.962364609999952, 53.226241737000066 ], [ -1.95670722999995, 53.213747610000041 ], [ -1.898632930999952, 53.199956980000081 ], [ -1.860731528999963, 53.188425566000035 ], [ -1.81254008999997, 53.154343116000064 ], [ -1.821876370999973, 53.136704070000064 ], [ -1.783725895999964, 53.102827982000065 ], [ -1.794239019999964, 53.088394058000063 ], [ -1.77565273099998, 53.059354643000063 ], [ -1.778981296999973, 53.044844375000082 ], [ -1.758931441999948, 53.037315774000035 ], [ -1.762404687999947, 52.999857683000073 ], [ -1.826780964999955, 52.97708576000008 ], [ -1.829799316999924, 52.945705986000064 ], [ -1.856575599999928, 52.923390961000052 ], [ -1.828209594999976, 52.884427756000036 ], [ -1.777220650999936, 52.883814741000037 ], [ -1.746003281999947, 52.868693160000078 ], [ -1.725322054999936, 52.859663185000045 ], [ -1.704345049999972, 52.866680593000069 ], [ -1.700608765999959, 52.860583525000038 ], [ -1.690271819999964, 52.864469378000081 ], [ -1.626754563999953, 52.854437175000044 ], [ -1.585352039999975, 52.83171462100006 ], [ -1.610494536999965, 52.816404310000053 ], [ -1.591826859999969, 52.809490592000031 ], [ -1.588870365999981, 52.799865986000043 ], [ -1.614345378999928, 52.788274048000062 ], [ -1.611129501999926, 52.781403561000047 ], [ -1.666536746999952, 52.784723033000034 ], [ -1.704158000999939, 52.732078778000073 ], [ -1.656607726999937, 52.721748474000037 ], [ -1.655041567999945, 52.698798581000062 ], [ -1.597541044999957, 52.70042176700008 ], [ -1.550041252999961, 52.720317020000039 ], [ -1.544640246999961, 52.731694499000071 ], [ -1.562492621999979, 52.750586837000071 ], [ -1.552787043999956, 52.763332953000031 ], [ -1.504980452999973, 52.767608663000033 ], [ -1.493983722999928, 52.759047373000044 ], [ -1.468445303999943, 52.766877352000051 ], [ -1.455882042999974, 52.777094663000071 ], [ -1.462778635999939, 52.786863461000053 ], [ -1.442391054999973, 52.792983277000076 ], [ -1.443561551999949, 52.80274417000004 ], [ -1.417704458999935, 52.801615501000072 ], [ -1.387936183999955, 52.833097656000064 ], [ -1.394322841999951, 52.836772874000076 ], [ -1.361210666999966, 52.855185672000061 ], [ -1.351172739999924, 52.853289454000048 ], [ -1.34486272099997, 52.867532886000049 ], [ -1.325332493999952, 52.865981743000077 ], [ -1.319306874999938, 52.872869429000048 ], [ -1.267889078999929, 52.873368652000067 ], [ -1.240055489999975, 52.880108857000039 ], [ -1.239705992999973, 52.892289237000057 ], [ -1.246215039999925, 52.90298591800007 ], [ -1.281801032999965, 52.910293268000032 ], [ -1.281031119999966, 52.949158338000075 ], [ -1.292501164999976, 52.955573678000064 ], [ -1.287749331999976, 52.969662454000058 ], [ -1.307443724999928, 53.003654790000041 ], [ -1.331986478999966, 53.031145030000062 ], [ -1.33586846299994, 53.052965847000053 ], [ -1.344427658999962, 53.065542545000028 ], [ -1.331635476999963, 53.080987888000038 ], [ -1.302882937999925, 53.088202197000044 ], [ -1.309251408999955, 53.096770175000074 ], [ -1.300618904999965, 53.102049375000036 ], [ -1.321780227999966, 53.130650307000053 ], [ -1.323446840999964, 53.162342453000065 ], [ -1.300711788999934, 53.164214540000046 ], [ -1.295961787999943, 53.171224863000077 ], [ -1.259925338999949, 53.164479444000051 ], [ -1.240445849999958, 53.178650614000048 ], [ -1.196936161999929, 53.184817905000045 ], [ -1.209424481999974, 53.217696765000028 ], [ -1.201996816999952, 53.23555532000006 ], [ -1.21302650299998, 53.247672497000053 ], [ -1.20245028599993, 53.261219543000038 ], [ -1.174689788999956, 53.265164710000079 ], [ -1.181541501999959, 53.270032064000077 ], [ -1.166487540999981, 53.277655368000069 ], [ -1.180117019999955, 53.287134747000039 ], [ -1.17662736699998, 53.305131654000036 ], [ -1.199742828999945, 53.311440185000038 ], [ -1.203239046999954, 53.304223241000045 ], [ -1.230687933999945, 53.308559736000063 ], [ -1.243868382999949, 53.301569792000066 ], [ -1.282011412999964, 53.309462591000056 ], [ -1.29567816399998, 53.31503697200003 ], [ -1.288589026999944, 53.326228056000048 ], [ -1.299023009999928, 53.332511637000039 ], [ -1.32466917499994, 53.328810014000055 ], [ -1.33775105199993, 53.315848052000035 ], [ -1.386738712999943, 53.317632135000053 ], [ -1.386571545999971, 53.334902507000038 ], [ -1.411033906999933, 53.341992493000078 ], [ -1.420866495999974, 53.334567952000043 ], [ -1.441972114999942, 53.337492490000045 ], [ -1.459880278999947, 53.330689369000027 ], [ -1.455223581999974, 53.321869142000082 ], [ -1.467912832999957, 53.317120057000068 ], [ -1.50213193999997, 53.317582077000054 ], [ -1.536768861999974, 53.304748674000052 ], [ -1.561729893999939, 53.306411318000073 ], [ -1.561731044999931, 53.315970893000042 ], [ -1.580533895999963, 53.311738090000063 ], [ -1.584902009999951, 53.321587952000073 ], [ -1.599093278999931, 53.311318200000073 ], [ -1.609201583999948, 53.322663962000036 ], [ -1.625493744999972, 53.316423979000035 ], [ -1.632726986999955, 53.320839214000046 ], [ -1.612303061999967, 53.343218670000056 ], [ -1.590547953999931, 53.345920985000078 ], [ -1.663548539999965, 53.366595166000081 ], [ -1.653817821999951, 53.391910827000061 ], [ -1.704965320999975, 53.405055975000039 ], [ -1.708532232999971, 53.417339474000073 ], [ -1.739761961999932, 53.420987916000058 ], [ -1.745322966999936, 53.462175396000077 ], [ -1.768437340999981, 53.464766933000078 ], [ -1.801470631999962, 53.480991762000031 ], [ -1.796288218999962, 53.503152991000036 ], [ -1.822228780999978, 53.521090923000031 ], [ -1.841820827999925, 53.519908780000037 ], [ -1.873492625999972, 53.540429652000057 ] ], [ [ -1.503112225999928, 52.884845449000068 ], [ -1.541691003999972, 52.889539928000033 ], [ -1.556852229999947, 52.914678774000038 ], [ -1.544068498999934, 52.924207739000053 ], [ -1.508028820999925, 52.937451810000027 ], [ -1.495405481999967, 52.965879364000045 ], [ -1.474630539999964, 52.965928030000043 ], [ -1.468552191999947, 52.950662307000073 ], [ -1.409280628999966, 52.950322644000039 ], [ -1.423964123999951, 52.935651069000073 ], [ -1.383074406999924, 52.925931570000046 ], [ -1.388263158999962, 52.901468313000066 ], [ -1.402772273999972, 52.900462453000046 ], [ -1.418912588999945, 52.884546473000057 ], [ -1.42356744999995, 52.865078050000079 ], [ -1.446226830999933, 52.861309425000059 ], [ -1.464086400999975, 52.872559915000068 ], [ -1.494512787999952, 52.870078997000064 ], [ -1.503112225999928, 52.884845449000068 ] ] ] ] } },
        { "type": "Feature", "properties": { "OBJECTID": 144, "CTYUA21CD": "E10000024", "CTYUA21NM": "Nottinghamshire", "CTYUA21NMW": " ", "BNG_E": 466570, "BNG_N": 359496, "LONG": -1.00656, "LAT": 53.128502, "GlobalID": "{362B7DD8-541F-4E6E-BAA2-BAEE8848FC0A}", "SHAPE_Length": 3.6456810850755459, "SHAPE_Area": 0.28043046112485426 }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -0.920246793999979, 53.465507651000053 ], [ -0.900470626999947, 53.475155868000058 ], [ -0.935564624999927, 53.502516530000037 ], [ -0.953259205999927, 53.484423530000072 ], [ -0.985978084999942, 53.471673372000055 ], [ -0.995669798999927, 53.436926684000071 ], [ -1.014346739999951, 53.426295497000069 ], [ -1.03051529499993, 53.425195311000039 ], [ -1.030949818999943, 53.430979526000044 ], [ -1.080439432999924, 53.426867860000073 ], [ -1.116041005999932, 53.407349355000065 ], [ -1.115579379999929, 53.397185751000052 ], [ -1.134607688999949, 53.390031565000072 ], [ -1.130537089999962, 53.37557122000004 ], [ -1.146032913999932, 53.369041146000029 ], [ -1.13853968199993, 53.355907515000069 ], [ -1.162613287999932, 53.356843862000062 ], [ -1.156843391999928, 53.344969500000047 ], [ -1.141007460999958, 53.346747679000032 ], [ -1.138718101999928, 53.341382812000063 ], [ -1.199742828999945, 53.311440185000038 ], [ -1.17662736699998, 53.305131654000036 ], [ -1.180117019999955, 53.287134747000039 ], [ -1.166487540999981, 53.277655368000069 ], [ -1.181541501999959, 53.270032064000077 ], [ -1.174689788999956, 53.265164710000079 ], [ -1.20245028599993, 53.261219543000038 ], [ -1.21302650299998, 53.247672497000053 ], [ -1.201996816999952, 53.23555532000006 ], [ -1.209424481999974, 53.217696765000028 ], [ -1.196936161999929, 53.184817905000045 ], [ -1.240445849999958, 53.178650614000048 ], [ -1.259925338999949, 53.164479444000051 ], [ -1.295961787999943, 53.171224863000077 ], [ -1.300711788999934, 53.164214540000046 ], [ -1.323446840999964, 53.162342453000065 ], [ -1.321780227999966, 53.130650307000053 ], [ -1.300618904999965, 53.102049375000036 ], [ -1.309251408999955, 53.096770175000074 ], [ -1.302882937999925, 53.088202197000044 ], [ -1.331635476999963, 53.080987888000038 ], [ -1.344427658999962, 53.065542545000028 ], [ -1.33586846299994, 53.052965847000053 ], [ -1.331986478999966, 53.031145030000062 ], [ -1.307443724999928, 53.003654790000041 ], [ -1.287749331999976, 52.969662454000058 ], [ -1.292501164999976, 52.955573678000064 ], [ -1.281031119999966, 52.949158338000075 ], [ -1.281801032999965, 52.910293268000032 ], [ -1.246215039999925, 52.90298591800007 ], [ -1.239705992999973, 52.892289237000057 ], [ -1.240055489999975, 52.880108857000039 ], [ -1.267889078999929, 52.873368652000067 ], [ -1.274363474999973, 52.836129518000064 ], [ -1.261926757999959, 52.81045333000003 ], [ -1.225886048999939, 52.791677565000043 ], [ -1.197729361999961, 52.789411548000032 ], [ -1.163275769999927, 52.806522229000052 ], [ -1.130893072999925, 52.805826913000033 ], [ -1.116941907999944, 52.819577208000055 ], [ -1.074435300999937, 52.824726634000058 ], [ -1.071738212999946, 52.814011213000072 ], [ -1.036289291999935, 52.815877284000067 ], [ -1.021933156999978, 52.822051888000033 ], [ -0.982709018999969, 52.820674866000047 ], [ -0.977074581999943, 52.840737663000027 ], [ -0.959503896999934, 52.843781732000082 ], [ -0.928121481999938, 52.866083310000079 ], [ -0.940573916999938, 52.876856132000057 ], [ -0.916924921999964, 52.878931583000053 ], [ -0.857633573999976, 52.905642320000027 ], [ -0.862893424999925, 52.913113845000055 ], [ -0.824360730999956, 52.941789611000047 ], [ -0.833908629999939, 52.945880504000058 ], [ -0.82002188499996, 52.960464430000059 ], [ -0.81285093799994, 52.957464213000037 ], [ -0.796150033999936, 52.976731504000043 ], [ -0.778278646999979, 52.976923380000073 ], [ -0.804086125999959, 53.01250540500007 ], [ -0.795824908999975, 53.010598078000044 ], [ -0.788413808999962, 53.025853357000074 ], [ -0.760826456999951, 53.029410339000037 ], [ -0.749551779999933, 53.055115654000076 ], [ -0.716203840999924, 53.059058703000062 ], [ -0.713466499999925, 53.066046555000071 ], [ -0.695132072999968, 53.066290225000046 ], [ -0.729617825999981, 53.097902021000039 ], [ -0.716755387999967, 53.116184798000063 ], [ -0.732407362999936, 53.127801589000057 ], [ -0.715375394999967, 53.136882864000029 ], [ -0.718160266999973, 53.177287791000026 ], [ -0.764018606999969, 53.182575434000057 ], [ -0.730569015999947, 53.210756450000076 ], [ -0.71475292699995, 53.207607771000028 ], [ -0.697616435999976, 53.220237292000036 ], [ -0.675872140999957, 53.217644356000051 ], [ -0.666577004999965, 53.239702497000053 ], [ -0.688027279999972, 53.258391241000027 ], [ -0.734150802999977, 53.254004046000034 ], [ -0.735083338999971, 53.243873984000061 ], [ -0.777074452999955, 53.24690817000004 ], [ -0.764279778999935, 53.272739239000032 ], [ -0.778125133999936, 53.283854298000051 ], [ -0.763502148999976, 53.299437588000046 ], [ -0.75096728099993, 53.293602370000031 ], [ -0.747138181999958, 53.304333197000062 ], [ -0.749955286999977, 53.324218319000067 ], [ -0.766473605999977, 53.330107498000075 ], [ -0.758616358999973, 53.353837588000033 ], [ -0.774459228999945, 53.364432470000054 ], [ -0.791132345999927, 53.363551541000049 ], [ -0.775235920999933, 53.377758776000064 ], [ -0.790442565999967, 53.385853849000057 ], [ -0.777139678999959, 53.396914390000063 ], [ -0.788624379999931, 53.41526127800006 ], [ -0.818092246999925, 53.426978800000029 ], [ -0.820515391999947, 53.44074788000006 ], [ -0.797483349999936, 53.45506444800003 ], [ -0.871919280999975, 53.466310804000045 ], [ -0.916249020999942, 53.460295691000056 ], [ -0.920246793999979, 53.465507651000053 ] ], [ [ -1.203352222999968, 52.987529486000028 ], [ -1.219107276999978, 52.991499259000079 ], [ -1.225147767999943, 53.00809580300006 ], [ -1.209882677999929, 53.018142665000028 ], [ -1.182746182999949, 53.018569147000051 ], [ -1.143512679999958, 53.006501144000026 ], [ -1.153655973999946, 52.997185218000027 ], [ -1.138254715999949, 52.994843580000065 ], [ -1.14248865999997, 52.986288406000028 ], [ -1.122786273999964, 52.983466950000036 ], [ -1.120106853999971, 52.967825395000034 ], [ -1.086115071999927, 52.948569884000051 ], [ -1.099676697999939, 52.941975136000053 ], [ -1.13176001599993, 52.942815927000026 ], [ -1.141883383999925, 52.931989531000056 ], [ -1.152288780999925, 52.937026453000044 ], [ -1.158603617999972, 52.900062115000026 ], [ -1.176425632999951, 52.889067705000059 ], [ -1.213919851999947, 52.904414788000054 ], [ -1.210899445999928, 52.912152760000026 ], [ -1.19900920799995, 52.909478868000065 ], [ -1.182301250999956, 52.917336271000067 ], [ -1.246890742999938, 52.953195704000052 ], [ -1.231978848999972, 52.967642707000039 ], [ -1.246838642999933, 52.984543195000072 ], [ -1.226178377999929, 52.981142183000031 ], [ -1.203352222999968, 52.987529486000028 ] ] ] ] } }
    ]
}
"""

utlas = gpd.read_file(uk)
utlas_extract = utlas.loc[
    utlas["CTYUA21NM"].isin(["Nottingham", "Nottinghamshire", "Derby", "Derbyshire"])
]

comb_auth = shapely.unary_union(utlas_extract["geometry"].to_list(), grid_size=0.000001)

gpd.GeoSeries(comb_auth).plot(edgecolor="black")
plt.show()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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