Space coordinates: Difference between revisions

From IMSMA Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This query finds invalid / space coordinates
This query finds invalid / space coordinates. The invalid coordinates need to be corrected.
<pre>
<pre>
SELECT  
SELECT  
Line 14: Line 14:
geopoint.userenteredcoord IS NULL
geopoint.userenteredcoord IS NULL
</pre>
</pre>
{{note| This query is in 5.x format}}
 
{{Note | If you get a result set from the query above the following queries will help you to identify to which object they belong.}}
 
'''Location'''
<pre>
SELECT
locationinfoversion.location_localid,
geopoint.longitude,
geopoint.latitude,
geopoint.userenteredcoord
FROM
geopoint
INNER JOIN locationinfoversion_has_geospatialinfo ON locationinfoversion_has_geospatialinfo.geospatialinfo_guid = geopoint.geospatialinfo_guid
INNER JOIN locationinfoversion ON locationinfoversion_has_geospatialinfo.locationinfoversion_guid = locationinfoversion.locationinfoversion_guid
WHERE
geopoint.longitude >  '180' OR
geopoint.latitude >  '90' OR
geopoint.longitude <  '-180' OR
geopoint.latitude <  '-90' OR
geopoint.latitude IS NULL OR
geopoint.longitude IS NULL OR
geopoint.userenteredcoord IS NULL
</pre>
 
'''Hazard'''
<pre>
SELECT
hazardinfoversion.hazard_localid,
geopoint.longitude,
geopoint.latitude,
geopoint.userenteredcoord
FROM
geopoint
INNER JOIN hazardinfoversion_has_geospatialinfo ON hazardinfoversion_has_geospatialinfo.geospatialinfo_guid = geopoint.geospatialinfo_guid
INNER JOIN hazardinfoversion ON hazardinfoversion_has_geospatialinfo.hazardinfoversion_guid = hazardinfoversion.hazardinfoversion_guid
WHERE
geopoint.longitude >  '80' OR
geopoint.latitude >  '90' OR
geopoint.longitude <  '-180' OR
geopoint.latitude <  '-90' OR
geopoint.latitude IS NULL OR
geopoint.longitude IS NULL OR
geopoint.userenteredcoord IS NULL
</pre>
 
'''Hazard Reduction'''
<pre>
SELECT
hazreducinfoversion.hazreduc_localid,
geopoint.longitude,
geopoint.latitude,
geopoint.userinputformat
FROM
geopoint
INNER JOIN hazreducinfoversion_has_geospatialinfo ON hazreducinfoversion_has_geospatialinfo.geospatialinfo_guid = geopoint.geospatialinfo_guid
INNER JOIN hazreducinfoversion ON hazreducinfoversion.hazreducinfoversion_guid = hazreducinfoversion_has_geospatialinfo.hazreducinfoversion_guid
WHERE
geopoint.longitude >  '180' OR
geopoint.latitude >  '90' OR
geopoint.longitude <  '-180' OR
geopoint.latitude <  '-90' OR
geopoint.latitude IS NULL OR
geopoint.longitude IS NULL OR
geopoint.userenteredcoord IS NULL
</pre>
 
'''Accident'''
<pre>
SELECT
accidentinfoversion.accident_localid,
geopoint.longitude,
geopoint.latitude
FROM
accidentinfoversion
INNER JOIN accidentinfoversion_has_geospatialinfo ON accidentinfoversion.accidentinfoversion_guid = accidentinfoversion_has_geospatialinfo.accidentinfoversion_guid
INNER JOIN geopoint ON accidentinfoversion_has_geospatialinfo.geospatialinfo_guid = geopoint.geospatialinfo_guid
WHERE
geopoint.longitude >  '180' OR
geopoint.latitude >  '90' OR
geopoint.longitude <  '-180' OR
geopoint.latitude <  '-90' OR
geopoint.latitude IS NULL OR
geopoint.longitude IS NULL OR
geopoint.userenteredcoord IS NULL
</pre>
 
