Re: Advice on Data



BigBadDom wrote:
If a
Location can have only one Location_Type (and/or only one
Coast_Type), it should be:

Map (*map_id*, map_name)
Location (*location_id*, &map_id&,
location_name,&location_type_id&,&coast_type_id&)
Location_Type (*location_type_id*, location_type_name)
Coast_Type (*coast_type_id*, coast_type_name)

Grtz,

Thx Grtz,

Huh? Who?

Each Location can only have one of many 'Location_type_id'

However there is a further constraint where I would like the
'location_type' and 'coast_type' to be dependant on the 'map_id' and
'location'.

Euhm, you're losing me here...
Perhaps a less abstract description of what you're trying to accomplish is
in order. I cannot for the life of me think how a location_type could be
map dependant. Sand is sand, water is water, wether it's on map A or map
Z.... A location can have a type, and a location can be on a map. Which map
should not be relevant to the type.

thus....

'Location' entity data example...
location_id map_id location_type_id
1 1 1
2 1 1
3 1 2
4 1 2
1 2 1
2 2 2
3 2 3

'Location_type' entity data example...

location_type_id map_id location_type_desc
1 1 Water
2 1 Grass
3 1 Forest
1 2 Water
2 2 Wetland
3 2 Grass
4 2 Rock

'location_type_id' and 'map_id' would be the joint primary key for the
'Location_type' entity.

Hardly workable, or are you trying to double data? You've got a list of
types (Water,Grass,Forest,Wetland, etc.). This is data you don't wish to
repeat, but give an ID, so you can reference this elsewhere.

So you'd have a table 'location_types:
1 Water
2 Grass
3 Forest
4 Wetland
5 Rock

If these ID's are now dependant on the specific map (so, on map A 3 is
forest, but on map B 3 is Grass, I seriously urge you to reconsider this,
and make types independant of maps. A simple transition now will save you a
lot of headache in the future.

And using the 'location_type_id' and 'map_id'
from the 'Location' entity I would be able to find the
'location_type_desc'

:-

Location Type for 'location 2' on 'map 1' = Water
Location Type for 'location 2' on 'map 2' = Wetland
Location Type for 'location 3' on 'map 2' = Grass
etc...

I would never, ever, give locations the same id, and let them depend on a
different 'map_id'. In would number all the locations continuously, and
also give them a map id. The point is id's are meant to be unique, at least
for the data they represent. So, it would be no problem to have a location
#23 and a location_type #23, but you're making it very difficult for
yourself when you have a different location #23 on map A, map B, etc..,
similar for having different location_type_id's for different maps.
--
Rik Wasmus


.



Relevant Pages

  • Re: Advice on Data
    ... location_type could be map dependant. ... Sand is sand, water is water, ... as 'locations' in games have very different aspects all ...
    (comp.lang.php)
  • Re: Advice on Data
    ... map dependant. ... Sand is sand, water is water, wether it's on map A or map ... I have a number of games, each game has a pre-defined associated map. ...
    (comp.lang.php)
  • Re: Things about Katrina and family
    ... > in trying to interpret water depth on the digital globe map. ... streets" and another that says "4' water in streets, ... Hopefully I have a little less that 4 feet of water. ...
    (rec.food.cooking)
  • Re: GPS Fish
    ... If you can lay your hands on a contour map of your ... > water, ... >>I bought a small handheld GPS unit earlier this year, ... I'm catching fish and eliminating a lot of useless ...
    (rec.outdoors.fishing.bass)
  • Re: Kensington runestone Vegetation)in the Scandinavian press
    ... marsh/swampland with water in the ground during most of 19th century from the first map up to the 1880's maps the area around the hight where the stone was found is marked swamp land. ... Nothing new with that map. ... Note that the water levels are modern and lower than the 19th century levels which are now being restored by the construction of dams. ...
    (sci.archaeology)