------------------------------------------------------------
revno: 13460
committer: Lars Helge Øverland <[email protected]>
branch nick: dhis2
timestamp: Sun 2013-12-29 16:07:20 +0100
message:
  Script
modified:
  resources/sql/div.sql


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to 
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'resources/sql/div.sql'
--- resources/sql/div.sql	2013-10-22 14:32:09 +0000
+++ resources/sql/div.sql	2013-12-29 15:07:20 +0000
@@ -1,4 +1,4 @@
-
+
 -- Delete all data values for category combo
 
 delete from datavalue where categoryoptioncomboid in (
@@ -110,6 +110,14 @@
 where coordinates like '[0%'
 and featuretype='Point';
 
+-- Fetch longitude/latitude from organisationunit
+
+select name, coordinates, 
+regexp_replace(coordinates, '\[(-?\d+\.?\d*)[,](-?\d+\.?\d*)\]', '\1') as longitude,
+regexp_replace(coordinates, '\[(-?\d+\.?\d*)[,](-?\d+\.?\d*)\]', '\2') as latitude 
+from organisationunit
+where featuretype='Point';
+
 -- Nullify coordinates with longitude outside range (adjust where clause values)
 
 update organisationunit set coordinates=null

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp

Reply via email to