Skip to content

Instantly share code, notes, and snippets.

@1Cr18Ni9
Last active December 9, 2018 08:01
Show Gist options
  • Save 1Cr18Ni9/e731691d1453dea9220acbf6f35f1584 to your computer and use it in GitHub Desktop.
Save 1Cr18Ni9/e731691d1453dea9220acbf6f35f1584 to your computer and use it in GitHub Desktop.
Map - I
license: mit
Display the source blob
Display the rendered blob
Raw
{"type": "FeatureCollection", "features": [{"type":"Feature","properties":{"name":"苍南县","id":"330327"},"geometry":{"type":"MultiPolygon","coordinates":[[[[120.84334109375,27.076567609375],[120.847345,27.0538430000001],[120.834346953125,27.0594045234376],[120.84334109375,27.076567609375]]],[[[120.473922148438,27.1660353828125],[120.477345,27.153843],[120.465152617188,27.1572658515625],[120.473922148438,27.1660353828125]]],[[[120.52334109375,27.176567609375],[120.527345,27.153843],[120.514346953125,27.1594045234375],[120.52334109375,27.176567609375]]],[[[120.417345,27.193843],[120.43062625,27.18712425],[120.437345,27.173843],[120.427345,27.173843],[120.417345,27.173843],[120.417345,27.183843],[120.417345,27.193843]]],[[[120.537345,27.323843],[120.537345,27.333843],[120.550152617188,27.328843],[120.537345,27.323843]]],[[[120.587345,27.343843],[120.583922148438,27.3316506171876],[120.575152617188,27.3404201484376],[120.587345,27.343843]]],[[[120.587345,27.343843],[120.590767851563,27.3560353828125],[120.599537382813,27.3472658515625],[120.587345,27.343843]]],[[[120.703922148438,27.5360353828125],[120.707345,27.523843],[120.695152617188,27.5272658515626],[120.703922148438,27.5360353828125]]],[[[120.537345,27.333843],[120.517345,27.333843],[120.513922148438,27.3460353828125],[120.505152617188,27.3372658515626],[120.517345,27.333843],[120.517345,27.323843],[120.537345,27.323843],[120.541881132813,27.3183815742187],[120.561422148438,27.3021486640625],[120.512808867188,27.2617678046875],[120.521881132813,27.2483815742188],[120.53322390625,27.2389601875],[120.511798125,27.2091896796875],[120.513170195313,27.1957692695313],[120.466964140625,27.1693044257813],[120.461812773438,27.1886354804688],[120.464815703125,27.21808128125],[120.451954375,27.2193923164063],[120.442735625,27.2082936835938],[120.430391875,27.2095510078125],[120.417345,27.193843],[120.407345,27.193843],[120.407345,27.2038430000001],[120.397345,27.2038430000001],[120.397345,27.213843],[120.397345,27.223843],[120.403526640625,27.2291677070313],[120.4019153125,27.2491896796875],[120.423116484375,27.2586501289063],[120.373663359375,27.3284011054688],[120.3566028125,27.3430983710938],[120.341300078125,27.3608571601563],[120.343629179688,27.3898146796875],[120.315865507813,27.4137331367188],[120.30271609375,27.39847190625],[120.267769804688,27.38921409375],[120.25271609375,27.43921409375],[120.247345,27.443843],[120.22326296875,27.4597585273438],[120.20142703125,27.4679274726563],[120.12326296875,27.5197585273438],[120.10142703125,27.5279274726563],[120.08326296875,27.5397585273438],[120.06076296875,27.5481764960938],[120.067345,27.563843],[120.077345,27.563843],[120.077345,27.573843],[120.09302859375,27.5693581367188],[120.091314726563,27.5555593085938],[120.189234648438,27.5275978828125],[120.252232695313,27.5394802070313],[120.295719023438,27.5340700507813],[120.321793242188,27.5493971992188],[120.352896757813,27.5582888007813],[120.37373171875,27.5705373359375],[120.397345,27.5676003242188],[120.412799101563,27.5695217109375],[120.428472929688,27.5499465156251],[120.442345,27.5482204414063],[120.462345,27.550708234375],[120.485582304688,27.547817609375],[120.480548125,27.5882888007813],[120.492896757813,27.5793971992188],[120.502515898438,27.5673854804688],[120.512345,27.590708234375],[120.532345,27.5882204414063],[120.547345,27.5900856757813],[120.577735625,27.5863063789063],[120.597345,27.593843],[120.604991484375,27.5756423164063],[120.598521757813,27.5467946601563],[120.631832304688,27.4973268867188],[120.666095,27.5117189765626],[120.679576445313,27.4515846992188],[120.662345,27.4477223945313],[120.6483996875,27.4508473945313],[120.640103789063,27.413843],[120.65142703125,27.3633205390625],[120.617965117188,27.3684596992188],[120.603013945313,27.3901149726563],[120.584459257813,27.3859548164063],[120.550714140625,27.4079274726563],[120.534361601563,27.3759328437501],[120.56142703125,27.3819997382813],[120.55326296875,27.3679274726563],[120.527135039063,27.3581520820313],[120.537345,27.333843]]]]}},{"type":"Feature","properties":{"name":"洞头县","id":"330322"},"geometry":{"type":"MultiPolygon","coordinates":[[[[121.183922148438,27.7460353828125],[121.187345,27.7338430000001],[121.175152617188,27.7372658515625],[121.183922148438,27.7460353828125]]],[[[121.141910429688,27.7665407539063],[121.147345,27.753843],[121.124346953125,27.7578957343751],[121.141910429688,27.7665407539063]]],[[[121.08334109375,27.796567609375],[121.087345,27.7738430000001],[121.074346953125,27.7794045234375],[121.08334109375,27.796567609375]]],[[[121.137345,27.803843],[121.133922148438,27.7916506171876],[121.125152617188,27.8004201484375],[121.137345,27.803843]]],[[[121.097345,27.8138430000001],[121.093922148438,27.8016506171875],[121.085152617188,27.8104201484375],[121.097345,27.8138430000001]]],[[[121.137345,27.803843],[121.140767851563,27.8160353828125],[121.149537382813,27.8072658515625],[121.137345,27.803843]]],[[[121.167345,27.823843],[121.179537382813,27.8204201484375],[121.170767851563,27.8116506171875],[121.167345,27.823843]]],[[[121.027345,27.843843],[121.023922148438,27.8316506171876],[121.015152617188,27.8404201484375],[121.027345,27.843843]]],[[[121.167345,27.823843],[121.141929960938,27.8300856757813],[121.122789335938,27.8176222968751],[121.112066679688,27.8200270820313],[121.097345,27.8138430000001],[121.090831328125,27.8293459296875],[121.121099882813,27.8502443671875],[121.153013945313,27.8430886054688],[121.167345,27.863843],[121.185494414063,27.8513112617188],[121.167345,27.823843]]],[[[121.027345,27.843843],[121.035094023438,27.8740407539063],[121.08142703125,27.8567018867188],[121.062681914063,27.8476467109375],[121.045548125,27.8514870429688],[121.027345,27.843843]]],[[[121.167345,27.863843],[121.155152617188,27.8672658515626],[121.163922148438,27.8760353828125],[121.167345,27.863843]]],[[[121.113922148438,27.8860353828125],[121.117345,27.873843],[121.105152617188,27.8772658515626],[121.113922148438,27.8860353828125]]],[[[121.14166140625,27.907309796875],[121.147345,27.873843],[121.12298953125,27.892641828125],[121.14166140625,27.907309796875]]],[[[121.121910429688,27.9265407539063],[121.127345,27.913843],[121.104346953125,27.917895734375],[121.121910429688,27.9265407539063]]],[[[121.057345,27.983843],[121.072056914063,27.9777980781251],[121.111070585938,27.9855080390626],[121.151519804688,27.9565163398438],[121.102828398438,27.945727765625],[121.040562773438,27.958208234375],[121.057345,27.983843]]],[[[121.057345,27.983843],[121.0341028125,27.988843],[121.057345,27.993843],[121.057345,27.983843]]],[[[121.191065703125,27.980122296875],[121.187345,27.9638430000001],[121.177135039063,27.9698952460938],[121.167633085938,27.9975637031251],[121.230694609375,27.9891823554688],[121.191065703125,27.980122296875]]],[[[121.057345,27.993843],[121.074073515625,28.0272023750001],[121.073985625,27.997202375],[121.057345,27.993843]]]]}},{"type":"Feature","properties":{"name":"龙湾区","id":"330303"},"geometry":{"type":"MultiPolygon","coordinates":[[[[120.912999296875,27.9623049140625],[120.8926184375,27.9461159492188],[120.86181765625,27.9616994453125],[120.857345,27.983843],[120.917345,27.983843],[120.912999296875,27.9623049140625]]],[[[120.737769804688,27.9982888007813],[120.786143828125,27.9698537421875],[120.797345,27.983843],[120.837345,27.983843],[120.8460559375,27.9525563789062],[120.87369265625,27.9312233710938],[120.86002078125,27.8507155585938],[120.842345,27.8481032539063],[120.816773710938,27.8518825507813],[120.800260039063,27.811528546875],[120.777345,27.793843],[120.769537382813,27.8060378242188],[120.739869414063,27.8250319648438],[120.751109648438,27.8650319648438],[120.737345,27.873843],[120.7446496875,27.9035720039063],[120.741221953125,27.918843],[120.744215117188,27.9321950507813],[120.719132109375,27.9495143867188],[120.725767851563,27.9791139960938],[120.707345,27.983843],[120.711793242188,27.9893971992188],[120.737769804688,27.9982888007813]]]]}},{"type":"Feature","properties":{"name":"鹿城区","id":"330302"},"geometry":{"type":"MultiPolygon","coordinates":[[[[120.427345,28.053843],[120.423922148438,28.0416506171875],[120.415152617188,28.0504201484375],[120.427345,28.053843]]],[[[120.427345,28.053843],[120.423985625,28.080483625],[120.40406375,28.0905617500001],[120.397345,28.103843],[120.40486453125,28.1189748359375],[120.393985625,28.140483625],[120.375211210938,28.1499806953125],[120.417345,28.1538430000001],[120.4324621875,28.1593947578126],[120.46306765625,28.1376955390625],[120.487345,28.1396462226563],[120.507345,28.1380397773438],[120.551651640625,28.1415993476563],[120.56197390625,28.11847190625],[120.58963015625,28.1061305976563],[120.60197390625,28.03847190625],[120.759757109375,28.0239748359376],[120.787345,28.013843],[120.790704375,27.997202375],[120.797345,27.983843],[120.786143828125,27.9698537421875],[120.737769804688,27.9982888007813],[120.711793242188,27.9893971992188],[120.707345,27.983843],[120.69255984375,27.9772194648438],[120.672345,27.9835158515625],[120.642003203125,27.9740651679688],[120.633194609375,28.0114626289063],[120.612803984375,27.99714378125],[120.582471953125,28.0065895820313],[120.550094023438,28.0328151679688],[120.532310820313,28.0272756171876],[120.490679960938,28.0409670234376],[120.462345,28.060864484375],[120.442608671875,28.0470070625001],[120.427345,28.053843]]]]}},{"type":"Feature","properties":{"name":"平阳县","id":"330326"},"geometry":{"type":"MultiPolygon","coordinates":[[[[121.013922148438,27.4260353828125],[121.017345,27.413843],[121.005152617188,27.4172658515626],[121.013922148438,27.4260353828125]]],[[[121.033922148438,27.4360353828125],[121.037345,27.423843],[121.025152617188,27.4272658515625],[121.033922148438,27.4360353828125]]],[[[121.083922148438,27.4360353828125],[121.087345,27.423843],[121.075152617188,27.4272658515625],[121.083922148438,27.4360353828125]]],[[[121.057345,27.453843],[121.069537382813,27.4504201484376],[121.060767851563,27.4416506171875],[121.057345,27.453843]]],[[[121.097345,27.453843],[121.109537382813,27.4504201484376],[121.100767851563,27.4416506171875],[121.097345,27.453843]]],[[[121.057345,27.453843],[121.044537382813,27.458843],[121.057345,27.4638430000001],[121.057345,27.453843]]],[[[121.113922148438,27.4760353828125],[121.117345,27.4638430000001],[121.105152617188,27.4672658515625],[121.113922148438,27.4760353828125]]],[[[121.097345,27.453843],[121.057345,27.4638430000001],[121.061031523438,27.4820973945313],[121.09062625,27.4671242500001],[121.097345,27.453843]]],[[[120.327345,27.743843],[120.315152617188,27.7472658515625],[120.323922148438,27.7560353828126],[120.327345,27.743843]]],[[[120.327345,27.743843],[120.351793242188,27.7282888007813],[120.372896757813,27.7193971992188],[120.398267851563,27.6877150703126],[120.429210234375,27.6915627265625],[120.462530546875,27.671977765625],[120.482896757813,27.6882888007813],[120.491798125,27.7194118476563],[120.546041289063,27.7627931953126],[120.6110559375,27.7442043281251],[120.612965117188,27.728843],[120.608951445313,27.6965554023438],[120.6326575,27.6995046210938],[120.667345,27.683843],[120.661104765625,27.6584279609376],[120.6768371875,27.6342678046876],[120.630753203125,27.5958376289063],[120.612066679688,27.6000270820313],[120.597345,27.593843],[120.577735625,27.5863063789063],[120.547345,27.5900856757813],[120.532345,27.5882204414063],[120.512345,27.590708234375],[120.502515898438,27.5673854804688],[120.492896757813,27.5793971992188],[120.480548125,27.5882888007813],[120.485582304688,27.547817609375],[120.462345,27.550708234375],[120.442345,27.5482204414063],[120.428472929688,27.5499465156251],[120.412799101563,27.5695217109375],[120.397345,27.5676003242188],[120.37373171875,27.5705373359375],[120.352896757813,27.5582888007813],[120.321793242188,27.5493971992188],[120.295719023438,27.5340700507813],[120.252232695313,27.5394802070313],[120.189234648438,27.5275978828125],[120.091314726563,27.5555593085938],[120.09302859375,27.5693581367188],[120.077345,27.573843],[120.070611601563,27.5790407539063],[120.111129179688,27.5956252265626],[120.113140898438,27.609233625],[120.101109648438,27.6291774726563],[120.12170046875,27.67948753125],[120.190084257813,27.6911037421875],[120.247345,27.7338430000001],[120.253336210938,27.7220021796876],[120.282345,27.7361696601563],[120.302345,27.72640159375],[120.323829375,27.7368923164063],[120.327345,27.743843]]]]}},{"type":"Feature","properties":{"name":"瑞安市","id":"330381"},"geometry":{"type":"MultiPolygon","coordinates":[[[[121.223922148438,27.6260353828125],[121.227345,27.613843],[121.215152617188,27.6172658515625],[121.223922148438,27.6260353828125]]],[[[121.163922148438,27.6360353828126],[121.167345,27.6238430000001],[121.155152617188,27.6272658515625],[121.163922148438,27.6360353828126]]],[[[121.203922148438,27.6360353828126],[121.207345,27.6238430000001],[121.195152617188,27.6272658515625],[121.203922148438,27.6360353828126]]],[[[120.823922148438,27.6560353828125],[120.827345,27.643843],[120.815152617188,27.6472658515626],[120.823922148438,27.6560353828125]]],[[[120.933922148438,27.6560353828125],[120.937345,27.643843],[120.925152617188,27.6472658515626],[120.933922148438,27.6560353828125]]],[[[120.973922148438,27.6660353828125],[120.977345,27.653843],[120.965152617188,27.6572658515625],[120.973922148438,27.6660353828125]]],[[[120.897345,27.7038430000001],[120.909537382813,27.7004201484375],[120.900767851563,27.6916506171875],[120.897345,27.7038430000001]]],[[[120.897345,27.7038430000001],[120.885152617188,27.7072658515625],[120.893922148438,27.7160353828126],[120.897345,27.7038430000001]]],[[[120.327345,27.743843],[120.323922148438,27.7560353828126],[120.315152617188,27.7472658515625],[120.323829375,27.7368923164063],[120.302345,27.72640159375],[120.282345,27.7361696601563],[120.253336210938,27.7220021796876],[120.247345,27.7338430000001],[120.221207304688,27.7677053046875],[120.170230742188,27.8070510078125],[120.193546171875,27.8457033515626],[120.190206328125,27.8683303046875],[120.20298953125,27.87819846875],[120.21170046875,27.88948753125],[120.223160429688,27.8983303046875],[120.22048953125,27.9164040351563],[120.227345,27.933843],[120.233531523438,27.9376564765625],[120.251500273438,27.9706618476563],[120.2697278125,27.9649855781251],[120.301104765625,27.987016828125],[120.33255984375,27.9772194648438],[120.347345,27.983843],[120.383443632813,27.9799391914063],[120.404796171875,27.965317609375],[120.445572539063,27.9767751289063],[120.496558867188,27.958843],[120.49072390625,27.93808128125],[120.503443632813,27.9299391914062],[120.511246367188,27.9177468085938],[120.533443632813,27.9099391914063],[120.551886015625,27.897309796875],[120.5890246875,27.9077468085937],[120.61603640625,27.8769826484375],[120.6095325,27.8538381171875],[120.632345,27.86024925],[120.668531523438,27.8500783515625],[120.681246367188,27.8699391914063],[120.737345,27.873843],[120.751109648438,27.8650319648438],[120.739869414063,27.8250319648438],[120.769537382813,27.8060378242188],[120.777345,27.793843],[120.76170046875,27.76948753125],[120.7462903125,27.7318288398438],[120.688365507813,27.7081227851563],[120.67298953125,27.68819846875],[120.667345,27.683843],[120.6326575,27.6995046210938],[120.608951445313,27.6965554023438],[120.612965117188,27.728843],[120.6110559375,27.7442043281251],[120.546041289063,27.7627931953126],[120.491798125,27.7194118476563],[120.482896757813,27.6882888007813],[120.462530546875,27.671977765625],[120.429210234375,27.6915627265625],[120.398267851563,27.6877150703126],[120.372896757813,27.7193971992188],[120.351793242188,27.7282888007813],[120.327345,27.743843]]]]}},{"type":"Feature","properties":{"name":"泰顺县","id":"330329"},"geometry":{"type":"MultiPolygon","coordinates":[[[[119.817862578125,27.8186525703126],[119.832154570313,27.7586525703125],[119.871549101563,27.7221511054688],[119.888365507813,27.6690334296875],[119.902535429688,27.6786525703125],[119.912877226563,27.6898122382813],[119.951812773438,27.6882692695313],[119.980474882813,27.7034377265626],[119.992550078125,27.6689943671875],[119.991392851563,27.6397634101563],[120.012550078125,27.6090138984375],[120.011773710938,27.5894606757812],[120.032345,27.5886452460938],[120.04252078125,27.589048078125],[120.056964140625,27.573462140625],[120.067345,27.563843],[120.06076296875,27.5481764960938],[120.08326296875,27.5397585273438],[120.10142703125,27.5279274726563],[120.12326296875,27.5197585273438],[120.20142703125,27.4679274726563],[120.22326296875,27.4597585273438],[120.247345,27.443843],[120.233043242188,27.4289601875],[120.217345,27.428637921875],[120.185264921875,27.4292946601563],[120.13224734375,27.4189430976563],[120.12244265625,27.3987380195313],[120.102857695313,27.3991384101563],[120.09224734375,27.3889430976563],[120.0744934375,27.3704665351563],[120.02845828125,27.3392629218751],[119.99771609375,27.3861525703125],[119.96224734375,27.3689430976562],[119.93244265625,27.3287429023437],[119.927345,27.323843],[119.912584257813,27.3173708320313],[119.902105742188,27.3203151679687],[119.872345,27.3072658515625],[119.841729765625,27.3206911445313],[119.828531523438,27.3000783515626],[119.792105742188,27.3103151679688],[119.777345,27.303843],[119.765504179688,27.3098342109375],[119.77478640625,27.328843],[119.764293242188,27.3503273750001],[119.737486601563,27.3638893867188],[119.747203398438,27.3837966132813],[119.727345,27.3938430000001],[119.727345,27.403843],[119.717345,27.403843],[119.707345,27.403843],[119.69060671875,27.4388039375001],[119.705806914063,27.4727321601563],[119.700787382813,27.488843],[119.703912382813,27.4988747382812],[119.688590117188,27.5454592109375],[119.656632109375,27.5355055976563],[119.668873320313,27.5748024726563],[119.631158476563,27.5876564765625],[119.620460234375,27.6190407539063],[119.633531523438,27.6376564765626],[119.637345,27.673843],[119.6486340625,27.717827375],[119.669176054688,27.7320119453126],[119.68142703125,27.7497585273438],[119.705513945313,27.7587721992188],[119.739176054688,27.7820119453125],[119.754088164063,27.8036110664062],[119.777345,27.793843],[119.817862578125,27.8186525703126]]]]}},{"type":"Feature","properties":{"name":"文成县","id":"330328"},"geometry":{"type":"MultiPolygon","coordinates":[[[[120.156456328125,27.9874391914063],[120.191070585938,27.9442140937501],[120.227345,27.933843],[120.22048953125,27.9164040351563],[120.223160429688,27.8983303046875],[120.21170046875,27.88948753125],[120.20298953125,27.87819846875],[120.190206328125,27.8683303046875],[120.193546171875,27.8457033515626],[120.170230742188,27.8070510078125],[120.221207304688,27.7677053046875],[120.247345,27.7338430000001],[120.190084257813,27.6911037421875],[120.12170046875,27.67948753125],[120.101109648438,27.6291774726563],[120.113140898438,27.609233625],[120.111129179688,27.5956252265626],[120.070611601563,27.5790407539063],[120.077345,27.573843],[120.077345,27.563843],[120.067345,27.563843],[120.056964140625,27.573462140625],[120.04252078125,27.589048078125],[120.032345,27.5886452460938],[120.011773710938,27.5894606757812],[120.012550078125,27.6090138984375],[119.991392851563,27.6397634101563],[119.992550078125,27.6689943671875],[119.980474882813,27.7034377265626],[119.951812773438,27.6882692695313],[119.912877226563,27.6898122382813],[119.902535429688,27.6786525703125],[119.888365507813,27.6690334296875],[119.871549101563,27.7221511054688],[119.832154570313,27.7586525703125],[119.817862578125,27.8186525703126],[119.777345,27.793843],[119.7830871875,27.8288088203125],[119.780592070313,27.8456911445313],[119.793116484375,27.8886330390625],[119.7880090625,27.9231789375001],[119.830172148438,27.9169484687501],[119.843375273438,27.938843],[119.83107546875,27.9592360664063],[119.867345,27.973843],[119.897125273438,27.9548976875],[119.936920195313,27.9782888007813],[119.96302859375,27.9693508125],[119.959898710938,27.944184796875],[120.002345,27.9494655585938],[120.023033476563,27.9468923164062],[120.06302859375,27.9583278632813],[120.060889921875,27.975551984375],[120.156456328125,27.9874391914063]]]]}},{"type":"Feature","properties":{"name":"永嘉县","id":"330324"},"geometry":{"type":"MultiPolygon","coordinates":[[[[120.702667265625,28.6100221992188],[120.722345,28.6084401679688],[120.741363554688,28.6099684882813],[120.76197390625,28.5984719062501],[120.797345,28.593843],[120.801612578125,28.5781081367188],[120.8301184375,28.5667800117188],[120.834068632813,28.543843],[120.83099734375,28.5260036445313],[120.853077421875,28.5095778632813],[120.867808867188,28.4897731757813],[120.952955351563,28.5098952460938],[120.961612578125,28.4881081367188],[120.967345,28.483843],[120.975206328125,28.4499123359376],[120.960206328125,28.4383303046875],[120.963082304688,28.4188430000001],[120.961519804688,28.4082717109376],[120.983721953125,28.3991872382813],[120.96154421875,28.3692726875],[120.964312773438,28.3505153632813],[120.92990359375,28.3369875312501],[120.8880090625,28.3431789375001],[120.899078398438,28.2682912421876],[120.881173125,28.238608625],[120.898336210938,28.2253615546875],[120.813858671875,28.11218284375],[120.80298953125,28.0481984687501],[120.787345,28.013843],[120.759757109375,28.0239748359376],[120.60197390625,28.03847190625],[120.58963015625,28.1061305976563],[120.56197390625,28.11847190625],[120.551651640625,28.1415993476563],[120.507345,28.1380397773438],[120.487345,28.1396462226563],[120.46306765625,28.1376955390625],[120.4324621875,28.1593947578126],[120.417345,28.1538430000001],[120.411578398438,28.1792263007813],[120.42334109375,28.1886428046876],[120.411431914063,28.2089040351562],[120.433258085938,28.2387819648437],[120.421793242188,28.2582888007813],[120.408824492188,28.3036501289063],[120.351666289063,28.3383669257813],[120.354381132813,28.3602028632813],[120.331666289063,28.3783888984375],[120.333941679688,28.3966799140626],[120.327345,28.413843],[120.33326296875,28.4179274726563],[120.34509890625,28.43507346875],[120.379303007813,28.4128005195313],[120.3700403125,28.4541139960938],[120.377345,28.483843],[120.38271609375,28.4792140937501],[120.395504179688,28.4643703437501],[120.42271609375,28.53847190625],[120.437398710938,28.5872414375001],[120.464439726563,28.5894118476563],[120.55662234375,28.5379811835938],[120.572345,28.5392458320313],[120.621656523438,28.5352834296875],[120.622745390625,28.548843],[120.6219153125,28.5591896796875],[120.6427746875,28.5684963203125],[120.6419153125,28.5792018867188],[120.684439726563,28.5888625312501],[120.702667265625,28.6100221992188]]]]}},{"type":"Feature","properties":{"name":"瓯海区","id":"330304"},"geometry":{"type":"MultiPolygon","coordinates":[[[[120.427345,28.053843],[120.415152617188,28.0504201484375],[120.423922148438,28.0416506171875],[120.442608671875,28.0470070625001],[120.462345,28.060864484375],[120.490679960938,28.0409670234376],[120.532310820313,28.0272756171876],[120.550094023438,28.0328151679688],[120.582471953125,28.0065895820313],[120.612803984375,27.99714378125],[120.633194609375,28.0114626289063],[120.642003203125,27.9740651679688],[120.672345,27.9835158515625],[120.69255984375,27.9772194648438],[120.707345,27.983843],[120.725767851563,27.9791139960938],[120.719132109375,27.9495143867188],[120.744215117188,27.9321950507813],[120.741221953125,27.918843],[120.7446496875,27.9035720039063],[120.737345,27.873843],[120.681246367188,27.8699391914063],[120.668531523438,27.8500783515625],[120.632345,27.86024925],[120.6095325,27.8538381171875],[120.61603640625,27.8769826484375],[120.5890246875,27.9077468085937],[120.551886015625,27.897309796875],[120.533443632813,27.9099391914063],[120.511246367188,27.9177468085938],[120.503443632813,27.9299391914062],[120.49072390625,27.93808128125],[120.496558867188,27.958843],[120.445572539063,27.9767751289063],[120.404796171875,27.965317609375],[120.383443632813,27.9799391914063],[120.347345,27.983843],[120.34298953125,27.9894875312501],[120.330948515625,27.9987795234375],[120.35170046875,28.04948753125],[120.364483671875,28.0593556953125],[120.360128203125,28.0888527656251],[120.397345,28.103843],[120.40406375,28.0905617500001],[120.423985625,28.080483625],[120.427345,28.053843]]]]}},{"type":"Feature","properties":{"name":"乐清市","id":"330382"},"geometry":{"type":"MultiPolygon","coordinates":[[[[121.167345,28.3438430000001],[121.179537382813,28.3472658515625],[121.170767851563,28.3560353828125],[121.15142703125,28.3397585273438],[121.14326296875,28.3179274726563],[121.13107546875,28.3095143867188],[121.133565703125,28.2983962226563],[121.11611453125,28.27159690625],[121.13361453125,28.2595143867188],[121.124713164063,28.2198024726563],[121.10142703125,28.1897585273438],[121.09326296875,28.1679274726563],[121.07142703125,28.1597585273438],[121.05326296875,28.1479274726563],[121.03142703125,28.1397585273438],[121.00970828125,28.1256130195313],[121.013565703125,28.1083962226563],[121.001124296875,28.0892897773438],[121.003468046875,28.0788430000001],[120.998980742188,28.058843],[121.003565703125,28.0383962226563],[120.9841028125,28.00851096875],[120.951138945313,27.9857497382812],[120.923013945313,27.992055890625],[120.917345,27.983843],[120.857345,27.983843],[120.837345,27.983843],[120.797345,27.983843],[120.790704375,27.997202375],[120.787345,28.013843],[120.80298953125,28.0481984687501],[120.813858671875,28.11218284375],[120.898336210938,28.2253615546875],[120.881173125,28.238608625],[120.899078398438,28.2682912421876],[120.8880090625,28.3431789375001],[120.92990359375,28.3369875312501],[120.964312773438,28.3505153632813],[120.96154421875,28.3692726875],[120.983721953125,28.3991872382813],[120.961519804688,28.4082717109376],[120.963082304688,28.4188430000001],[120.960206328125,28.4383303046875],[120.975206328125,28.4499123359376],[120.967345,28.483843],[120.992261992188,28.4778395820313],[121.007345,28.4808180976563],[121.022413359375,28.4778420234375],[121.07564578125,28.4885158515625],[121.096910429688,28.5436428046875],[121.126314726563,28.5249758125001],[121.161519804688,28.5180178046875],[121.167345,28.513843],[121.177701445313,28.4819338203125],[121.222447539063,28.4389382148438],[121.222242460938,28.4287477851563],[121.251871367188,28.4002761054688],[121.207345,28.373843],[121.201236601563,28.3782228828125],[121.205147734375,28.3980178046875],[121.163936796875,28.3834523750001],[121.183170195313,28.3696681953125],[121.19189578125,28.3574953437501],[121.207345,28.363843],[121.201217070313,28.3388845039063],[121.205504179688,28.3197585273438],[121.177388945313,28.3292995429688],[121.167345,28.3438430000001]],[[121.077345,28.283843],[121.082779570313,28.2711452460937],[121.100343046875,28.279790265625],[121.073922148438,28.2960353828125],[121.065152617188,28.2872658515626],[121.077345,28.283843]]]]}}]}

