Skip to content

Commit

Permalink
Merge pull request #390 from DFE-Digital/correct-coordinate-system
Browse files Browse the repository at this point in the history
Use correct coordinate system in GeocodeClientAdapter
  • Loading branch information
ethax-ross authored Dec 2, 2020
2 parents 69752ab + f58371f commit fb065ef
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions GetIntoTeachingApi/Adapters/GeocodeClientAdapter.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System.Linq;
using System.Threading.Tasks;
using GeocodeSharp.Google;
using GetIntoTeachingApi.Database;
using GetIntoTeachingApi.Services;
using GetIntoTeachingApi.Utils;
using Microsoft.Extensions.Logging;
using NetTopologySuite;
using NetTopologySuite.Geometries;

namespace GetIntoTeachingApi.Adapters
Expand Down Expand Up @@ -41,10 +43,12 @@ public async Task<Point> GeocodePostcodeAsync(string postcode)
return null;
}

_metrics.GoogleApiCalls.WithLabels(postcode, "success").Inc();

_metrics.GoogleApiCalls.WithLabels(postcode, "success").Inc();

var location = result.Geometry.Location;
return new Point(new Coordinate(location.Longitude, location.Latitude));
var geometryFactory = NtsGeometryServices.Instance.CreateGeometryFactory(srid: DbConfiguration.Wgs84Srid);

return geometryFactory.CreatePoint(new Coordinate(location.Longitude, location.Latitude));
}
}
}

0 comments on commit fb065ef

Please sign in to comment.