dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27138
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13460: Script
------------------------------------------------------------
revno: 13460
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
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