Find postal code of a point using boundaries dataset
Locates the postal code of a point (latitude, longitude) in our boundaries dataset (MS SQL database) and display point location, the postal code, and renders the postal code boundary.
Point and dataset
use EPSG:4326 (WGS84) datum.
Boundaries in MS SQL table
| ISO | Layer | Code | Geometry |
| EC | 7 | 170101 | MULTIPOLYGON (((-78.773484 0.240967, -78.77408 0.241195, -78.774288 0.241331, -78.774668 0.241622, ... ))) |
| EC | 7 | 170102 | MULTIPOLYGON (((-78.742842 0.233589, -78.743001 0.233924, -78.74309 0.234018, -78.743846 0.234508, ... ))) |
| EC | 7 | 170103 | MULTIPOLYGON (((-78.681238 0.221636, -78.681243 0.221663, -78.681271 0.221858, -78.681211 0.222046, ... ))) |
| EC | 7 | 170104 | MULTIPOLYGON (((-78.707162 0.146541, -78.707162 0.146541, -78.707206 0.14656, -78.707206 0.14656, ... ))) |
SQL code
DECLARE @point geography;
SET @point = geography::STGeomFromText('Point(-78.75953 -0.07531)', 4326 );
SELECT TOP (20) ISO,Code, Name, Geometry.ToString()
FROM Boundaries
WHERE ISO = 'EC' AND Layer = 7 AND @point.STIntersects(Geometry.MakeValid()) = 1
Map
Click on any location in Ecuador to display the postal code information and point selected.
| Reference data |
| Administrative divisions |
| Countries |
| Country names |
| Currencies |
| Languages |
| Postal code formats |
| Time zones |
| Formulas & samples |
| Distance between points |
| Locate points in a radius |
| Find postal code of a point |