'''Victim'''
<pre>
SELECT
victiminfoversion.victim_localid,
geopoint.longitude,
geopoint.latitude,
geopoint.userenteredcoord
FROM
geopoint
INNER JOIN victiminfoversion_has_geospatialinfo ON victiminfoversion_has_geospatialinfo.geospatialinfo_guid = geopoint.geospatialinfo_guid
INNER JOIN victiminfoversion ON victiminfoversion.victiminfoversion_guid = victiminfoversion_has_geospatialinfo.victiminfoversion_guid
WHERE
geopoint.longitude >  '180' OR
geopoint.latitude >  '90' OR
geopoint.longitude <  '-180' OR
geopoint.latitude <  '-90' OR
geopoint.latitude IS NULL OR
geopoint.longitude IS NULL OR
geopoint.userenteredcoord IS NULL
</pre>
 
'''MRE'''
<pre>
SELECT
mreinfoversion.mre_localid,
geopoint.longitude,
geopoint.latitude,
geopoint.userenteredcoord
FROM
geopoint
INNER JOIN mreinfoversion_has_geospatialinfo ON mreinfoversion_has_geospatialinfo.geospatialinfo_guid = geopoint.geospatialinfo_guid
INNER JOIN mreinfoversion ON mreinfoversion.mreinfoversion_guid = mreinfoversion_has_geospatialinfo.mreinfoversion_guid
WHERE
geopoint.longitude >  '180' OR
geopoint.latitude >  '90' OR
geopoint.longitude <  '-180' OR
geopoint.latitude <  '-90' OR
geopoint.latitude IS NULL OR
geopoint.longitude IS NULL OR
geopoint.userenteredcoord IS NULL
</pre>
 
'''QM'''
<pre>
SELECT
qainfoversion.qa_localid,
geopoint.longitude,
geopoint.latitude,
geopoint.userenteredcoord
FROM
geopoint
INNER JOIN qainfoversion_has_geospatialinfo ON qainfoversion_has_geospatialinfo.geospatialinfo_guid = geopoint.geospatialinfo_guid
INNER JOIN qainfoversion ON qainfoversion.qainfoversion_guid = qainfoversion_has_geospatialinfo.qainfoversion_guid
WHERE
geopoint.longitude >  '180' OR
geopoint.latitude >  '90' OR
geopoint.longitude <  '-180' OR
geopoint.latitude <  '-90' OR
geopoint.latitude IS NULL OR
geopoint.longitude IS NULL OR
geopoint.userenteredcoord IS NULL
</pre>
 
'''Country Structure'''
<pre>
SELECT
gazetteer.gazetteername,
geopoint.pointno,
geopoint.longitude,
geopoint.latitude
FROM
geopoint
Inner Join geospatialinfo ON geospatialinfo.geospatialinfo_guid = geopoint.geospatialinfo_guid
Inner Join gazetteer_has_geospatialinfo ON geospatialinfo.geospatialinfo_guid = gazetteer_has_geospatialinfo.geospatialinfo_guid
Inner Join gazetteer ON gazetteer.gazetteer_guid = gazetteer_has_geospatialinfo.gazetteer_guid
WHERE
geopoint.longitude >  '180' OR
geopoint.longitude <  '-180' OR
geopoint.latitude >  '90' OR
geopoint.latitude <  '-90' OR
geopoint.latitude IS NULL OR
geopoint.longitude IS NULL OR
geopoint.userenteredcoord IS NULL
</pre>
 
'''Organisation'''
<pre>
SELECT
organisation.orgname,
geopoint.pointno,
geopoint.longitude,
geopoint.latitude
FROM
geopoint
Inner Join geospatialinfo ON geospatialinfo.geospatialinfo_guid = geopoint.geospatialinfo_guid
Inner Join organisation_has_geospatialinfo ON organisation_has_geospatialinfo.geospatialinfo_guid = geospatialinfo.geospatialinfo_guid
Inner Join organisation ON organisation.org_guid = organisation_has_geospatialinfo.org_guid
WHERE
geopoint.longitude >  '180' OR
geopoint.longitude <  '-180' OR
geopoint.latitude >  '90' OR
geopoint.latitude <  '-90' OR
geopoint.latitude IS NULL OR
geopoint.longitude IS NULL OR
geopoint.userenteredcoord IS NULL
</pre>
 
