Created
October 23, 2012 02:05
-
-
Save paulreimer/3936258 to your computer and use it in GitHub Desktop.
Select geoJSON string from fix DB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
CONCAT('{ | |
"type": "LineString", | |
"coordinates": [', | |
`linestring`, | |
'], | |
"properties": { | |
"name": ', `quoted_sender`, ', | |
"popupContent": ', `quoted_sender`, | |
'}}') as `geoJSON` | |
FROM ( | |
SELECT | |
`sender`, | |
CONCAT('"', `sender`, '"') as `quoted_sender`, | |
GROUP_CONCAT(CONCAT('[', longitude, ',', latitude, ']') | |
ORDER BY time ASC SEPARATOR ', ') as `linestring` | |
FROM `beats` | |
WHERE sender = 'lunch1' | |
GROUP BY sender | |
) as `geometry`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
CONCAT('{ | |
"type": "LineString", | |
"coordinates": [', | |
`linestring`, | |
'], | |
"properties": { | |
"name": ', `quoted_sender`, ', | |
"popupContent": ', `quoted_sender`, | |
'}}') as `geoJSON` | |
FROM ( | |
SELECT | |
`sender`, | |
CONCAT('"', `sender`, '"') as `quoted_sender`, | |
GROUP_CONCAT(CONCAT('[', longitude, ',', latitude, ']') | |
ORDER BY time ASC SEPARATOR ', ') as `linestring` | |
FROM `beats` | |
WHERE sender = 'lunch1' | |
GROUP BY sender | |
) as `geometry`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment