Database Design: Storing Map Locations When working on a game, I developed a database that used X/Y coordinates, roughly as:

CREATE TABLE Map
(
    MapId INT IDENTITY PRIMARY KEY,
    X INT NOT NULL,
    Y INT NOT NULL,
    North INT FOREIGN KEY REFERENCES Map(MapId),
    South INT FOREIGN KEY REFERENCES Map(MapId),
    East INT FOREIGN KEY REFERENCES Map(MapId),
    West INT FOREIGN KEY REFERENCES Map(MapId)
);


(I'm not at my editor, so that may have syntax errors.)

I then implemented the path searching algorithm (A*, specifically) inside a stored procedure.


Is there a better way to implement this coordinates system?  
I had implemented it in SQL Server, since that is what I had on hand and what I was familiar with.  Is there anything in another database system that would've simplified this problem?


It may make a difference to know that this, being a game, is strictly a grid system. That may simplify (or complicate) the problem.

Edit:

Some sample data:

map_id      x           y           north       east        south       west
----------- ----------- ----------- ----------- ----------- ----------- -----------
20          502         501         26          33          21          18
21          502         502         20          22          87          19
22          503         502         33          23          88          21
If the game area is strictly static, then my preference would be to use the coordinates as the primary key. 

On postgres, I'd probably do that using a composite type. I don't think there is a direct equivalent in SQL Server - hopefully someone will correct me if I'm wrong.

Whether this will simplify the problem or not depends on how exactly you have implemented your searching algorithm - can you post more details on that?