'''Place'''
<pre>
SELECT
place.placename,
geopoint.pointno,
geopoint.longitude,
geopoint.latitude
FROM
geopoint
Inner Join geospatialinfo ON geospatialinfo.geospatialinfo_guid = geopoint.geospatialinfo_guid
Inner Join place_has_geospatialinfo ON place_has_geospatialinfo.geospatialinfo_guid = geospatialinfo.geospatialinfo_guid
Inner Join place ON place.place_guid = place_has_geospatialinfo.place_guid
WHERE
geopoint.longitude >  '180' OR
geopoint.longitude <  '-180' OR
geopoint.latitude >  '90' OR
geopoint.latitude <  '-90' OR
geopoint.latitude IS NULL OR
geopoint.longitude IS NULL OR
geopoint.userenteredcoord IS NULL
</pre>
 
'''Task'''
<pre>
SELECT
task.name,
geopoint.pointno,
geopoint.longitude,
geopoint.latitude
FROM
geopoint
Inner Join geospatialinfo ON geospatialinfo.geospatialinfo_guid = geopoint.geospatialinfo_guid
Inner Join task_has_geospatialinfo ON geospatialinfo.geospatialinfo_guid = task_has_geospatialinfo.geospatialinfo_guid
Inner Join task ON task_has_geospatialinfo.task_guid = task.guid
WHERE
geopoint.longitude >  '180' OR
geopoint.longitude <  '-180' OR
geopoint.latitude >  '90' OR
geopoint.latitude <  '-90' OR
geopoint.latitude IS NULL OR
geopoint.longitude IS NULL OR
geopoint.userenteredcoord IS NULL
</pre>


{{NavBox Upgrade}}
{{NavBox Upgrade}}


 
[[Category:NoPublic]]
[[Category:SQL Queries]]
[[Category:SQL Queries]]

Latest revision as of 19:54, 9 March 2016

This query finds invalid / space coordinates. The invalid coordinates need to be corrected.

SELECT 
geopoint.pointlocal_id, geopoint.pointno, geopoint.longitude, geopoint.latitude, geopoint.userenteredcoord
FROM
geopoint
INNER JOIN geospatialinfo ON geospatialinfo.geospatialinfo_guid = geopoint.geospatialinfo_guid
WHERE geopoint.longitude >  '180' OR 
geopoint.longitude <  '-180' OR
geopoint.latitude >  '90' OR 
geopoint.latitude <  '-90' OR 
geopoint.latitude IS NULL OR 
geopoint.longitude IS NULL OR 
geopoint.userenteredcoord IS NULL
If you get a result set from the query above the following queries will help you to identify to which object they belong.

Location

SELECT
locationinfoversion.location_localid,
geopoint.longitude,
geopoint.latitude,
geopoint.userenteredcoord
FROM
geopoint
INNER JOIN locationinfoversion_has_geospatialinfo ON locationinfoversion_has_geospatialinfo.geospatialinfo_guid = geopoint.geospatialinfo_guid
INNER JOIN locationinfoversion ON locationinfoversion_has_geospatialinfo.locationinfoversion_guid = locationinfoversion.locationinfoversion_guid
WHERE
geopoint.longitude >  '180' OR
geopoint.latitude >  '90' OR
geopoint.longitude <  '-180' OR
geopoint.latitude <  '-90' OR 
geopoint.latitude IS NULL OR 
geopoint.longitude IS NULL OR 
geopoint.userenteredcoord IS NULL

Hazard

SELECT
hazardinfoversion.hazard_localid,
geopoint.longitude,
geopoint.latitude,
geopoint.userenteredcoord
FROM
geopoint
INNER JOIN hazardinfoversion_has_geospatialinfo ON hazardinfoversion_has_geospatialinfo.geospatialinfo_guid = geopoint.geospatialinfo_guid
INNER JOIN hazardinfoversion ON hazardinfoversion_has_geospatialinfo.hazardinfoversion_guid = hazardinfoversion.hazardinfoversion_guid
WHERE
geopoint.longitude >  '80' OR
geopoint.latitude >  '90' OR
geopoint.longitude <  '-180' OR
geopoint.latitude <  '-90' OR 
geopoint.latitude IS NULL OR 
geopoint.longitude IS NULL OR 
geopoint.userenteredcoord IS NULL

Hazard Reduction

SELECT
hazreducinfoversion.hazreduc_localid,
geopoint.longitude,
geopoint.latitude,
geopoint.userinputformat
FROM
geopoint
INNER JOIN hazreducinfoversion_has_geospatialinfo ON hazreducinfoversion_has_geospatialinfo.geospatialinfo_guid = geopoint.geospatialinfo_guid
INNER JOIN hazreducinfoversion ON hazreducinfoversion.hazreducinfoversion_guid = hazreducinfoversion_has_geospatialinfo.hazreducinfoversion_guid
WHERE
geopoint.longitude >  '180' OR
geopoint.latitude >  '90' OR
geopoint.longitude <  '-180' OR
geopoint.latitude <  '-90' OR 
geopoint.latitude IS NULL OR 
geopoint.longitude IS NULL OR 
geopoint.userenteredcoord IS NULL

Accident

SELECT
accidentinfoversion.accident_localid,
geopoint.longitude,
geopoint.latitude
FROM
accidentinfoversion
INNER JOIN accidentinfoversion_has_geospatialinfo ON accidentinfoversion.accidentinfoversion_guid = accidentinfoversion_has_geospatialinfo.accidentinfoversion_guid
INNER JOIN geopoint ON accidentinfoversion_has_geospatialinfo.geospatialinfo_guid = geopoint.geospatialinfo_guid
WHERE
geopoint.longitude >  '180' OR
geopoint.latitude >  '90' OR
geopoint.longitude <  '-180' OR
geopoint.latitude <  '-90' OR 
geopoint.latitude IS NULL OR 
geopoint.longitude IS NULL OR 
geopoint.userenteredcoord IS NULL

Victim

SELECT
victiminfoversion.victim_localid,
geopoint.longitude,
geopoint.latitude,
geopoint.userenteredcoord
FROM
geopoint
INNER JOIN victiminfoversion_has_geospatialinfo ON victiminfoversion_has_geospatialinfo.geospatialinfo_guid = geopoint.geospatialinfo_guid
INNER JOIN victiminfoversion ON victiminfoversion.victiminfoversion_guid = victiminfoversion_has_geospatialinfo.victiminfoversion_guid
WHERE
geopoint.longitude >  '180' OR
geopoint.latitude >  '90' OR
geopoint.longitude <  '-180' OR
geopoint.latitude <  '-90' OR 
geopoint.latitude IS NULL OR 
geopoint.longitude IS NULL OR 
geopoint.userenteredcoord IS NULL

MRE

SELECT
mreinfoversion.mre_localid,
geopoint.longitude,
geopoint.latitude,
geopoint.userenteredcoord
FROM
geopoint
INNER JOIN mreinfoversion_has_geospatialinfo ON mreinfoversion_has_geospatialinfo.geospatialinfo_guid = geopoint.geospatialinfo_guid
INNER JOIN mreinfoversion ON mreinfoversion.mreinfoversion_guid = mreinfoversion_has_geospatialinfo.mreinfoversion_guid
WHERE
geopoint.longitude >  '180' OR
geopoint.latitude >  '90' OR
geopoint.longitude <  '-180' OR
geopoint.latitude <  '-90' OR 
geopoint.latitude IS NULL OR 
geopoint.longitude IS NULL OR 
geopoint.userenteredcoord IS NULL

QM

SELECT
qainfoversion.qa_localid,
geopoint.longitude,
geopoint.latitude,
geopoint.userenteredcoord
FROM
geopoint
INNER JOIN qainfoversion_has_geospatialinfo ON qainfoversion_has_geospatialinfo.geospatialinfo_guid = geopoint.geospatialinfo_guid
INNER JOIN qainfoversion ON qainfoversion.qainfoversion_guid = qainfoversion_has_geospatialinfo.qainfoversion_guid
WHERE
geopoint.longitude >  '180' OR
geopoint.latitude >  '90' OR
geopoint.longitude <  '-180' OR
geopoint.latitude <  '-90' OR 
geopoint.latitude IS NULL OR 
geopoint.longitude IS NULL OR 
geopoint.userenteredcoord IS NULL

Country Structure

SELECT
gazetteer.gazetteername,
geopoint.pointno,
geopoint.longitude,
geopoint.latitude
FROM
geopoint
Inner Join geospatialinfo ON geospatialinfo.geospatialinfo_guid = geopoint.geospatialinfo_guid
Inner Join gazetteer_has_geospatialinfo ON geospatialinfo.geospatialinfo_guid = gazetteer_has_geospatialinfo.geospatialinfo_guid
Inner Join gazetteer ON gazetteer.gazetteer_guid = gazetteer_has_geospatialinfo.gazetteer_guid
WHERE
geopoint.longitude >  '180' OR
geopoint.longitude <  '-180' OR
geopoint.latitude >  '90' OR
geopoint.latitude <  '-90' OR 
geopoint.latitude IS NULL OR 
geopoint.longitude IS NULL OR 
geopoint.userenteredcoord IS NULL

Organisation

SELECT
organisation.orgname,
geopoint.pointno,
geopoint.longitude,
geopoint.latitude
FROM
geopoint
Inner Join geospatialinfo ON geospatialinfo.geospatialinfo_guid = geopoint.geospatialinfo_guid
Inner Join organisation_has_geospatialinfo ON organisation_has_geospatialinfo.geospatialinfo_guid = geospatialinfo.geospatialinfo_guid
Inner Join organisation ON organisation.org_guid = organisation_has_geospatialinfo.org_guid
WHERE
geopoint.longitude >  '180' OR
geopoint.longitude <  '-180' OR
geopoint.latitude >  '90' OR
geopoint.latitude <  '-90' OR 
geopoint.latitude IS NULL OR 
geopoint.longitude IS NULL OR 
geopoint.userenteredcoord IS NULL

Place

SELECT
place.placename,
geopoint.pointno,
geopoint.longitude,
geopoint.latitude
FROM
geopoint
Inner Join geospatialinfo ON geospatialinfo.geospatialinfo_guid = geopoint.geospatialinfo_guid
Inner Join place_has_geospatialinfo ON place_has_geospatialinfo.geospatialinfo_guid = geospatialinfo.geospatialinfo_guid
Inner Join place ON place.place_guid = place_has_geospatialinfo.place_guid
WHERE
geopoint.longitude >  '180' OR
geopoint.longitude <  '-180' OR
geopoint.latitude >  '90' OR
geopoint.latitude <  '-90' OR 
geopoint.latitude IS NULL OR 
geopoint.longitude IS NULL OR 
geopoint.userenteredcoord IS NULL

Task

SELECT
task.name,
geopoint.pointno,
geopoint.longitude,
geopoint.latitude
FROM
geopoint
Inner Join geospatialinfo ON geospatialinfo.geospatialinfo_guid = geopoint.geospatialinfo_guid
Inner Join task_has_geospatialinfo ON geospatialinfo.geospatialinfo_guid = task_has_geospatialinfo.geospatialinfo_guid
Inner Join task ON task_has_geospatialinfo.task_guid = task.guid
WHERE
geopoint.longitude >  '180' OR
geopoint.longitude <  '-180' OR
geopoint.latitude >  '90' OR
geopoint.latitude <  '-90' OR 
geopoint.latitude IS NULL OR 
geopoint.longitude IS NULL OR 
geopoint.userenteredcoord IS NULL

