Point Class

A Point is a geometry that represents a single location in coordinate space.

Point Examples

  • Imagine a large-scale map of the world with many cities. A Point object could represent each city.

  • On a city map, a Point object could represent a bus stop.

Point Properties

  • X-coordinate value.

  • Y-coordinate value.

  • Point is defined as a zero-dimensional geometry.

  • The boundary of a Point is the empty set.

User Comments
  Posted by kristof kotai on June 21, 2012
set @p = GeomFromText('POINT(11 0)');
select x(@p), y(@p);
  Posted by ALEXANDER SKAKUNOV on March 21, 2013
Alternative to POINT data type is 2 simple float fields, "x" and "y", or "latitude" and "longitude" (an approach that we used in our http://astuce.com.ua/ project). It has its own benefit in search speed.

To speed up the spatial data lookup, a spatial index can be used, but you are forced to switch to MyISAM tables to be able to use it, which is not a case if you love InnoDB's foreign keys...

So a solution is 2 float fields + a separate index on them. This approach allows to easily filter points by a square of a desired size:

> FROM city
> WHERE city.lat BETWEEN @x-0.5 AND @x+0.5
> AND city.lng BETWEEN @y-0.5 AND @y+0.5;

That's is much faster.
Sign Up Login You must be logged in to post a comment.