Last active
October 20, 2019 02:27
-
-
Save blackymetal/43a0ce2f0a3fd1c870e81f4279d8046e to your computer and use it in GitHub Desktop.
Elasticsearch point in geo_shape
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
PUT /cities?include_type_name=true | |
{ | |
"mappings": { | |
"_doc": { | |
"properties": { | |
"type": { "type": "keyword" }, | |
"name": {"type": "text"}, | |
"zone": {"type": "geo_shape"} | |
} | |
} | |
} | |
} | |
* */ | |
use Elasticsearch\ClientBuilder; | |
require 'vendor/autoload.php'; | |
$client = ClientBuilder::create()->build(); | |
$departments = [ | |
1 => '{ "type": "Feature", "properties": { "Name": "BOGOTA", "description": null }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -74.347229, -0.684295 ], [ -74.385681, -0.736476 ], [ -74.338989, -0.78591 ], [ -74.284058, -0.783163 ], [ -74.289551, -0.827104 ], [ -74.270325, -0.868299 ], [ -74.311523, -0.901254 ], [ -74.267578, -1.000117 ], [ -74.080811, -1.087993 ], [ -74.045105, -1.005609 ], [ -74.012146, -1.109962 ], [ -73.918762, -1.137422 ], [ -73.861084, -1.24177 ], [ -73.77594, -1.269229 ], [ -73.762207, -1.21431 ], [ -73.638611, -1.274721 ], [ -73.479309, -1.606952 ], [ -73.539734, -1.733241 ], [ -73.465162142654805, -1.76832117644284 ], [ -73.306274, -1.843051 ], [ -73.306274, -1.812854 ], [ -73.240356, -1.82658 ], [ -73.22113, -1.771675 ], [ -73.053589, -2.123034 ], [ -73.152466, -2.230073 ], [ -73.111267, -2.345338 ], [ -72.968445, -2.37278 ], [ -72.932739, -2.496265 ], [ -72.765198, -2.416687 ], [ -72.745972, -2.446872 ], [ -72.693787, -2.411199 ], [ -72.671814, -2.482545 ], [ -72.614136, -2.397478 ], [ -72.57019, -2.422176 ], [ -72.386169, -2.400222 ], [ -72.344971, -2.485289 ], [ -72.224121, -2.430408 ], [ -72.114258, -2.460593 ], [ -72.042847, -2.331616 ], [ -71.900024, -2.375525 ], [ -71.921997, -2.317895 ], [ -71.875305, -2.279473 ], [ -71.721497, -2.131268 ], [ -71.707764, -2.213606 ], [ -71.636353, -2.188905 ], [ -71.507263, -2.230073 ], [ -71.485291, -2.334361 ], [ -71.452332, -2.260263 ], [ -71.38092, -2.402966 ], [ -71.323242, -2.378269 ], [ -71.27655, -2.342593 ], [ -71.161194, -2.367292 ], [ -71.119995, -2.331616 ], [ -71.114502, -2.284962 ], [ -71.07605, -2.265751 ], [ -70.982666, -2.265751 ], [ -70.988159, -2.213606 ], [ -70.949707, -2.241051 ], [ -70.85083, -2.227329 ], [ -70.64209, -2.386501 ], [ -70.644836, -2.466081 ], [ -70.551453, -2.471569 ], [ -70.584412, -2.408455 ], [ -70.485535, -2.455105 ], [ -70.422363, -2.518217 ], [ -70.309753, -2.509985 ], [ -70.342712, -2.57035 ], [ -70.252075, -2.548399 ], [ -70.194397, -2.6362 ], [ -70.177917, -2.625225 ], [ -70.139465, -2.70479 ], [ -70.098267, -2.633456 ], [ -70.037842, -2.743199 ], [ -70.716248, -3.779711 ], [ -70.523987, -3.883848 ], [ -70.326233, -3.785192 ], [ -69.938965, -4.215354 ], [ -69.439087, -1.455944 ], [ -69.425354, -1.233532 ], [ -69.403381, -1.129184 ], [ -69.422607, -1.022086 ], [ -69.524231, -0.92597 ], [ -69.568176, -0.824358 ], [ -69.623108, -0.730983 ], [ -69.573669, -0.643099 ], [ -69.620361, -0.500284 ], [ -69.845581, -0.343733 ], [ -69.908752, -0.324507 ], [ -70.062561, -0.184433 ], [ -70.048828, -0.093796 ], [ -70.048432325090204, 0.0 ], [ -70.046082, 0.557135 ], [ -69.906006, 0.581853 ], [ -69.804382, 0.581853 ], [ -69.700012, 0.675232 ], [ -69.606628, 0.636782 ], [ -69.477539, 0.738398 ], [ -69.362183, 0.620303 ], [ -69.299011, 0.65326 ], [ -69.296265, 0.606571 ], [ -69.197388, 0.645021 ], [ -69.112244, 0.625796 ], [ -69.189148, 0.743891 ], [ -69.164429, 0.80431 ], [ -69.134216, 0.845505 ], [ -69.178162, 0.955354 ], [ -69.200134, 1.004786 ], [ -69.315491, 1.098154 ], [ -69.419861, 1.059708 ], [ -69.455566, 1.081677 ], [ -69.656067, 1.087169 ], [ -69.702759, 1.133852 ], [ -69.845581, 1.089915 ], [ -69.842834, 1.724181 ], [ -69.642334, 1.743399 ], [ -69.551697, 1.792813 ], [ -69.392395, 1.729672 ], [ -68.161926, 1.735163 ], [ -68.274536, 1.842227 ], [ -68.252563, 1.932815 ], [ -68.156433, 1.995949 ], [ -67.961426, 1.836737 ], [ -67.903748, 1.894384 ], [ -67.769165, 2.045357 ], [ -67.618103, 2.023398 ], [ -67.546692, 2.146913 ], [ -67.450562, 2.204549 ], [ -67.428589, 2.25395 ], [ -67.380135051959599, 2.2280131563849 ], [ -67.351685, 2.212783 ], [ -67.269287, 1.869678 ], [ -67.164917, 1.853208 ], [ -67.115479, 1.779087 ], [ -67.08252, 1.507288 ], [ -67.090759, 1.177789 ], [ -66.862793, 1.227216 ], [ -66.895752, 1.276643 ], [ -66.876526, 1.315085 ], [ -66.909485, 1.402951 ], [ -67.079773, 1.921835 ], [ -67.129211, 1.987715 ], [ -67.101746, 2.083784 ], [ -67.156677, 2.133189 ], [ -67.214355, 2.264928 ], [ -67.17041, 2.352747 ], [ -67.380135051959599, 2.541898061687 ], [ -67.480774, 2.632633 ], [ -67.489014, 2.687506 ], [ -67.568665, 2.671044 ], [ -67.598877, 2.7945 ], [ -67.749939, 2.854851 ], [ -67.870789, 2.7945 ], [ -67.865295, 2.860338 ], [ -67.380135051959599, 3.28424982738974 ], [ -67.359924, 3.301897 ], [ -67.307739, 3.436247 ], [ -67.380135051959599, 3.47754047459437 ], [ -67.384644, 3.480112 ], [ -67.505493, 3.748742 ], [ -67.61261, 3.756964 ], [ -67.804871, 4.209054 ], [ -67.796631, 4.373387 ], [ -67.876282, 4.521256 ], [ -67.835083, 4.756688 ], [ -67.802124, 5.065912 ], [ -67.854309, 5.279272 ], [ -67.714233, 5.426941 ], [ -67.629089, 5.5281 ], [ -67.653809, 5.659309 ], [ -67.593384, 5.81508 ], [ -67.423096, 6.000855 ], [ -67.483521, 6.088257 ], [ -67.472534, 6.189298 ], [ -67.565918, 6.263018 ], [ -67.843323, 6.301239 ], [ -67.975159, 6.197489 ], [ -68.137207, 6.235715 ], [ -68.274536, 6.167453 ], [ -68.450317, 6.189298 ], [ -68.626099, 6.131953 ], [ -68.744202, 6.164722 ], [ -69.073792, 6.216603 ], [ -69.266052, 6.080064 ], [ -69.326477, 6.15653 ], [ -69.450073, 6.118298 ], [ -70.08728, 7.007807 ], [ -70.139465, 6.983272 ], [ -70.315247, 6.934197 ], [ -70.444336, 6.99145 ], [ -70.559692, 7.073228 ], [ -70.691528, 7.097758 ], [ -70.861816, 7.054148 ], [ -71.05957, 6.977819 ], [ -71.139221, 7.026889 ], [ -71.260071, 7.024163 ], [ -71.507263, 7.032341 ], [ -71.589661, 7.01912 ], [ -71.765442, 7.051831 ], [ -71.872559, 7.016394 ], [ -71.976929, 7.005081 ], [ -72.023621, 7.015985 ], [ -72.100525, 7.013259 ], [ -72.199402, 7.013259 ], [ -72.27356, 6.966914 ], [ -72.284546, 6.994176 ], [ -72.322998, 6.999629 ], [ -72.342224, 6.926018 ], [ -72.424622, 6.86603 ], [ -72.531738, 6.887845 ], [ -72.534485, 6.609635 ], [ -72.57019, 6.56598 ], [ -72.553711, 6.478658 ], [ -72.688293, 6.421345 ], [ -72.79541, 6.574165 ], [ -72.836609, 6.530507 ], [ -72.762451, 6.429533 ], [ -72.784424, 6.282129 ], [ -72.825623, 6.189298 ], [ -72.929993, 6.088257 ], [ -73.017883, 5.968076 ], [ -73.114014, 5.957149 ], [ -73.23761, 5.979002 ], [ -73.292542, 5.864261 ], [ -73.391418, 5.826009 ], [ -73.394165, 5.785022 ], [ -73.451843, 5.768626 ], [ -73.498535, 5.842403 ], [ -73.396912, 5.95988 ], [ -73.45459, 6.047289 ], [ -73.526001, 6.093719 ], [ -73.569946, 6.044558 ], [ -73.608398, 5.979002 ], [ -73.638611, 5.913439 ], [ -73.630371, 5.826009 ], [ -73.635864, 5.741299 ], [ -73.67981, 5.708504 ], [ -73.753967, 5.765893 ], [ -73.902283, 5.716703 ], [ -74.014893, 5.75223 ], [ -74.108276, 5.826009 ], [ -74.198914, 5.872458 ], [ -74.251099, 5.828742 ], [ -74.284058, 5.932562 ], [ -74.308777, 6.07187 ], [ -74.358215, 6.022707 ], [ -74.468079, 6.055483 ], [ -74.506531, 6.183837 ], [ -74.555969, 6.257558 ], [ -74.594421, 6.224794 ], [ -74.621887, 6.112836 ], [ -74.594421, 6.066408 ], [ -74.619141, 5.951685 ], [ -74.668579, 5.828742 ], [ -74.687805, 5.735833 ], [ -74.6521, 5.670241 ], [ -74.685059, 5.558172 ], [ -74.679565, 5.473422 ], [ -74.701538, 5.394129 ], [ -74.770203, 5.282007 ], [ -74.74823, 5.158924 ], [ -74.761963, 5.002984 ], [ -74.772949, 4.811428 ], [ -74.8526, 4.73479 ], [ -74.836121, 4.614343 ], [ -74.8526, 4.545898 ], [ -74.819641, 4.480184 ], [ -74.86084, 4.425418 ], [ -74.910278, 4.291225 ], [ -74.915771, 4.258358 ], [ -74.830627, 4.272052 ], [ -74.800415, 4.247401 ], [ -74.764709, 4.239184 ], [ -74.720764, 4.200836 ], [ -74.671326, 4.220011 ], [ -74.605408, 4.261097 ], [ -74.544983, 4.22275 ], [ -74.506531, 4.121395 ], [ -74.52301, 4.077563 ], [ -74.542236, 4.000438 ], [ -74.536743, 3.929198 ], [ -74.569702, 3.808624 ], [ -74.498291, 3.731064 ], [ -74.619141, 3.336309 ], [ -74.904785, 2.963339 ], [ -75.058594, 2.743885 ], [ -75.014648, 2.612193 ], [ -75.223389, 2.513415 ], [ -75.355225, 2.359745 ], [ -75.60791, 1.9755 ], [ -75.772705, 1.843737 ], [ -76.047363, 1.514289 ], [ -76.201172, 1.558219 ], [ -76.322021, 1.294629 ], [ -76.124268, 1.041996 ], [ -75.959473, 1.05298 ], [ -75.761719, 0.822298 ], [ -75.596924, 0.811313 ], [ -75.410156, 0.679489 ], [ -75.27832, 0.668503 ], [ -75.27832, 0.525688 ], [ -75.036621, 0.459773 ], [ -75.025635, 0.229064 ], [ -74.750977, 0.163147 ], [ -74.696045, 0.020325 ], [ -74.688786054955301, 0.0 ], [ -74.641113, -0.133484 ], [ -74.53125, -0.166443 ], [ -74.388428, -0.14447 ], [ -74.267578, -0.254333 ], [ -74.146729, -0.23236 ], [ -74.080811, -0.353208 ], [ -73.894043, -0.419125 ], [ -74.396667, -0.582265 ], [ -74.347229, -0.684295 ] ] ] } }', | |
2 => '{ "type": "Feature", "properties": { "Name": "Barranquilla", "description": null }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -73.465162142654805, 11.2804528086634 ], [ -73.616638, 11.266902 ], [ -73.792419, 11.264208 ], [ -73.998413, 11.355778 ], [ -74.157715, 11.334235 ], [ -74.226379, 11.245352 ], [ -74.226379, 11.078285 ], [ -74.377441, 10.765453 ], [ -74.479065, 10.749263 ], [ -74.528503, 10.927304 ], [ -74.506531, 10.983931 ], [ -74.8526, 11.118713 ], [ -74.836121, 11.056721 ], [ -74.934998, 11.059417 ], [ -74.978943, 10.989323 ], [ -75.042114, 10.919213 ], [ -75.250854, 10.800528 ], [ -75.275574, 10.719579 ], [ -75.39917, 10.679097 ], [ -75.456848, 10.598116 ], [ -75.506287, 10.576517 ], [ -75.4953, 10.514413 ], [ -75.552979, 10.417181 ], [ -75.506287, 10.319918 ], [ -75.540463126861397, 10.2905703560685 ], [ -75.701294, 10.152341 ], [ -75.682068, 10.1226 ], [ -75.533752, 10.246952 ], [ -75.525513, 10.176672 ], [ -75.574951, 10.114488 ], [ -75.577698, 9.973855 ], [ -75.643616, 9.768205 ], [ -75.72052, 9.714065 ], [ -75.605164, 9.703236 ], [ -75.574951, 9.592219 ], [ -75.646362, 9.42698 ], [ -75.737, 9.418852 ], [ -75.808411, 9.408013 ], [ -75.885315, 9.432399 ], [ -76.091309, 9.329425 ], [ -76.121521, 9.269794 ], [ -76.176453, 9.237264 ], [ -76.206665, 9.109826 ], [ -76.27533, 9.042021 ], [ -76.333008, 8.93622 ], [ -76.431885, 8.857527 ], [ -76.352234, 8.670226 ], [ -76.220398, 8.567034 ], [ -76.203918, 8.423063 ], [ -76.368713, 8.202927 ], [ -76.429138, 7.996269 ], [ -76.525269, 7.658867 ], [ -76.352234, 7.359334 ], [ -76.000671, 7.353886 ], [ -75.83313, 7.402916 ], [ -75.695801, 7.612589 ], [ -75.668335, 7.699696 ], [ -75.583191, 7.735078 ], [ -75.514526, 7.70514 ], [ -75.478821, 7.800392 ], [ -75.344238, 7.862974 ], [ -75.333252, 7.928267 ], [ -75.226135, 8.028907 ], [ -74.962463, 8.047944 ], [ -74.830627, 8.189335 ], [ -74.544983, 7.914665 ], [ -74.525757, 7.770458 ], [ -74.481812, 7.707862 ], [ -74.566956, 7.612589 ], [ -74.616394, 7.449216 ], [ -74.506531, 7.3103 ], [ -74.404907, 7.468279 ], [ -74.360962, 7.37023 ], [ -74.42688, 7.315749 ], [ -74.43512, 7.193142 ], [ -74.396667, 7.092307 ], [ -74.371948, 7.002355 ], [ -74.251099, 6.985998 ], [ -73.957214, 7.26671 ], [ -73.929749, 7.389297 ], [ -73.940735, 7.468279 ], [ -73.88855, 7.525464 ], [ -73.844604, 7.680643 ], [ -73.852844, 7.876577 ], [ -73.89679, 7.97995 ], [ -73.88031, 8.064261 ], [ -73.814392, 8.121364 ], [ -73.792419, 8.064261 ], [ -73.751221, 7.952749 ], [ -73.696289, 7.914665 ], [ -73.75946, 7.811276 ], [ -73.778687, 7.729635 ], [ -73.657837, 7.70514 ], [ -73.605652, 7.72147 ], [ -73.476562, 7.680643 ], [ -73.465162142654805, 7.68540049594478 ], [ -73.424377, 7.702418 ], [ -73.372192, 7.79767 ], [ -73.377686, 7.884739 ], [ -73.309021, 7.906504 ], [ -73.328247, 8.004429 ], [ -73.410645, 8.039785 ], [ -73.421631, 8.118645 ], [ -73.427124, 8.183897 ], [ -73.399658, 8.262729 ], [ -73.358459, 8.404044 ], [ -73.429871, 8.428497 ], [ -73.421631, 8.34698 ], [ -73.465162142654805, 8.31826711162671 ], [ -73.479309, 8.308934 ], [ -73.528748, 8.376872 ], [ -73.490295, 8.466532 ], [ -73.556213, 8.509995 ], [ -73.556213, 8.645788 ], [ -73.501282, 8.681087 ], [ -73.465576, 8.727241 ], [ -73.465162142654805, 8.73016342420418 ], [ -73.44635, 8.862955 ], [ -73.451843, 8.985055 ], [ -73.424377, 9.11525 ], [ -73.369446, 9.180329 ], [ -73.361206, 9.242686 ], [ -73.320007, 9.239975 ], [ -73.22937, 9.437818 ], [ -73.125, 9.567845 ], [ -73.089294, 9.578678 ], [ -72.949219, 9.857516 ], [ -72.995911, 9.906221 ], [ -72.91626, 10.117192 ], [ -72.911829329069903, 10.1608222922236 ], [ -72.888794, 10.387465 ], [ -72.886047, 10.4631 ], [ -72.778931, 10.63591 ], [ -72.685547, 10.78434 ], [ -72.641602, 10.889546 ], [ -72.47406, 11.067503 ], [ -72.441101, 11.126798 ], [ -72.232361, 11.159136 ], [ -71.971436, 11.651833 ], [ -71.38092, 11.818562 ], [ -71.383667, 11.845444 ], [ -71.336975, 11.866948 ], [ -71.317749, 11.845444 ], [ -71.28479, 11.936824 ], [ -71.122742, 12.033545 ], [ -71.117249, 12.095321 ], [ -71.218872, 12.272513 ], [ -71.224365, 12.312767 ], [ -71.320496, 12.363746 ], [ -71.433105, 12.390574 ], [ -71.559448, 12.452267 ], [ -71.672058, 12.460312 ], [ -71.71875, 12.438856 ], [ -71.669312, 12.412034 ], [ -71.737976, 12.398622 ], [ -71.740723, 12.350332 ], [ -71.795654, 12.3235 ], [ -71.845093, 12.377161 ], [ -71.946716, 12.280564 ], [ -71.867065, 12.256409 ], [ -71.889038, 12.20004 ], [ -71.952209, 12.159768 ], [ -71.996155, 12.189301 ], [ -71.952209, 12.256409 ], [ -72.169189, 12.226884 ], [ -72.14447, 12.106064 ], [ -72.237854, 11.907263 ], [ -72.479553, 11.783611 ], [ -72.78717, 11.69218 ], [ -72.910767, 11.560358 ], [ -73.284302, 11.29653 ], [ -73.465162142654805, 11.2804528086634 ] ] ] } }', | |
3 => '{ "type": "Feature", "properties": { "Name": "Medellín", "description": null }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -76.456308667788605, 4.64286424197805 ], [ -76.453857, 4.649932 ], [ -76.35498, 4.781321 ], [ -76.25061, 4.827849 ], [ -76.209412, 4.890794 ], [ -76.197522814915004, 4.91448603317372 ], [ -76.173706, 4.961941 ], [ -76.234131, 5.000248 ], [ -76.25885, 5.068647 ], [ -76.324768, 5.191749 ], [ -76.365967, 5.268333 ], [ -76.319275, 5.290212 ], [ -76.283569, 5.344907 ], [ -76.159973, 5.424207 ], [ -76.018524, 5.473627 ], [ -75.886688, 5.477728 ], [ -75.838623, 5.516003 ], [ -75.747986, 5.522838 ], [ -75.7164, 5.509169 ], [ -75.62027, 5.51737 ], [ -75.621643, 5.733305 ], [ -75.502167, 5.663613 ], [ -75.443115, 5.689578 ], [ -75.393677, 5.654047 ], [ -75.410156, 5.606214 ], [ -75.374451, 5.596647 ], [ -75.342865, 5.457222 ], [ -75.264587, 5.466792 ], [ -75.233002, 5.513269 ], [ -75.175323, 5.525572 ], [ -75.154724, 5.558377 ], [ -75.128632, 5.577512 ], [ -75.117645, 5.643114 ], [ -75.027008, 5.678646 ], [ -75.006409, 5.711442 ], [ -74.874573, 5.727839 ], [ -74.86084, 5.699144 ], [ -74.770203, 5.685478 ], [ -74.759216, 5.703243 ], [ -74.720764, 5.763366 ], [ -74.696045, 5.760633 ], [ -74.628754, 5.966915 ], [ -74.605408, 6.070709 ], [ -74.6315, 6.102117 ], [ -74.606781, 6.237285 ], [ -74.557343, 6.271413 ], [ -74.54361, 6.250937 ], [ -74.443359, 6.368324 ], [ -74.392548, 6.383337 ], [ -74.415894, 6.422914 ], [ -74.447479, 6.540262 ], [ -74.358215, 6.609839 ], [ -74.153595, 6.751692 ], [ -74.024506, 6.897593 ], [ -73.955841, 6.930312 ], [ -73.89267, 6.987565 ], [ -73.936615, 7.072069 ], [ -73.950348, 7.155195 ], [ -73.958588, 7.260103 ], [ -74.251099, 6.98075 ], [ -74.381561, 6.995744 ], [ -74.448853, 7.197434 ], [ -74.436493, 7.325488 ], [ -74.374695, 7.378606 ], [ -74.406281, 7.453505 ], [ -74.51889, 7.309143 ], [ -74.628754, 7.458952 ], [ -74.577942, 7.618238 ], [ -74.498291, 7.716231 ], [ -74.542236, 7.780186 ], [ -74.560089, 7.916229 ], [ -74.830627, 8.180023 ], [ -74.959717, 8.044068 ], [ -75.220642, 8.023671 ], [ -75.326385, 7.92439 ], [ -75.338745, 7.856376 ], [ -75.473328, 7.793793 ], [ -75.522766, 7.701261 ], [ -75.581818, 7.728479 ], [ -75.665588, 7.693096 ], [ -75.691681, 7.60871 ], [ -75.834503, 7.397672 ], [ -75.996552, 7.351367 ], [ -76.361847, 7.358177 ], [ -76.534882, 7.665876 ], [ -76.376953, 8.211286 ], [ -76.216278, 8.431417 ], [ -76.225891, 8.561806 ], [ -76.3591, 8.669072 ], [ -76.437378, 8.855017 ], [ -76.544495, 8.762531 ], [ -76.629639, 8.735385 ], [ -76.651611, 8.670226 ], [ -76.885071, 8.618634 ], [ -76.942749, 8.550738 ], [ -76.830139, 8.49913 ], [ -76.783447, 8.436647 ], [ -76.734009, 8.083296 ], [ -76.753235, 7.928267 ], [ -76.865845, 7.898342 ], [ -76.934509, 7.939148 ], [ -76.915283, 8.023467 ], [ -76.857605, 8.042505 ], [ -76.849365, 8.134959 ], [ -76.937256, 8.121364 ], [ -76.967468, 8.257293 ], [ -77.0224, 8.251857 ], [ -77.091064, 8.35785 ], [ -77.250366, 8.488264 ], [ -77.362976, 8.686517 ], [ -77.44812, 8.526293 ], [ -77.395935, 8.474681 ], [ -77.170715, 7.936428 ], [ -77.269592, 7.925546 ], [ -77.354736, 7.868415 ], [ -77.316284, 7.748686 ], [ -77.428894, 7.72147 ], [ -77.593689, 7.520018 ], [ -77.739258, 7.7378 ], [ -77.774963, 7.645256 ], [ -77.722778, 7.525464 ], [ -77.76123, 7.457386 ], [ -77.807922, 7.462833 ], [ -77.89032, 7.225841 ], [ -77.667847, 6.996903 ], [ -77.687073, 6.953282 ], [ -77.714539, 6.912385 ], [ -77.698059, 6.841488 ], [ -77.676086, 6.876938 ], [ -77.588196, 6.827852 ], [ -77.55249, 6.683294 ], [ -77.516785, 6.650558 ], [ -77.459106, 6.710573 ], [ -77.34375, 6.571437 ], [ -77.365723, 6.432262 ], [ -77.426147, 6.385862 ], [ -77.365723, 6.369485 ], [ -77.409668, 6.246637 ], [ -77.472839, 6.287589 ], [ -77.481079, 6.181106 ], [ -77.327271, 5.916171 ], [ -77.250366, 5.765893 ], [ -77.368469, 5.601909 ], [ -77.398682, 5.618309 ], [ -77.514038, 5.582774 ], [ -77.533264, 5.49256 ], [ -77.398682, 5.451549 ], [ -77.387695, 5.333969 ], [ -77.376709, 5.221836 ], [ -77.371216, 5.134304 ], [ -77.359476177018607, 4.93784273467225 ], [ -77.357483, 4.904476 ], [ -77.338257, 4.816902 ], [ -77.308044, 4.781321 ], [ -77.321777, 4.740265 ], [ -77.357483, 4.441848 ], [ -77.437134, 4.285747 ], [ -77.500305, 4.285747 ], [ -77.533264, 4.217271 ], [ -77.494812, 4.209054 ], [ -77.346497, 4.184401 ], [ -77.291565, 4.233706 ], [ -77.24762, 4.173444 ], [ -77.195435, 4.184401 ], [ -77.115784, 4.118656 ], [ -76.997681, 4.124135 ], [ -76.808167, 3.99537 ], [ -76.70105, 4.030988 ], [ -76.59668, 4.069344 ], [ -76.462097, 4.176183 ], [ -76.549988, 4.236445 ], [ -76.558228, 4.285747 ], [ -76.59668, 4.406249 ], [ -76.530762, 4.428157 ], [ -76.456308667788605, 4.64286424197805 ] ] ] } }', | |
4 => '{ "type": "Feature", "properties": { "Name": "Bucaramanga", "description": null }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -74.421387, 6.459554 ], [ -74.369202, 6.380403 ], [ -74.443359, 6.358566 ], [ -74.533997, 6.246637 ], [ -74.492798, 6.183837 ], [ -74.468079, 6.074601 ], [ -74.371948, 6.039095 ], [ -74.303284, 6.090988 ], [ -74.248352, 5.8506 ], [ -74.204407, 5.897047 ], [ -74.116516, 5.8506 ], [ -74.017639, 5.776824 ], [ -73.905029, 5.7331 ], [ -73.748474, 5.779966 ], [ -73.688049, 5.727634 ], [ -73.641357, 5.741299 ], [ -73.666077, 5.924367 ], [ -73.539734, 6.115977 ], [ -73.465162142654805, 6.07392126710771 ], [ -73.451843, 6.066408 ], [ -73.385925, 5.95988 ], [ -73.465162142654805, 5.85698528322511 ], [ -73.484802, 5.831474 ], [ -73.465162142654805, 5.80442068673729 ], [ -73.449097, 5.782289 ], [ -73.413391, 5.80415 ], [ -73.396912, 5.831474 ], [ -73.306274, 5.872458 ], [ -73.24585, 6.000855 ], [ -73.103027, 5.979002 ], [ -73.02887, 5.987197 ], [ -72.836609, 6.208411 ], [ -72.792664, 6.303969 ], [ -72.773437, 6.424484 ], [ -72.858582, 6.539103 ], [ -72.781677, 6.590536 ], [ -72.69104, 6.434991 ], [ -72.57843, 6.497761 ], [ -72.592163, 6.56598 ], [ -72.545471, 6.623276 ], [ -72.548218, 6.918247 ], [ -72.432861, 6.877347 ], [ -72.358704, 6.93965 ], [ -72.322998, 7.024163 ], [ -72.281799, 7.024163 ], [ -72.268066, 6.983272 ], [ -72.213135, 7.032341 ], [ -72.045593, 7.032341 ], [ -72.174683, 7.261261 ], [ -72.163696, 7.323921 ], [ -72.213135, 7.383849 ], [ -72.419128, 7.392021 ], [ -72.446505956125904, 7.42677506444668 ], [ -72.487793, 7.479172 ], [ -72.454834, 7.544524 ], [ -72.4823, 7.650701 ], [ -72.47406, 7.765015 ], [ -72.438354, 7.819439 ], [ -72.49054, 7.930987 ], [ -72.463074, 7.950029 ], [ -72.419128, 8.042505 ], [ -72.36145, 8.012588 ], [ -72.344971, 8.075138 ], [ -72.37793, 8.110488 ], [ -72.35321, 8.159429 ], [ -72.37793, 8.227393 ], [ -72.383423, 8.35785 ], [ -72.649841, 8.610487 ], [ -72.773437, 9.117962 ], [ -72.861328, 9.150503 ], [ -72.927246, 9.08813 ], [ -72.984924, 9.139656 ], [ -72.954712, 9.161349 ], [ -73.01239, 9.310453 ], [ -73.160706, 9.185752 ], [ -73.296661, 9.180533 ], [ -73.363953, 9.185955 ], [ -73.420258, 9.112741 ], [ -73.444977, 8.990684 ], [ -73.440857, 8.872657 ], [ -73.457336, 8.741018 ], [ -73.465162142654805, 8.72869985343281 ], [ -73.494415, 8.682648 ], [ -73.549347, 8.640561 ], [ -73.553467, 8.515632 ], [ -73.482056, 8.474885 ], [ -73.523254, 8.378434 ], [ -73.480682, 8.322726 ], [ -73.465162142654805, 8.33040506301338 ], [ -73.428497, 8.348543 ], [ -73.431244, 8.440926 ], [ -73.348846, 8.402889 ], [ -73.421631, 8.18682 ], [ -73.402405, 8.045428 ], [ -73.322754, 8.010072 ], [ -73.299408, 7.901267 ], [ -73.370819, 7.878142 ], [ -73.365326, 7.796514 ], [ -73.416138, 7.6999 ], [ -73.465162142654805, 7.68573113757749 ], [ -73.482056, 7.680847 ], [ -73.604279, 7.71487 ], [ -73.645477, 7.6999 ], [ -73.7883, 7.729839 ], [ -73.774567, 7.804677 ], [ -73.704529, 7.914869 ], [ -73.756714, 7.944792 ], [ -73.817139, 8.11613 ], [ -73.877563, 8.059026 ], [ -73.889923, 7.978794 ], [ -73.844604, 7.874061 ], [ -73.830872, 7.781547 ], [ -73.837738, 7.634572 ], [ -73.870697, 7.544729 ], [ -73.919242015738803, 7.4840470465869 ], [ -73.933868, 7.46576 ], [ -73.920135, 7.37452 ], [ -73.951721, 7.265552 ], [ -73.933868, 7.080246 ], [ -73.877563, 6.995744 ], [ -73.957214, 6.923496 ], [ -74.017639, 6.889413 ], [ -74.163208, 6.732394 ], [ -74.363708, 6.587808 ], [ -74.429626, 6.530507 ], [ -74.421387, 6.459554 ] ] ] } }', | |
5 => '{ "type": "Feature", "properties": { "Name": "Caldas", "description": null }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -76.16272, 4.953732 ], [ -76.080322, 4.975622 ], [ -76.036377, 4.909949 ], [ -76.014404, 4.847007 ], [ -75.942993, 4.866164 ], [ -75.942993, 4.825112 ], [ -75.970459, 4.795006 ], [ -75.890808, 4.73479 ], [ -75.742493, 4.707418 ], [ -75.742493, 4.633506 ], [ -75.896301, 4.628031 ], [ -75.904541, 4.584228 ], [ -75.871582, 4.507565 ], [ -75.879822, 4.452802 ], [ -75.822144, 4.359694 ], [ -75.82489, 4.274791 ], [ -75.783691, 4.151529 ], [ -75.709534, 4.137832 ], [ -75.629883, 4.313136 ], [ -75.613403, 4.414464 ], [ -75.544739, 4.548635 ], [ -75.366211, 4.649932 ], [ -75.418396, 4.723842 ], [ -75.418396, 4.797743 ], [ -75.374451, 4.849744 ], [ -75.368958, 4.945523 ], [ -75.344238, 5.011192 ], [ -75.363464, 5.087798 ], [ -75.338745, 5.123362 ], [ -75.195923, 5.142511 ], [ -75.143738, 5.147982 ], [ -75.121765, 5.224571 ], [ -75.031128, 5.287477 ], [ -74.893799, 5.287477 ], [ -74.783936, 5.273803 ], [ -74.741364, 5.349214 ], [ -74.696045, 5.42988 ], [ -74.690552, 5.476361 ], [ -74.693298, 5.570678 ], [ -74.661713, 5.674546 ], [ -74.697418, 5.753801 ], [ -74.718018, 5.756534 ], [ -74.766083, 5.685478 ], [ -74.86908, 5.693677 ], [ -74.877319, 5.719641 ], [ -75.006409, 5.70461 ], [ -75.025635, 5.673179 ], [ -75.114899, 5.637648 ], [ -75.125885, 5.565211 ], [ -75.150604, 5.551542 ], [ -75.16983, 5.521471 ], [ -75.233002, 5.505068 ], [ -75.254974, 5.470893 ], [ -75.344238, 5.451754 ], [ -75.38269, 5.59118 ], [ -75.423889, 5.604847 ], [ -75.404663, 5.649947 ], [ -75.443115, 5.682745 ], [ -75.504913, 5.658147 ], [ -75.61615, 5.72374 ], [ -75.617523, 5.505068 ], [ -75.71228, 5.505068 ], [ -75.754852, 5.513269 ], [ -75.831757, 5.514636 ], [ -75.894928, 5.469526 ], [ -76.013031, 5.468159 ], [ -76.136627, 5.42988 ], [ -76.265717, 5.345112 ], [ -76.308289, 5.28358 ], [ -76.3591, 5.26717 ], [ -76.240997, 5.04423 ], [ -76.231384, 5.005925 ], [ -76.16272, 4.953732 ] ] ] } }', | |
6 => '{ "type": "Feature", "properties": { "Name": "Ibague", "description": null }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -76.199799, 1.569269 ], [ -76.052856, 1.52534 ], [ -75.776825, 1.856159 ], [ -75.621643, 1.979686 ], [ -75.235748, 2.527203 ], [ -75.031128, 2.613633 ], [ -75.075073, 2.746697 ], [ -74.626007, 3.335006 ], [ -74.509277, 3.732503 ], [ -74.584808, 3.796908 ], [ -74.546356, 3.935295 ], [ -74.557343, 4.003795 ], [ -74.517517, 4.117492 ], [ -74.549103, 4.216107 ], [ -74.602661, 4.254454 ], [ -74.660339, 4.214738 ], [ -74.723511, 4.188715 ], [ -74.757843, 4.222955 ], [ -74.789429, 4.232542 ], [ -74.84024, 4.26678 ], [ -74.929504, 4.253085 ], [ -74.874573, 4.424254 ], [ -74.832001, 4.487235 ], [ -74.86496, 4.537889 ], [ -74.847107, 4.626868 ], [ -74.871826, 4.729521 ], [ -74.783936, 4.811633 ], [ -74.753723, 5.148187 ], [ -74.766083, 5.190586 ], [ -74.778442, 5.27264 ], [ -75.028381, 5.284947 ], [ -75.116272, 5.222041 ], [ -75.130005, 5.142716 ], [ -75.337372, 5.118096 ], [ -75.356598, 5.085267 ], [ -75.337372, 5.026446 ], [ -75.364838, 4.94436 ], [ -75.364838, 4.859527 ], [ -75.415649, 4.789738 ], [ -75.410156, 4.724047 ], [ -75.364838, 4.648768 ], [ -75.536499, 4.543365 ], [ -75.605164, 4.409193 ], [ -75.621643, 4.307863 ], [ -75.695801, 4.133928 ], [ -75.731506, 4.129614 ], [ -75.709534, 4.025508 ], [ -75.772705, 3.935089 ], [ -75.838623, 3.937829 ], [ -75.888062, 3.913168 ], [ -75.981445, 3.718593 ], [ -76.017151, 3.540424 ], [ -76.05835, 3.384154 ], [ -76.107788, 3.131877 ], [ -76.066589, 3.005716 ], [ -76.007538, 2.968893 ], [ -75.995178, 2.807051 ], [ -75.901794, 2.613633 ], [ -75.852356, 2.455859 ], [ -75.914154, 2.411954 ], [ -75.947113, 2.431163 ], [ -76.004791, 2.4833 ], [ -76.072083, 2.472324 ], [ -76.15448, 2.373535 ], [ -76.238251, 2.396861 ], [ -76.313782, 2.388628 ], [ -76.323395, 2.320022 ], [ -76.418152, 2.284345 ], [ -76.365967, 2.127906 ], [ -76.408539, 2.070266 ], [ -76.555481, 2.134767 ], [ -76.639252, 2.103203 ], [ -76.604919, 1.860276 ], [ -76.482697, 1.814981 ], [ -76.464844, 1.637907 ], [ -76.343994, 1.593979 ], [ -76.305542, 1.532204 ], [ -76.232758, 1.528086 ], [ -76.199799, 1.569269 ] ] ] } }', | |
7 => '{ "type": "Feature", "properties": { "Name": "Cali", "description": null }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -75.517408251356102, -0.0 ], [ -75.428009, -0.068871 ], [ -75.283813, -0.082603 ], [ -75.208282, -0.016685 ], [ -75.130005, -0.027672 ], [ -74.967636534702905, -0.141716625994707 ], [ -74.899292, -0.18972 ], [ -74.837494, -0.132042 ], [ -74.785309, -0.191093 ], [ -74.801788, -0.288596 ], [ -74.691925, -0.313315 ], [ -74.532623, -0.457507 ], [ -74.392548, -0.567366 ], [ -73.924255, -0.410816 ], [ -74.078064, -0.373738 ], [ -74.152222, -0.239158 ], [ -74.271698, -0.262504 ], [ -74.392548, -0.151268 ], [ -74.536743, -0.170494 ], [ -74.64386, -0.151268 ], [ -74.700161443843001, 0.0 ], [ -74.757843, 0.154976 ], [ -75.033875, 0.226386 ], [ -75.047607, 0.458468 ], [ -75.28656, 0.524384 ], [ -75.28656, 0.661706 ], [ -75.412903, 0.674064 ], [ -75.60791, 0.804516 ], [ -75.765839, 0.811382 ], [ -75.967712, 1.046184 ], [ -76.132507, 1.042064 ], [ -76.335754, 1.291951 ], [ -76.227264, 1.521222 ], [ -76.305542, 1.526713 ], [ -76.352234, 1.588488 ], [ -76.47583, 1.636534 ], [ -76.48819, 1.810863 ], [ -76.613159, 1.863022 ], [ -76.648865, 2.11281 ], [ -76.562347, 2.147118 ], [ -76.407166, 2.085363 ], [ -76.376953, 2.133395 ], [ -76.430511, 2.291206 ], [ -76.331635, 2.328255 ], [ -76.317902, 2.399605 ], [ -76.25061, 2.410582 ], [ -76.1586, 2.385884 ], [ -76.074829, 2.480556 ], [ -76.002045, 2.491532 ], [ -75.915527, 2.425674 ], [ -75.863342, 2.465463 ], [ -75.911407, 2.612261 ], [ -76.002045, 2.808422 ], [ -76.013031, 2.96615 ], [ -76.072083, 3.00455 ], [ -76.116028, 3.138939 ], [ -75.991058, 3.727021 ], [ -75.893555, 3.924334 ], [ -75.839996, 3.951735 ], [ -75.778198, 3.947625 ], [ -75.72052, 4.033933 ], [ -75.738373, 4.133928 ], [ -75.787811, 4.146256 ], [ -75.838623, 4.273627 ], [ -75.835876, 4.370854 ], [ -75.889435, 4.448899 ], [ -75.886688, 4.514616 ], [ -75.912781, 4.592646 ], [ -75.900421, 4.639187 ], [ -75.752106, 4.644662 ], [ -75.750732, 4.70078 ], [ -75.894928, 4.728153 ], [ -75.977325, 4.799317 ], [ -75.952606, 4.829423 ], [ -75.947113, 4.860896 ], [ -76.022644, 4.845844 ], [ -76.040497, 4.904682 ], [ -76.045351429685994, 4.9112779167127 ], [ -76.085815, 4.966251 ], [ -76.16272, 4.948465 ], [ -76.173706, 4.955305 ], [ -76.195073825614003, 4.91443467624676 ], [ -76.242371, 4.823949 ], [ -76.353607, 4.777421 ], [ -76.449738, 4.643293 ], [ -76.519775, 4.425624 ], [ -76.589813, 4.402347 ], [ -76.545868, 4.247607 ], [ -76.452484, 4.175019 ], [ -76.585693, 4.06544 ], [ -76.808167, 3.990095 ], [ -77.003174, 4.114752 ], [ -77.11441, 4.103794 ], [ -77.196808, 4.177758 ], [ -77.250366, 4.158583 ], [ -77.290192, 4.221586 ], [ -77.350616, 4.177758 ], [ -77.527771, 4.205151 ], [ -77.514038, 4.132559 ], [ -77.465973, 4.087357 ], [ -77.433014, 4.088727 ], [ -77.424774, 4.013384 ], [ -77.35199, 3.942145 ], [ -77.257233, 4.101055 ], [ -77.187195, 4.053111 ], [ -77.310791, 3.932555 ], [ -77.276459, 3.853088 ], [ -77.198181, 3.843496 ], [ -77.089691, 3.883231 ], [ -77.158356, 3.787316 ], [ -77.192688, 3.754429 ], [ -77.198181, 3.648906 ], [ -77.240753, 3.58586 ], [ -77.294312, 3.551595 ], [ -77.358856, 3.48443 ], [ -77.34787, 3.430969 ], [ -77.376709, 3.437823 ], [ -77.395935, 3.373393 ], [ -77.453613, 3.345974 ], [ -77.545624, 3.24589 ], [ -77.497559, 3.241776 ], [ -77.501678, 3.191045 ], [ -77.541504, 3.211612 ], [ -77.671967, 3.048434 ], [ -77.698059, 2.967522 ], [ -77.659607, 2.981236 ], [ -77.678833, 2.938721 ], [ -77.706299, 2.893461 ], [ -77.629395, 2.881117 ], [ -77.687073, 2.856429 ], [ -77.757111, 2.802936 ], [ -77.735138, 2.785104 ], [ -77.78595, 2.737095 ], [ -77.794189, 2.663019 ], [ -77.820282, 2.700058 ], [ -77.879333, 2.69457 ], [ -78.023529, 2.649301 ], [ -78.164978, 2.690455 ], [ -78.373718, 2.634211 ], [ -78.504181, 2.4833 ], [ -78.622284, 2.3063 ], [ -78.677216, 2.166331 ], [ -78.64563, 2.062032 ], [ -78.644257, 1.992038 ], [ -78.601685, 2.013997 ], [ -78.542633, 1.928903 ], [ -78.5495, 1.825962 ], [ -78.582458, 1.760076 ], [ -78.638763, 1.784784 ], [ -78.821411, 1.819099 ], [ -78.940887, 1.761449 ], [ -79.031525, 1.642025 ], [ -79.037018, 1.59947 ], [ -78.847504, 1.533577 ], [ -78.852997, 1.470427 ], [ -78.803558, 1.429242 ], [ -78.704681, 1.344123 ], [ -78.673096, 1.293324 ], [ -78.601685, 1.237033 ], [ -78.468475, 1.17113 ], [ -78.381958, 1.069526 ], [ -78.251495, 1.020095 ], [ -78.082581, 0.895143 ], [ -77.975464, 0.815501 ], [ -77.838135, 0.799023 ], [ -77.809296, 0.822367 ], [ -77.717285, 0.837472 ], [ -77.65686, 0.799023 ], [ -77.654114, 0.716633 ], [ -77.56485, 0.653466 ], [ -77.483826, 0.609524 ], [ -77.470093, 0.413151 ], [ -77.401428, 0.36646 ], [ -77.371216, 0.387059 ], [ -77.262726, 0.352728 ], [ -77.132263, 0.381566 ], [ -77.092438, 0.304663 ], [ -77.052612, 0.281318 ], [ -76.864471, 0.249732 ], [ -76.762848, 0.259345 ], [ -76.728516, 0.279944 ], [ -76.599426, 0.238746 ], [ -76.574707, 0.251105 ], [ -76.400299, 0.255225 ], [ -76.400299, 0.388432 ], [ -76.278076, 0.440616 ], [ -76.195679, 0.395299 ], [ -76.135254, 0.400792 ], [ -76.095428, 0.348608 ], [ -76.026764, 0.341741 ], [ -75.776825, 0.080818 ], [ -75.613403, 0.073952 ], [ -75.517408251356102, -0.0 ] ] ] } }' | |
]; | |
foreach ($departments as $id => $department) { | |
$geoShape = json_decode($department, true); | |
$item = [ | |
'type' => 'city', | |
'name' => $geoShape['properties']['Name'], | |
'zone' => $geoShape['geometry'] | |
]; | |
//print_r($geoShape); | |
//exit(); | |
$params = [ | |
'index' => 'cities', | |
'id' => $id, | |
'body' => $item | |
]; | |
$response = $client->index($params); | |
print_r($response); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GET /cities/_search | |
{ | |
"_source": ["name", "type"], | |
"query": { | |
"bool": { | |
"must": [ | |
{ | |
"fuzzy": { | |
"name": "medlln" | |
} | |
}, | |
{"match_all": {}} | |
], | |
"filter": { | |
"geo_shape": { | |
"zone": { | |
"relation": "intersects", | |
"shape": { | |
"coordinates": [ | |
-75.581212, | |
6.244203 | |
], | |
"type": "point" | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment