MGRS coordinates

From IMSMA Wiki
Revision as of 04:24, 12 February 2014 by Alnaucler (talk | contribs)
Jump to navigation Jump to search

The first query finds MGRS coordinates with the incorrect format of type 4qfj12345678 and the second query finds MGRS coordinates with blanks 4 QFJ 1234 5678.

SELECT geopoint.userenteredcoord, 
concat( upper(left(geopoint.userenteredcoord, locate('|', geopoint.userenteredcoord) -1)),right(geopoint.userenteredcoord,7))
FROM
geopoint
WHERE
geopoint.coordrefsys =  'MGRS' AND 
binary left(geopoint.userenteredcoord, 
locate('|', geopoint.userenteredcoord) -1) <> upper(left(geopoint.userenteredcoord, locate('|', geopoint.userenteredcoord) -1))
ORDER BY length(geopoint.userenteredcoord)

Note: This query is in 5.x format

---------------------------------------------------

SELECT
userenteredcoord
FROM
geopoint
WHERE
coordrefsys =  'MGRS' AND userenteredcoord LIKE '% %'
ORDER BY
userenteredcoord ASC

Note: This query is in 5.x format