{{#switch:|subgroup|child=|none=|#default=

}}{{#if:|}}{{#if:Upgrade Process|<td style="text-align:left;border-left-width:2px;border-left-style:solid;|{{#if:|}}}}{{#if:|{{#if:IMSMA Hub{{#switch:{{#if:|{{{border}}}|child}}|subgroup|child=|none=|#default=

}}{{#ifeq:|Template|{{#ifeq:{{#if:|{{{border}}}|child}}|child||{{#ifeq:{{#if:|{{{border}}}|child}}|subgroup||{{#switch:space coordinates

|doc
|sandbox
|testcases =
|#default = {{#switch:
 |plainlist
 |hlist
 |hlist hnum
 |hlist vcard
 |vcard hlist = 
 |#default = 
 }}
}}

}}}}}}|}}{{#if:|{{{group2}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list2}}}

}}{{#if:|{{#if:IMSMA Hub{{#switch:{{#if:|{{{border}}}|child}}|subgroup|child=|none=|#default=

}}{{#ifeq:|Template|{{#ifeq:{{#if:|{{{border}}}|child}}|child||{{#ifeq:{{#if:|{{{border}}}|child}}|subgroup||{{#switch:space coordinates

|doc
|sandbox
|testcases =
|#default = {{#switch:
 |plainlist
 |hlist
 |hlist hnum
 |hlist vcard
 |vcard hlist = 
 |#default = 
 }}
}}

}}}}}}|}}{{#if:|{{{group3}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list3}}}

}}{{#if:|{{#if:|{{{group4}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list4}}}

}}{{#if:|{{#if:|{{{group5}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list5}}}

}}{{#if:|{{#if:|{{{group6}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list6}}}

}}{{#if:|{{#if:|{{{group7}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list7}}}

}}{{#if:|{{#if:|{{{group8}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list8}}}

}}{{#if:|{{#if:|{{{group9}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list9}}}

}}{{#if:|{{#if:|{{{group10}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list10}}}

}}{{#if:|{{#if:|{{{group11}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list11}}}

}}{{#if:|{{#if:|{{{group12}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list12}}}

}}{{#if:|{{#if:|{{{group13}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list13}}}

}}{{#if:|{{#if:|{{{group14}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list14}}}

}}{{#if:|{{#if:|{{{group15}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list15}}}

}}{{#if:|{{#if:|{{{group16}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list16}}}

}}{{#if:|{{#if:|{{{group17}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list17}}}

}}{{#if:|{{#if:|{{{group18}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list18}}}

}}{{#if:|{{#if:|{{{group19}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list19}}}

}}{{#if:|{{#if:|{{{group20}}}<td style="text-align:left;border-left-width:2px;border-left-style:solid;|

{{{list20}}}

}}{{#if:|{{#if:IMSMA Hub{{#switch:{{#if:|{{{border}}}|child}}|subgroup|child=|none=|#default=

}}{{#ifeq:|Template|{{#ifeq:{{#if:|{{{border}}}|child}}|child||{{#ifeq:{{#if:|{{{border}}}|child}}|subgroup||{{#switch:space coordinates

|doc
|sandbox
|testcases =
|#default = {{#switch:
 |plainlist
 |hlist
 |hlist hnum
 |hlist vcard
 |vcard hlist = 
 |#default = 
 }}
}}

}}}}}}|}}

{{{below}}}

}}{{#switch:|subgroup|child=

|none=|#default=}}{{#ifeq:|Template|{{#ifeq:|child||{{#ifeq:|subgroup||{{#switch:space coordinates
|doc
|sandbox
|testcases =
|#default = {{#switch:hlist
 |plainlist
 |hlist
 |hlist hnum
 |hlist vcard
 |vcard hlist = 
 |#default = 
 }}
}}

}}}}}}