Skip to content
  •  
  •  
  •  
13 changes: 11 additions & 2 deletions bgeo-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ public function name_features( $args, $assoc_args )
// iterate through the source, separate features
foreach ( $source->features as $k => $feature )
{

$feature_name = implode( ', ' , array_intersect_key( (array) $feature->properties, array_flip( $args->namekeys ) ) );
$geometry = bgeo()->new_geometry( $feature, 'json', TRUE );
$feature_name .= ' ' . self::centroid( $geometry )->latlon;
Expand Down Expand Up @@ -204,7 +203,17 @@ public function simplify_and_correlate( $args, $assoc_args )
$search_name = self::centroid( $geometry )->latlon;
foreach ( $args->namekeys as $name_key )
{
$search_name .= ' ' . str_replace( '|', ' ', preg_replace( '/[0-9]*/', '', $feature->properties->$name_key ) );
// skip this iteration if the name key is unset or empty
if (
! isset( $feature->properties->$name_key ) ||
empty( $feature->properties->$name_key )
)
{
continue;
}

// get the search name from the component keys named on the command line
$search_name .= ' ' . trim( str_replace( '|', ' ', preg_replace( '/[0-9]*/', '', $feature->properties->$name_key ) ) );
WP_CLI::line( "Searching for $search_name" );

$locations = bgeo()->admin()->posts()->locationlookup( $search_name );
Expand Down
2 changes: 2 additions & 0 deletions correlated-geos/Colloquial/12466964-Sundarban.geojson
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{"type":"Feature","properties":{"name":"Sundarban","woeid":"12466964"},
"geometry":{"type":"Polygon","coordinates":[[[89.87446299522,22.464399128192],[89.87531592111,22.555631545449],[89.874643347711,22.576309193982],[89.870118379743,22.715425158695],[89.881296941254,22.752459069535],[89.892667394558,22.790128706496],[89.901394977069,22.819042669371],[90.05237480644,22.977328613108],[90.127431653665,23.056017560806],[90.127431653665,23.056017560806],[90.142886222172,23.062039854465],[90.192814604909,23.081495809031],[90.224683008705,23.081113308463],[90.294809677471,23.080271613006],[90.492752156989,23.077895808074],[90.632384917749,23.012590241585],[90.681350615842,22.960516994713],[90.703243860008,22.937234322297],[90.710902348005,22.929089797626],[90.851467403161,22.65634236452],[90.976414118855,22.413900201759],[90.996849780999,22.215532299648],[90.965544148145,22.129474806498],[90.959409927814,22.122566485736],[90.926752485187,22.085787877087],[90.865270179675,22.051282542888],[90.779574285874,22.003187966237],[90.501751718108,21.847267324209],[90.343957231903,21.829670476204],[90.1729346959,21.810598469039],[90.002863372118,21.884005965701],[89.949426151772,21.951062288921],[89.863208601871,22.244832354396],[89.872347321234,22.423123539452],[89.87446299522,22.464399128192]]]}}
4 changes: 4 additions & 0 deletions correlated-geos/Colloquial/12492625-Timor.geojson
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{"type":"Feature","properties":{"name":"Timor","woeid":"12492625"},
"geometry":{"type":"Polygon","coordinates":[[[125.10428765555,-8.7484515459129],[125.10164839901,-8.7271909966116],[125.12780293706,-8.6505489980786],[125.16657751408,-8.6137581258343],[125.27633010328,-8.5765932620929],[125.49087931501,-8.5668541331877],[125.484448104,-8.5541782996956],[125.48256261019,-8.4004240198907],[125.48990624809,-8.3161171242608],[125.58087380409,-8.1685941012481],[125.63692378986,-8.1295548524026],[125.64666478595,-8.1317055339301],[125.64992536653,-8.1339855214793],[125.8107278293,-8.4018152367684],[125.82864805634,-8.4940428650194],[126.09391929891,-8.4819049958728],[126.14270459062,-8.4951579146396],[126.16047414936,-8.5092469311035],[126.16398438257,-8.4912725204022],[126.1854204906,-8.4788516090296],[126.47638938763,-8.412609756493],[126.47638938763,-8.412609756493],[126.47638938763,-8.412609756493],[126.57802477548,-8.4237633296047],[126.67848889291,-8.4347883662834],[126.68946840089,-8.4498932460997],[126.68948953426,-8.4065155853977],[126.70447747671,-8.3932527247246],[126.94089703738,-8.2981366156414],[127.18115073037,-8.3072777032142],[127.28145803506,-8.3526842910031],[127.31924819435,-8.3908869257735],[127.32659390309,-8.4114268855935],[127.32542002321,-8.4242407012058],[127.30261856263,-8.4639613883197],[126.98331894093,-8.7186720742221],[126.80785379936,-8.7741473097426],[126.71992979394,-8.7660889986174],[126.71089321333,-8.7949639870704],[126.70459537352,-8.8017601125084],[126.4030413194,-8.9769000122656],[126.17834945609,-9.0130527255889],[126.14731265614,-8.9905631300777],[126.14291227019,-9.002916135821],[126.12510763955,-9.0216398743951],[126.03940602382,-9.061346654611],[126.03947049137,-9.0615892730644],[125.87196809638,-9.1659987224023],[125.69195765579,-9.2031034314748],[125.67911630444,-9.2008481479627],[125.67027852944,-9.1859101867053],[125.4939824185,-9.2491321925345],[125.49168308347,-9.2490312700652],[125.48638520239,-9.2750592594712],[125.48458231836,-9.2774723614047],[125.24357342524,-9.4402396502342],[125.10355777315,-9.495685257026],[125.01992580818,-9.4508544069661],[124.99019114426,-9.4045999917998],[124.94547987498,-9.2825201129669],[124.95279856015,-9.1839351872495],[124.97437866578,-9.1651837086882],[125.36206939913,-9.0171300461124],[125.36761447958,-9.0167827175801],[125.40667669436,-9.0332444079384],[125.39947562431,-9.0127158186674],[125.40131266763,-8.9813596184304],[125.40239971769,-8.9789448148558],[125.42308574318,-8.9329922960679],[125.45503603466,-8.8903814783507],[125.47943406602,-8.8578428059721],[125.45245316656,-8.8364876720971],[125.44634147429,-8.8268127418501],[125.43758400494,-8.732304689138],[125.50395600711,-8.6431643969847],[125.29689241167,-8.741215844299],[125.16668536295,-8.7650477179658],[125.11158843388,-8.7532582814337],[125.10428765555,-8.7484515459129]]
,
[[125.51584456068,-8.6160603086273],[125.50874932687,-8.6367267740539],[125.51104428053,-8.6336445581594],[125.51897902811,-8.6229878701782],[125.51927210707,-8.6228571013096],[125.51928912825,-8.6228495066312],[125.51584456068,-8.6160603086273]]]}}
Loading