2

I'm saving coordinates of places as Points which I get from Google API. I want to compute the distance between two of those points. I tried to use GeoCoordinate class for that, but the class requires lat and long in degrees. Is it possible to convert the points to degrees?

I tried this:

var pointA = DbGeography.FromText("POINT (34.061839 -118.133087)", 4326);`

But this is throwing the following error:

Latitude values must be between -90 and 90 degrees

Orace
  • 7,822
  • 30
  • 45
Arjun Menon
  • 553
  • 2
  • 8
  • 29

1 Answers1

2

The Longitude and Latitude are in the wrong order. POINT requires longitude first and then latitude:

DbGeography.FromText("POINT (-118.133087 34.061839)", 4326); 

(which is probably not the most intuitive order to put lat/lon points...)

jao
  • 18,273
  • 15
  • 63
  • 96