|
|
@@ -11,7 +11,7 @@ function OPEN_LAYERS_WPS() {
|
|
|
|
|
|
$task = V::get('task', '', $_GET);
|
|
|
switch ($task) {
|
|
|
- case 'proxy':
|
|
|
+ case 'proxy': {
|
|
|
$url = V::get('url', '', $_GET);
|
|
|
// 1. http%3A%2F%2Fbiuro.biall-net.pl%2Fwps%3FSERVICE%3DWPS%26REQUEST%3DGetCapabilities
|
|
|
// 2. http%3A%2F%2Fbiuro.biall-net.pl%2Fwps%3FSERVICE%3DWPS%26REQUEST%3DDescribeProcess%26VERSION%3D1.0.0%26IDENTIFIER%3Dpozdrawiam
|
|
|
@@ -38,9 +38,76 @@ function OPEN_LAYERS_WPS() {
|
|
|
$wps->parseXMLRequest();
|
|
|
}
|
|
|
exit;
|
|
|
+
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'import_from_postgis': {
|
|
|
+
|
|
|
+ $gis_zas_id = 13102;
|
|
|
+ $pgDB = DB::getDB($gis_zas_id);
|
|
|
+
|
|
|
+ $db = DB::getDB();
|
|
|
+ // POSTGIS_to_MYSQL_Tables('BUILDINGS','geoportal_gml_punkty_adr_gml_id','MK_Budynki','geoportal_gml_punkty_adr_gml_id');
|
|
|
+
|
|
|
+ // function POSTGIS_to_MYSQL_Tables($local_table_mysql,$local_key,$remote_table_postgis,$remote_key){
|
|
|
+ // global $db,$gdb;
|
|
|
+ $local_table_mysql = 'BUILDINGS';
|
|
|
+ $local_key = 'geoportal_gml_punkty_adr_gml_id';
|
|
|
+ $remote_table_postgis = 'MK_Budynki';
|
|
|
+ $remote_key = 'geoportal_gml_punkty_adr_gml_id';
|
|
|
+ // BUG: ST_AsEWKT @see http://postgis.org/docs/ST_AsEWKT.html
|
|
|
+ $pgSql = <<<SQL
|
|
|
+ select "{$remote_key}"
|
|
|
+ -- , ST_AsEWKT(the_geom) as the_geom -- The WKT spec does not include the SRID. To get the OGC WKT format use ST_AsText
|
|
|
+ , ST_AsText(the_geom) as the_geom
|
|
|
+ from "{$remote_table_postgis}"
|
|
|
+ where "{$remote_key}"!=''
|
|
|
+ and "{$remote_key}" is not null
|
|
|
+ and the_geom != ''
|
|
|
+ and the_geom is not null
|
|
|
+SQL;
|
|
|
+ $pgRes = $pgDB->query($pgSql);
|
|
|
+ echo '<pre>';
|
|
|
+ echo "Start...\n";
|
|
|
+ while ($r = $pgDB->fetch($pgRes)) {
|
|
|
+ $r->{$remote_key} = trim($r->{$remote_key});
|
|
|
+ $sql = "update `{$local_table_mysql}` set `the_geom`=GeomFromText('{$r->the_geom}')
|
|
|
+ where `{$local_key}`='{$r->$remote_key}'
|
|
|
+ and `{$local_key}`!=''
|
|
|
+ and `{$local_key}` is not null
|
|
|
+ and (`the_geom`='' or `the_geom` is null)
|
|
|
+ ";
|
|
|
+ //echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">sql (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($sql);echo'</pre>';
|
|
|
+ echo "Fethed remote_key: {$remote_key}={$r->$remote_key}| ";
|
|
|
+
|
|
|
+ $testRow = null;
|
|
|
+ $testSql = "select t.`ID`, t.`{$local_key}`, AsWKT(t.`the_geom`) as the_geom from `{$local_table_mysql}` as t where t.`{$local_key}`='{$r->$remote_key}' ";
|
|
|
+ //echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">testSql (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($testSql);echo'</pre>';
|
|
|
+ $testRes = $db->query($testSql);
|
|
|
+ if ($testRow = $db->fetch($testRes)) {
|
|
|
+ echo " mysql row exists in table `{$local_table_mysql}` (ID={$testRow->ID}) ";
|
|
|
+ echo " | the_geom is ";
|
|
|
+ echo (!empty($testRow->the_geom))? " set " : " not set ";
|
|
|
+ } else {
|
|
|
+ echo " mysql row not exists in table `{$local_table_mysql}`! ";
|
|
|
+ }
|
|
|
+ //echo'<pre style="max-height:200px;overflow:auto;border:1px solid green;text-align:left;"> (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($testRow);echo'</pre>';
|
|
|
+
|
|
|
+ $res = $db->query($sql);
|
|
|
+ if (!$res) {
|
|
|
+ echo "| ERROR: problem with query!";
|
|
|
+ echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;display:none"> (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($sql);echo'</pre>';
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ echo "| done ";
|
|
|
+ }
|
|
|
+
|
|
|
+ echo "\n";
|
|
|
+ }
|
|
|
+ echo '</pre>';
|
|
|
break;
|
|
|
+ }
|
|
|
default:
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|