Monday, September 13, 2010

storing the polygons (areas) in the db

In a previous post, I referred to a mysql procedure that allowed a "contains" result to be obtained, that is, 'does a point lie within a polygon?'

Storing the polygons as spatial data is the only way to make this function work, AFAIK, but this data format presents another problem for me.



It has been decided that the polygon points (places on the perimeter that join to sides of the polygon) should actually be drawn from a preset list of map points. In other words, polygons may, and will, share points with other adjacent polygons. Moving 1 point will effectively adjust the polygons that use that point as part of its definition.

Now, if, for map purposes, each polygon is an array of pre-determined points but, for data purposes, its the actual points themselves then each polygon will have to have 2 lots of data, 1 for internal data representation and 1 for mapping purposes.

The internal data will be write-only, in that it will be stored and used only within the database using the previously mentioned procedure.

The mapping data (the array of points) will be stored and retrieved as needed and cross-referenced to the points information.

No comments:

Post a Comment