Skip to content

Instantly share code, notes, and snippets.

@tdsymonds
Created March 1, 2017 12:54
Show Gist options
  • Save tdsymonds/028d69c7f15568671b5b48e8e10ebacb to your computer and use it in GitHub Desktop.
Save tdsymonds/028d69c7f15568671b5b48e8e10ebacb to your computer and use it in GitHub Desktop.
How to create a polygon object for GeoDjango polygon field
from django.contrib.gis.geos import Polygon
polygon = Polygon([ [ -0.300718341203409, 51.499348080169298 ], [ -0.305825965105626, 51.498332099170185 ], [ -0.307022220327252, 51.502946258541684 ], [ -0.307484352569642, 51.502956525191117 ], [ -0.307389790901562, 51.50270877049892 ], [ -0.308467442785522, 51.502477927448041 ], [ -0.308630258983584, 51.502711378579441 ], [ -0.315328507266898, 51.501115424124485 ], [ -0.315307276005044, 51.500597160763 ], [ -0.31700604605745, 51.499968706315791 ], [ -0.316747263949783, 51.499679935641787 ], [ -0.317115403364906, 51.499542240450104 ], [ -0.322434764868367, 51.505306090523163 ], [ -0.326171329324033, 51.503962067782354 ], [ -0.32920456109009, 51.50959043971325 ], [ -0.326859549034093, 51.509719773727142 ], [ -0.319498302693188, 51.51090313757738 ], [ -0.319724317133101, 51.513533929252844 ], [ -0.320820301819518, 51.514534281758522 ], [ -0.32142240605236, 51.516032924757987 ], [ -0.322601530580793, 51.517087503992336 ], [ -0.323069801167743, 51.52081970904073 ], [ -0.317202156498873, 51.521279715937439 ], [ -0.31641132473092, 51.521500369862352 ], [ -0.316193105002668, 51.521984620552864 ], [ -0.311485879281137, 51.521307280185532 ], [ -0.308460843574011, 51.522810375583184 ], [ -0.309046204467496, 51.527476829201127 ], [ -0.310087193599613, 51.529653578525192 ], [ -0.309030794051407, 51.529916218212847 ], [ -0.308783070148249, 51.531154483612788 ], [ -0.308145211468595, 51.531559831371681 ], [ -0.306999874872124, 51.531769914239646 ], [ -0.303511860609241, 51.531509106117234 ], [ -0.302731567541226, 51.531982504811403 ], [ -0.299557066726257, 51.533252108572924 ], [ -0.29658913749489, 51.535240414087525 ], [ -0.295825489829068, 51.535303060622255 ], [ -0.295173274327604, 51.534891628555755 ], [ -0.293294433225463, 51.534971319122 ], [ -0.286752039006545, 51.536755352930918 ], [ -0.2824856072251, 51.538664985912781 ], [ -0.277797826977885, 51.535071275066414 ], [ -0.278473010871174, 51.534564126145369 ], [ -0.2790100325301, 51.533208768851722 ], [ -0.280951465097939, 51.532576297424669 ], [ -0.281508920264996, 51.533240904302595 ], [ -0.283539024689224, 51.532818310960018 ], [ -0.284038968906202, 51.533518033379529 ], [ -0.289388283777546, 51.531667303444259 ], [ -0.28575191558325, 51.529179102430554 ], [ -0.28425369845098, 51.528918903065417 ], [ -0.280478540185958, 51.528405918632288 ], [ -0.277196392085164, 51.529232717439953 ], [ -0.271461060912511, 51.529945070538574 ], [ -0.270593016396035, 51.530043782025977 ], [ -0.270417629895669, 51.529764232284265 ], [ -0.26967621574123, 51.530002386698534 ], [ -0.269021605713225, 51.529738246223019 ], [ -0.266610493588597, 51.530512854505623 ], [ -0.264876560647277, 51.531638241229722 ], [ -0.26485434347013, 51.532184647062287 ], [ -0.263377961139448, 51.532677163078311 ], [ -0.260433657986825, 51.534534522625556 ], [ -0.257809111634768, 51.535337259710545 ], [ -0.256451780471354, 51.534935819381751 ], [ -0.256049597106446, 51.533952373120705 ], [ -0.252341111409308, 51.534142676813232 ], [ -0.251140878075618, 51.533895485490326 ], [ -0.25077371675389, 51.534183162233916 ], [ -0.247359158077412, 51.533514424376463 ], [ -0.246311399977157, 51.532752400438 ], [ -0.246994552928248, 51.531783342614752 ], [ -0.245269072638192, 51.531212608574556 ], [ -0.247725956905515, 51.530307832281139 ], [ -0.250468517645944, 51.528341670817234 ], [ -0.250066101839043, 51.52819628689825 ], [ -0.250621128989681, 51.527782823268517 ], [ -0.250295361969, 51.52717997251262 ], [ -0.252660593914482, 51.524593953121915 ], [ -0.251923482478103, 51.522235063609614 ], [ -0.250305077096738, 51.520157076484601 ], [ -0.250721507081745, 51.519483463796348 ], [ -0.250604863148626, 51.518540222464466 ], [ -0.249091899531346, 51.514055628704888 ], [ -0.246650281120857, 51.511245903393764 ], [ -0.245086811047362, 51.506741610322749 ], [ -0.246513769659736, 51.506731479054224 ], [ -0.245702705970943, 51.504625020626285 ], [ -0.248011191844397, 51.504358281606201 ], [ -0.248080848552132, 51.504608411561591 ], [ -0.249280405475039, 51.504439281536889 ], [ -0.249431093183269, 51.504680728526814 ], [ -0.249928993618254, 51.504434573355098 ], [ -0.252515381108166, 51.504510905455078 ], [ -0.252543716465036, 51.504711858021324 ], [ -0.253764449751569, 51.504553788566206 ], [ -0.253659206529602, 51.504291442180161 ], [ -0.255090373331911, 51.504319936874751 ], [ -0.253365857246629, 51.502881562650032 ], [ -0.253083914262199, 51.501399912688349 ], [ -0.252786630230702, 51.499905443702296 ], [ -0.255026699712879, 51.496971301870332 ], [ -0.255118328274577, 51.4963449954586 ], [ -0.255512844773796, 51.496275328279616 ], [ -0.255434489428101, 51.494931596855409 ], [ -0.261470125585212, 51.494641745911046 ], [ -0.267675591497291, 51.49393594702488 ], [ -0.270050114864419, 51.494228180040814 ], [ -0.271557902305246, 51.494888871212041 ], [ -0.272949552059979, 51.496527103159195 ], [ -0.276738922873067, 51.498539585488018 ], [ -0.277896080966695, 51.499488192383744 ], [ -0.280783594519346, 51.502850537890829 ], [ -0.285732835228299, 51.500779201750149 ], [ -0.28681058593727, 51.50066276184797 ], [ -0.294050054059212, 51.501562311359081 ], [ -0.300718341203409, 51.499348080169298 ] ])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment