How to efficiently search SQL CE for nearby road junctions?

I have the following query:

var nodes = DB.Nodes
              .Where(x =>    x.Lon > 486400
                          && x.Lon < 486600
                          && x.Lat > 5025100
                          && x.Lat < 5025300)
              .Join(DB.RoadNodes, x => x.Id, y => y.NodeId, (x, y) => x);

This searches for all nodes in the DB.Nodesvicinity of a specific location, then checks if the node is a road connection by taking a connection to DB.RoadNodes; however, it takes a few seconds, which is slow.

Seems like I need to do two things here:

  • Optimize the part Wherethat takes ~5seconds on its own, have I heard something about Spatial?

  • Optimize the part Jointhat takes the remaining ~15seconds on its own, I need an index, right?

I have two questions:

  • How can I perform spatial storage and search in SQL Server Compact Edition?

    If this is unsupported, how can I solve this problem?

  • , ?

    , NodeId RoadNodes .

, SQL CE, Windows Phone 7.

node, Unique() , , , , . , , , -?

+2

All Articles