Skip to content

Instantly share code, notes, and snippets.

@diegomozqueda
Last active December 2, 2016 16:26
Show Gist options
  • Save diegomozqueda/f2b2bfa498561a03d4817db1523774d8 to your computer and use it in GitHub Desktop.
Save diegomozqueda/f2b2bfa498561a03d4817db1523774d8 to your computer and use it in GitHub Desktop.
MySQL, Query to generate GeoJson | MySQL, Consulta para generar GeoJson
SELECT
1 as id,
JSON_OBJECT(
'type', 'FeatureCollection',
'features',
JSON_OBJECT(
'type', 'Feature',
'properties',
JSON_OBJECT(
'clave', '1293',
'table-header', JSON_ARRAY('clave','Elemento'),
'table-body', JSON_ARRAY(JSON_ARRAY('053','Elemento 53'),JSON_ARRAY('054','Elemento 54'),JSON_ARRAY('070','Elemento 70')),
'color', 'blue',
'rank', '7',
'ascii', '71'
),
'geometry', ST_AsGeoJSON(ST_GeomFromText('POINT(11.11111 12.22222)'),2)
)
) as geojson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment