2

What is wrong with that??

const string lonMin="-19";      
const string latMin = "25";
const string lonMax = "-24";
const string latMax = "25.6";

//Create a polygon
var geoEncuadre = DbGeography.FromText("POLYGON ((" + lonMin + " " + latMin + "," +
            lonMax + " " + latMin + ","+ lonMax + " "+ latMax +","+lonMin+" " + latMax +","+lonMin + " "+latMin +  "))", 4326);
//Check for every node if intersects with the polygon
var nodos = (from n in _bd.Nodo
             where n.Geo.Intersects(geoEncuadre)
             select n).ToList();

This throws an EntityCommandExecutionException. It´s weird because if I use DbGeometry instead DbGeography it works fine. What happen with the DbGeography and the Intersect operation?

Pedraz
  • 148
  • 1
  • 9
  • 1
    Ok, I got it. As use to happen is the most silly thing, the lonMax and lonMin are mistaken. Anyway I post an interesting link about some usual problems with the order in the creation of the Geography Polygons [here](http://blog.tallan.com/2012/04/10/new-spatial-features-in-sql-server-2012/) – Pedraz Nov 05 '12 at 15:28

0 Answers0