A Point is a PostGIS geometry subtype representing one position through X and Y coordinates in a selected coordinate system. Points model cities, landmarks, restaurants, hotels, and other locations. section 10.1.2 section 10.1
Use these PostGIS functions to create, inspect, transform, and compare points:
- Create a point with ST_MakePoint(x, y), then assign its spatial reference metadata with ST_SetSRID. section 10.5.1
- Transform coordinates with ST_Transform; extract coordinates with ST_X and ST_Y. section 10.5.1
- Find nearby points with ST_DWithin and calculate planar distance with ST_Distance. section 10.5.1
Find restaurants near a hotel
A point stored in Web Mercator can be used directly for proximity searches. This query selects restaurants within 500 meters, orders them by distance, and returns the five closest results: WITH roost_hotel AS ( SELECT way FROM florida.planet_osm_point WHERE name = 'Roost Apartment Hotel' AND tourism = 'hotel' ) SELECT p.name, p.amenity, round(ST_Distance(h.way, p.way)) AS distance_meters FROM roost_hotel AS h JOIN florida.planet_osm_point AS p ON ST_DWithin(h.way, p.way, 500) WHERE p.amenity = 'restaurant' ORDER BY distance_meters LIMIT 5; The results include Wagamama at 68 meters and Boulon Brasserie at 132 meters. section 10.5.1
Listing 10.11 Searching for the center of Tampa
SELECT name, ST_AsText(way) AS coordinates FROM florida.planet_osm_point WHERE name = 'Tampa' and place = 'city';
Inspect the Tampa city point as readable WKT before transforming its Web Mercator coordinates to longitude and latitude. section 10.5.1