Path animation is inspirated by Mike Bostock, the man behind the D3js.

路径动画取经于 D3js 创始人 Mike Bostock

By cliking on svg canvas, chart will switch from map to pie chart, or vice versa.

单击图形,图形会在地图和饼图中切换。

<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v4.min.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
</style>
</head>
<body>
<div id="box"></div>
<script>
var statisticData = [
{"name":"苍南县","id":"330327", gdp: 234},
{"name":"洞头县","id":"330322", gdp: 123},
{"name":"龙湾区","id":"330303", gdp: 45},
{"name":"鹿城区","id":"330302", gdp: 200},
{"name":"平阳县","id":"330326", gdp: 156},
{"name":"瑞安市","id":"330381", gdp: 78},
{"name":"泰顺县","id":"330329", gdp: 130},
{"name":"文成县","id":"330328", gdp: 216},
{"name":"永嘉县","id":"330324", gdp: 99},
{"name":"瓯海区","id":"330304", gdp: 46},
{"name":"乐清市","id":"330382", gdp: 159}
];
d3.json("330300.json", function (err, data) {
var draw = createMap()
.geoData(data)
.statisticData(statisticData)
.width(600)
.height(500)
.colorRange(["blue", "red"]);
d3.select("#box").call(draw);
});
function createMap () {
var width = 500, height = 400, margin = 10,
colorRange = ["blue", "red"],
geoData = [], statisticData = [];
var projection, geoPath, arc, svg, holder;
function injectPieData (geoData, statisticData) {
var obj = {}, ii, color;
color = d3.scaleLinear()
.domain(d3.extent(statisticData.map(d => d.gdp)))
.range(colorRange);
for (ii = 0; ii < statisticData.length; ii++) {
obj[statisticData[ii].name] = statisticData[ii].gdp;
}
for (ii = 0; ii < geoData.features.length; ii++) {
geoData.features[ii].properties.weight =
obj[geoData.features[ii].properties.name];
}
return d3.pie()
.value(d => d.properties.weight)(geoData.features)
.map(d => {
d.color = color(d.value);
return d;
});
}
function pathTween (d1, precision) {
return function () {
var path0 = this,
path1 = path0.cloneNode(),
n0 = path0.getTotalLength(),
n1 = (path1.setAttribute("d", d1), path1).getTotalLength();
// Uniform samapling of distance based on specified precision
var distances = [0], // fist point
i = 0, dt = precision / Math.max(n0, n1);
// points between 0 and 1
while ((i += dt) < 1) { distances.push(i); }
// last point
distances.push(1);
// compute point-interpolators at each distance
var points = distances.map(function (t) {
var p0 = path0.getPointAtLength(t * n0),
p1 = path1.getPointAtLength(t * n1);
return d3.interpolate([p0.x, p0.y], [p1.x, p1.y]);
});
return function (t) {
return t < 1 ?
"M " + points.map(function (p) { return p(t); }).join("L") :
d1;
};
};
} // pathTween END
function onClick () {
var isMap = holder.node().classList.contains("map");
if (isMap) {
holder.classed("map", false);
holder.transition()
.duration(2000)
.attr("transform", "translate(" +
[width / 2, height / 2] + ")");
holder.selectAll("path")
.each(function (dd) {
d3.select(this)
.transition()
.duration(2000)
.attrTween("d", pathTween(arc(dd), 4));
});
holder.selectAll("text")
.transition()
.duration(2000)
.attr("x", d => arc.centroid(d)[0])
.attr("y", d => arc.centroid(d)[1]);
}
else {
holder.classed("map", true);
holder.transition()
.duration(2000)
.attr("transform", "translate(" + [margin, margin] + ")");
holder.selectAll("path")
.each(function (dd) {
d3.select(this)
.transition()
.duration(2000)
.attrTween("d", pathTween(geoPath(dd.data), 4));
});
holder.selectAll("text")
.transition()
.duration(2000)
.attr("x", d => geoPath.centroid(d.data.geometry)[0])
.attr("y", d => geoPath.centroid(d.data.geometry)[1]);
}
} // onClick END
function draw (selection) {
projection = d3.geoMercator()
.fitSize([width - margin * 2, height - margin * 2], geoData);
geoPath = d3.geoPath()
.projection(projection);
(function () {
var min = Math.min(width, height) - 20,
outerRadius = (min - 2 * margin) / 2;
arc = d3.arc()
.outerRadius(outerRadius)
.innerRadius(outerRadius * 0.65);
})();
var embedData = injectPieData (geoData, statisticData);
svg = selection
.append("svg")
.style("outline", "1px solid gray")
.attr("width", width)
.attr("height", height);
holder = svg.append("g")
.attr("class", "holder map")
.attr("transform",
"translate(" + [margin, margin] + ")");
holder.selectAll("path")
.data(embedData)
.enter()
.append("path")
.attr("fill", d => d.color)
.attr("stroke", "lightgray")
.attr("stroke-width", 1)
.attr("d", d => geoPath(d.data));
holder.selectAll("text")
.data(embedData)
.enter()
.append("text")
.attr("x", d => geoPath.centroid(d.data.geometry)[0])
.attr("y", d => geoPath.centroid(d.data.geometry)[1])
.text(d => d.data.properties.name)
.attr("text-anchor", "middle")
.style("text-shadow", "1px 1px 1px white");
svg.on("click", onClick);
} // function draw END
// Getter-Setter functions
draw.width = function (_) {
if (!arguments.length) { return width; }
width = _;
return draw;
};
draw.height = function (_) {
if (!arguments.length) { return height; }
height = _;
return draw;
};
draw.colorRange = function (_) {
if (!arguments.length) { return colorRange; }
colorRange = _;
return draw;
};
draw.geoData = function (_) {
if (!arguments.length) { return geoData; }
geoData = _;
return draw;
};
draw.statisticData = function (_) {
if (!arguments.length) { return statisticData; }
statisticData = _;
return draw;
};
return draw;
}
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment