Browse Source

flip lat/lon

pull/12/head
Peter Johnson 10 years ago
parent
commit
613e7233af
  1. 4
      controller/suggest.js
  2. 4
      test/unit/controller/suggest.js

4
controller/suggest.js

@ -67,8 +67,8 @@ function geoJsonifyDocs( docs ){
// split payload geo string in to geojson properties // split payload geo string in to geojson properties
if( 'string' !== typeof doc.payload.geo ) return warning(); if( 'string' !== typeof doc.payload.geo ) return warning();
var geoParts = doc.payload.geo.split(','); var geoParts = doc.payload.geo.split(',');
doc.lat = parseFloat( geoParts[0] ); doc.lat = parseFloat( geoParts[1] );
doc.lng = parseFloat( geoParts[1] ); doc.lng = parseFloat( geoParts[0] );
// remove payload from doc // remove payload from doc
delete doc.payload; delete doc.payload;

4
test/unit/controller/suggest.js

@ -21,7 +21,7 @@ module.exports.tests.functional_success = function(test, common) {
type: 'Feature', type: 'Feature',
geometry: { geometry: {
type: 'Point', type: 'Point',
coordinates: [ -10.1, 101 ] coordinates: [ 101, -10.1 ]
}, },
properties: { properties: {
id: 'mockid', id: 'mockid',
@ -32,7 +32,7 @@ module.exports.tests.functional_success = function(test, common) {
type: 'Feature', type: 'Feature',
geometry: { geometry: {
type: 'Point', type: 'Point',
coordinates: [ -10.1, 101 ] coordinates: [ 101, -10.1 ]
}, },
properties: { properties: {
id: 'mockid', id: 'mockid',

Loading…
Cancel
Save