PROJ
Reproject coordinates between CRSs and measure geodesic distances on the WGS84 ellipsoid
- Connector software
- Free and open source
- Service credentials
- Not needed
- Query Farm hosting
- Available · $10/month organization minimum
Use with an agent
Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.
npx skills add Query-farm/vgi-skills --skill orchard
Copy this request into your coding agent to get started.
Use https://query.farm/products/orchard/connectors/proj/index.md to help me query PROJ with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.
See what you can query
Example output · captured
- Connector release
- v0.5.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
WITH eye AS (SELECT proj.main.transform(530600.0, 179700.0, 'EPSG:27700', 'EPSG:4326') AS o), sites(site, easting, northing) AS (VALUES ('Edinburgh Castle', 325160.0, 673490.0), ('Cardiff Castle', 318080.0, 176540.0), ('York Minster', 460350.0, 452230.0)), ll AS (SELECT site, proj.main.transform(easting, northing, 'EPSG:27700', 'EPSG:4326') AS p FROM sites) SELECT site, round(p.x, 4) AS lon, round(p.y, 4) AS lat, round(proj.main.geodesic_distance(o.x, o.y, p.x, p.y) / 1000, 1) AS km_from_london_eye
FROM ll
CROSS JOIN eye
ORDER BY km_from_london_eye
| site | lon | lat | km_from_london_eye |
|---|---|---|---|
| Cardiff Castle | -3.1811 | 51.4819 | 212.6 |
| York Minster | -1.0816 | 53.9626 | 281.5 |
| Edinburgh Castle | -3.2 | 55.9486 | 535 |
Quick start
Choose where to run PROJ, then follow the steps below.
The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.
1. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
2. Attach the connector
Attach with uvx
Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.
ATTACH 'proj' AS proj (
TYPE vgi,
LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-proj-worker'
);
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'proj' AS proj (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-proj:0.5.0'
);
3. Run a query
WITH eye AS (SELECT proj.main.transform(530600.0, 179700.0, 'EPSG:27700', 'EPSG:4326') AS o), sites(site, easting, northing) AS (VALUES ('Edinburgh Castle', 325160.0, 673490.0), ('Cardiff Castle', 318080.0, 176540.0), ('York Minster', 460350.0, 452230.0)), ll AS (SELECT site, proj.main.transform(easting, northing, 'EPSG:27700', 'EPSG:4326') AS p FROM sites) SELECT site, round(p.x, 4) AS lon, round(p.y, 4) AS lat, round(proj.main.geodesic_distance(o.x, o.y, p.x, p.y) / 1000, 1) AS km_from_london_eye
FROM ll
CROSS JOIN eye
ORDER BY km_from_london_eye
Run the connector on a server you manage. You operate the service and choose who can connect.
1. Deploy the connector on your server
Follow the connector’s deployment instructions. Use its supported HTTP transport, or launch it remotely over SSH. The connection guide explains both options.
2. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach the connector
For an HTTP deployment, replace the example URL with your endpoint. Add the authentication options your deployment requires. For SSH, use the SSH connection instructions.
ATTACH 'proj' AS proj
(TYPE vgi, LOCATION 'https://your-connector.example.com');
4. Run a query
WITH eye AS (SELECT proj.main.transform(530600.0, 179700.0, 'EPSG:27700', 'EPSG:4326') AS o), sites(site, easting, northing) AS (VALUES ('Edinburgh Castle', 325160.0, 673490.0), ('Cardiff Castle', 318080.0, 176540.0), ('York Minster', 460350.0, 452230.0)), ll AS (SELECT site, proj.main.transform(easting, northing, 'EPSG:27700', 'EPSG:4326') AS p FROM sites) SELECT site, round(p.x, 4) AS lon, round(p.y, 4) AS lat, round(proj.main.geodesic_distance(o.x, o.y, p.x, p.y) / 1000, 1) AS km_from_london_eye
FROM ll
CROSS JOIN eye
ORDER BY km_from_london_eye
Query Farm operates PROJ for your team. Hosting has a $10 monthly minimum per organization; usage counts toward it. From $2.97 per instance-month ($10 monthly minimum).
1. Create your hosted connector
Open the console, choose your organization and deployment size, and add any service credentials there.
2. Install the vgi extension
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach your deployment
Copy the ATTACH statement from your deployment in the console and run it in DuckDB or Haybarn. Use proj as the catalog alias for the query below.
4. Run a query
WITH eye AS (SELECT proj.main.transform(530600.0, 179700.0, 'EPSG:27700', 'EPSG:4326') AS o), sites(site, easting, northing) AS (VALUES ('Edinburgh Castle', 325160.0, 673490.0), ('Cardiff Castle', 318080.0, 176540.0), ('York Minster', 460350.0, 452230.0)), ll AS (SELECT site, proj.main.transform(easting, northing, 'EPSG:27700', 'EPSG:4326') AS p FROM sites) SELECT site, round(p.x, 4) AS lon, round(p.y, 4) AS lat, round(proj.main.geodesic_distance(o.x, o.y, p.x, p.y) / 1000, 1) AS km_from_london_eye
FROM ll
CROSS JOIN eye
ORDER BY km_from_london_eye
Technical details
- Verified connector release
- v0.5.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
- Verified on
- December 1, 2026
Pin a version for production
When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.
Attach with uvx
Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.
ATTACH 'proj' AS proj (
TYPE vgi,
LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-proj-worker'
);
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'proj' AS proj (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-proj:0.5.0'
);
Overview
CRS transforms (always_xy) + WGS84 geodesic distance/bearing via pyproj/PROJ.

Reproject coordinates between any two CRSs and measure accurate ellipsoidal distance and bearing directly in DuckDB SQL -- EPSG transforms, UTM and Web Mercator projection, and WGS84 geodesic geometry, powered by PROJ through pyproj.
The proj extension brings industry-standard geospatial coordinate math into your queries, so you never have to export points to a GIS tool or a Python notebook just to change projection or compute a great-circle distance. It is built for analysts, data engineers, and mapping developers who work with longitude/latitude points, EPSG-coded geometries, tile coordinates, or survey data and need correct, repeatable coordinate transformations next to the rest of their SQL. Every transformation is identified by a standard EPSG code or CRS string (for example EPSG:4326 for WGS84 longitude/latitude and EPSG:3857 for Web Mercator), so results match what PostGIS, QGIS, and other PROJ-based tools produce.
Under the hood the extension calls pyproj, the Python binding for the PROJ C library that is the de-facto standard for cartographic projections and datum transformations. The pyproj binary wheel bundles PROJ together with its data grids, so there is no separate native install and no external services or API keys -- the worker is fully offline and hermetic. Building a PROJ transformer is comparatively expensive, so transformers are cached and the common WGS84 <-> Web Mercator pipelines are warmed at startup, keeping per-row transforms fast. All coordinate input and output uses always_xy axis order (x/easting/longitude, y/northing/latitude) regardless of a CRS's declared native axis order, eliminating the classic lon/lat swap.
Capabilities
The worker's functions fall into a few capability areas: general CRS-to-CRS reprojection identified by EPSG code; convenience conversions to and from the Web Mercator tile projection and into a point's automatically selected UTM zone; accurate WGS84-ellipsoid geodesic distance and initial bearing between two longitude/latitude points; and lookups of a CRS's human-readable name and axis units alongside the bundled PROJ library version. Reprojection results come back as typed STRUCT coordinates, while the geodesic and metadata functions return plain metres, degrees, or strings. Because every CRS is named by its standard EPSG code and all transforms share the same always_xy axis convention, results line up with what PostGIS, QGIS, and other PROJ-based tools produce.
NULL or non-finite (and, where applicable, out-of-range) coordinates yield NULL, while an unknown CRS raises a clear query error.
Catalog
Everything proj exposes once attached — read straight from the worker's
released build.
main 8 functions
CRS transforms (always_xy) + WGS84 geodesic distance/bearing via pyproj/PROJ
Schema examples (12)
Transform a WGS84 lon/lat point to Web Mercator metres.
SELECT proj.main.transform(-122.42, 37.77, 'EPSG:4326', 'EPSG:3857');
Get the UTM zone number for a San Francisco lon/lat.
SELECT proj.main.to_utm(-122.42, 37.77).zone;
Project a WGS84 point to Web Mercator via the shorthand.
SELECT proj.main.to_webmercator(-122.4194, 37.7749);
Round-trip Web Mercator metres back to WGS84 lon/lat.
SELECT proj.main.from_webmercator(-13627665.27, 4547675.35);
8 more examples
Geodesic distance New York to London, in metres.
SELECT proj.main.geodesic_distance(-74.006, 40.7128, -0.1276, 51.5074);
Initial geodesic bearing from New York toward London, in degrees.
SELECT proj.main.geodesic_bearing(-74.006, 40.7128, -0.1276, 51.5074);
Human-readable name of the WGS84 CRS.
SELECT proj.main.crs_name('EPSG:4326');
Axis units of the Web Mercator CRS.
SELECT proj.main.crs_units('EPSG:3857');
Reproject British National Grid (EPSG:27700) easting/northing sites to WGS84 lon/lat and rank them by geodesic distance from the London Eye (Cardiff Castle 212.6 km, York Minster 281.5 km, Edinburgh Castle 535.0 km).
WITH eye AS (SELECT proj.main.transform(530600.0, 179700.0, 'EPSG:27700', 'EPSG:4326') AS o), sites(site, easting, northing) AS (VALUES ('Edinburgh Castle', 325160.0, 673490.0), ('Cardiff Castle', 318080.0, 176540.0), ('York Minster', 460350.0, 452230.0)), ll AS (SELECT site, proj.main.transform(easting, northing, 'EPSG:27700', 'EPSG:4326') AS p FROM sites) SELECT site, round(p.x, 4) AS lon, round(p.y, 4) AS lat, round(proj.main.geodesic_distance(o.x, o.y, p.x, p.y) / 1000, 1) AS km_from_london_eye
FROM ll
CROSS JOIN eye
ORDER BY km_from_london_eye;
| site | lon | lat | km_from_london_eye |
|---|---|---|---|
| Cardiff Castle | -3.1811 | 51.4819 | 212.6 |
| York Minster | -1.0816 | 53.9626 | 281.5 |
| Edinburgh Castle | -3.2 | 55.9486 | 535 |
Check straight-line UTM grid distances against the true WGS84 geodesic distance for three San Francisco survey segments (all in UTM zone 10): the grid figure runs 2.4-3.0 m short over these 6.6-7.9 km segments because of UTM's scale factor near the central meridian.
WITH segments(segment, lon1, lat1, lon2, lat2) AS (VALUES ('Ferry Building -> Golden Gate Bridge', -122.3937, 37.7955, -122.4783, 37.8199), ('Ferry Building -> Twin Peaks', -122.3937, 37.7955, -122.4477, 37.7544), ('Twin Peaks -> Golden Gate Bridge', -122.4477, 37.7544, -122.4783, 37.8199)), u AS (SELECT segment, lon1, lat1, lon2, lat2, proj.main.to_utm(lon1, lat1) AS a, proj.main.to_utm(lon2, lat2) AS b FROM segments) SELECT segment, a.zone AS utm_zone, round(sqrt(power(b.easting - a.easting, 2) + power(b.northing - a.northing, 2)), 1) AS utm_grid_m, round(proj.main.geodesic_distance(lon1, lat1, lon2, lat2), 1) AS geodesic_m
FROM u
ORDER BY segment;
Measure the true ground length of segments stored in Web Mercator (EPSG:3857) metres by converting their endpoints back to lon/lat: the same 5,000 Mercator metres is ~5,000 m near the equator (Quito) but only ~2,513 m at Oslo (lat 59.9).
WITH segments(segment, x1, y1, x2, y2) AS (VALUES ('Quito, 5 km east', -8738000.0, -24600.0, -8733000.0, -24600.0), ('Oslo, 5 km east', 1194000.0, 8381000.0, 1199000.0, 8381000.0)), ll AS (SELECT segment, x1, y1, x2, y2, proj.main.from_webmercator(x1, y1) AS a, proj.main.from_webmercator(x2, y2) AS b FROM segments) SELECT segment, round(a.lat, 2) AS lat, round(sqrt(power(x2 - x1, 2) + power(y2 - y1, 2))) AS mercator_m, round(proj.main.geodesic_distance(a.lon, a.lat, b.lon, b.lat)) AS geodesic_m
FROM ll
ORDER BY segment;
Distance (km) and initial compass bearing (degrees) from New York to five world cities, nearest first (London 5,585 km at 51 deg ... Sydney 15,988 km at 266 deg).
WITH destinations(city, lon, lat) AS (VALUES ('London', -0.1276, 51.5074), ('Paris', 2.3522, 48.8566), ('Tokyo', 139.6917, 35.6895), ('Sydney', 151.2093, -33.8688), ('Sao Paulo', -46.6333, -23.5505)) SELECT city, round(proj.main.geodesic_distance(-74.006, 40.7128, lon, lat) / 1000) AS distance_km, round(proj.main.geodesic_bearing(-74.006, 40.7128, lon, lat)) AS initial_bearing_deg
FROM destinations
ORDER BY distance_km;
crs_name (crs VARCHAR)
Human-readable name of a CRS (e.g. 'WGS 84'); unknown CRS -> error
Name of WGS84 ('WGS 84')
SELECT proj.crs_name('EPSG:4326');
crs_units (crs VARCHAR)
Unit name of a CRS's first axis (e.g. 'degree', 'metre'); unknown CRS -> error
Units of Web Mercator ('metre')
SELECT proj.crs_units('EPSG:3857');
from_webmercator (x DOUBLE, y DOUBLE)
Web Mercator (x, y) metres -> WGS84 STRUCT(lon, lat) (EPSG:3857->4326)
Web Mercator metres back to San Francisco lon/lat
SELECT proj.from_webmercator(-13627665.27, 4547675.35);
Measure the true ground length of segments stored in Web Mercator (EPSG:3857) metres by converting their endpoints back to lon/lat: the same 5,000 Mercator metres is ~5,000 m near the equator (Quito) but only ~2,513 m at Oslo (lat 59.9).
WITH segments(segment, x1, y1, x2, y2) AS (VALUES ('Quito, 5 km east', -8738000.0, -24600.0, -8733000.0, -24600.0), ('Oslo, 5 km east', 1194000.0, 8381000.0, 1199000.0, 8381000.0)), ll AS (SELECT segment, x1, y1, x2, y2, proj.main.from_webmercator(x1, y1) AS a, proj.main.from_webmercator(x2, y2) AS b FROM segments) SELECT segment, round(a.lat, 2) AS lat, round(sqrt(power(x2 - x1, 2) + power(y2 - y1, 2))) AS mercator_m, round(proj.main.geodesic_distance(a.lon, a.lat, b.lon, b.lat)) AS geodesic_m
FROM ll
ORDER BY segment;
geodesic_bearing (lon1 DOUBLE, lat1 DOUBLE, lon2 DOUBLE, lat2 DOUBLE)
Initial geodesic bearing (forward azimuth) from point 1 to point 2, degrees [0,360)
Initial bearing from New York toward London
SELECT proj.geodesic_bearing(-74.006, 40.7128, -0.1276, 51.5074);
Distance (km) and initial compass bearing (degrees) from New York to five world cities, nearest first (London 5,585 km at 51 deg ... Sydney 15,988 km at 266 deg).
WITH destinations(city, lon, lat) AS (VALUES ('London', -0.1276, 51.5074), ('Paris', 2.3522, 48.8566), ('Tokyo', 139.6917, 35.6895), ('Sydney', 151.2093, -33.8688), ('Sao Paulo', -46.6333, -23.5505)) SELECT city, round(proj.main.geodesic_distance(-74.006, 40.7128, lon, lat) / 1000) AS distance_km, round(proj.main.geodesic_bearing(-74.006, 40.7128, lon, lat)) AS initial_bearing_deg
FROM destinations
ORDER BY distance_km;
geodesic_distance (lon1 DOUBLE, lat1 DOUBLE, lon2 DOUBLE, lat2 DOUBLE)
Accurate ellipsoidal (WGS84) geodesic distance between two points, in metres
New York to London (~5,585,000 m)
SELECT proj.geodesic_distance(-74.006, 40.7128, -0.1276, 51.5074);
Distance (km) and initial compass bearing (degrees) from New York to five world cities, nearest first (London 5,585 km at 51 deg ... Sydney 15,988 km at 266 deg).
WITH destinations(city, lon, lat) AS (VALUES ('London', -0.1276, 51.5074), ('Paris', 2.3522, 48.8566), ('Tokyo', 139.6917, 35.6895), ('Sydney', 151.2093, -33.8688), ('Sao Paulo', -46.6333, -23.5505)) SELECT city, round(proj.main.geodesic_distance(-74.006, 40.7128, lon, lat) / 1000) AS distance_km, round(proj.main.geodesic_bearing(-74.006, 40.7128, lon, lat)) AS initial_bearing_deg
FROM destinations
ORDER BY distance_km;
to_utm (lon DOUBLE, lat DOUBLE)
Project WGS84 (lon, lat) into its auto-selected UTM zone as STRUCT(easting, northing, zone, hemisphere, epsg); NULL/out-of-range -> NULL
-
eastingDOUBLE
-
northingDOUBLE
-
zoneINTEGER
-
hemisphereVARCHAR
-
epsgINTEGER
UTM for San Francisco (zone 10N)
SELECT proj.to_utm(-122.42, 37.77);
UTM zone number for San Francisco (10)
SELECT proj.to_utm(-122.42, 37.77).zone;
Check straight-line UTM grid distances against the true WGS84 geodesic distance for three San Francisco survey segments (all in UTM zone 10): the grid figure runs 2.4-3.0 m short over these 6.6-7.9 km segments because of UTM's scale factor near the central meridian.
WITH segments(segment, lon1, lat1, lon2, lat2) AS (VALUES ('Ferry Building -> Golden Gate Bridge', -122.3937, 37.7955, -122.4783, 37.8199), ('Ferry Building -> Twin Peaks', -122.3937, 37.7955, -122.4477, 37.7544), ('Twin Peaks -> Golden Gate Bridge', -122.4477, 37.7544, -122.4783, 37.8199)), u AS (SELECT segment, lon1, lat1, lon2, lat2, proj.main.to_utm(lon1, lat1) AS a, proj.main.to_utm(lon2, lat2) AS b FROM segments) SELECT segment, a.zone AS utm_zone, round(sqrt(power(b.easting - a.easting, 2) + power(b.northing - a.northing, 2)), 1) AS utm_grid_m, round(proj.main.geodesic_distance(lon1, lat1, lon2, lat2), 1) AS geodesic_m
FROM u
ORDER BY segment;
to_webmercator (lon DOUBLE, lat DOUBLE)
WGS84 (lon, lat) -> Web Mercator STRUCT(x, y) in metres (EPSG:4326->3857)
San Francisco in Web Mercator metres
SELECT proj.to_webmercator(-122.4194, 37.7749);
transform (x DOUBLE, y DOUBLE, from_crs VARCHAR, to_crs VARCHAR)
Transform (x, y) from from_crs to to_crs as STRUCT(x, y); always_xy axis order. NULL coord -> NULL; unknown CRS -> error
WGS84 lon/lat to Web Mercator metres
SELECT proj.transform(-122.42, 37.77, 'EPSG:4326', 'EPSG:3857');
Reproject British National Grid (EPSG:27700) easting/northing sites to WGS84 lon/lat and rank them by geodesic distance from the London Eye (Cardiff Castle 212.6 km, York Minster 281.5 km, Edinburgh Castle 535.0 km).
WITH eye AS (SELECT proj.main.transform(530600.0, 179700.0, 'EPSG:27700', 'EPSG:4326') AS o), sites(site, easting, northing) AS (VALUES ('Edinburgh Castle', 325160.0, 673490.0), ('Cardiff Castle', 318080.0, 176540.0), ('York Minster', 460350.0, 452230.0)), ll AS (SELECT site, proj.main.transform(easting, northing, 'EPSG:27700', 'EPSG:4326') AS p FROM sites) SELECT site, round(p.x, 4) AS lon, round(p.y, 4) AS lat, round(proj.main.geodesic_distance(o.x, o.y, p.x, p.y) / 1000, 1) AS km_from_london_eye
FROM ll
CROSS JOIN eye
ORDER BY km_from_london_eye;
| site | lon | lat | km_from_london_eye |
|---|---|---|---|
| Cardiff Castle | -3.1811 | 51.4819 | 212.6 |
| York Minster | -1.0816 | 53.9626 | 281.5 |
| Edinburgh Castle | -3.2 | 55.9486 | 535 |
SELECT proj.main.transform(-122.42, 37.77, 'EPSG:4326', 'EPSG:3857') AS xy;
9 more examples
SELECT proj.main.to_utm(-122.42, 37.77) AS utm;
SELECT proj.main.to_webmercator(-122.4194, 37.7749) AS xy;
SELECT proj.main.from_webmercator(-13627665.27, 4547675.35) AS lonlat;
SELECT proj.main.geodesic_distance(-74.006, 40.7128, -0.1276, 51.5074) AS m;
SELECT proj.main.geodesic_bearing(-74.006, 40.7128, -0.1276, 51.5074) AS deg;
SELECT proj.main.crs_name('EPSG:4326') AS name;
SELECT proj.main.crs_units('EPSG:3857') AS units;
WITH segments(segment, x1, y1, x2, y2) AS (VALUES ('Quito, 5 km east', -8738000.0, -24600.0, -8733000.0, -24600.0), ('Oslo, 5 km east', 1194000.0, 8381000.0, 1199000.0, 8381000.0)), ll AS (SELECT segment, x1, y1, x2, y2, proj.main.from_webmercator(x1, y1) AS a, proj.main.from_webmercator(x2, y2) AS b FROM segments) SELECT segment, round(a.lat, 2) AS lat, round(sqrt(power(x2 - x1, 2) + power(y2 - y1, 2))) AS mercator_m, round(proj.main.geodesic_distance(a.lon, a.lat, b.lon, b.lat)) AS geodesic_m
FROM ll
ORDER BY segment;
WITH destinations(city, lon, lat) AS (VALUES ('London', -0.1276, 51.5074), ('Paris', 2.3522, 48.8566), ('Tokyo', 139.6917, 35.6895), ('Sydney', 151.2093, -33.8688), ('Sao Paulo', -46.6333, -23.5505)) SELECT city, round(proj.main.geodesic_distance(-74.006, 40.7128, lon, lat) / 1000) AS distance_km, round(proj.main.geodesic_bearing(-74.006, 40.7128, lon, lat)) AS initial_bearing_deg
FROM destinations
ORDER BY distance_km;
Try these queries
Transform a WGS84 lon/lat point to Web Mercator metres.
SELECT proj.main.transform(-122.42, 37.77, 'EPSG:4326', 'EPSG:3857')
Uses transform
Get the UTM zone number for a San Francisco lon/lat.
SELECT proj.main.to_utm(-122.42, 37.77).zone
Uses to_utm
Project a WGS84 point to Web Mercator via the shorthand.
SELECT proj.main.to_webmercator(-122.4194, 37.7749)
Uses to_webmercator
Round-trip Web Mercator metres back to WGS84 lon/lat.
SELECT proj.main.from_webmercator(-13627665.27, 4547675.35)
Uses from_webmercator
Geodesic distance New York to London, in metres.
SELECT proj.main.geodesic_distance(-74.006, 40.7128, -0.1276, 51.5074)
Uses geodesic_distance
Initial geodesic bearing from New York toward London, in degrees.
SELECT proj.main.geodesic_bearing(-74.006, 40.7128, -0.1276, 51.5074)
Uses geodesic_bearing
22 more examples in the Catalog, each listed under the table or function it uses.
Questions it can answer
Plain-English questions from the worker's agent test tasks. An AI agent with this catalog attached should answer each one with SQL.
- What is the official human-readable name of the coordinate reference system identified by EPSG code 4326?
- What are the linear axis units of the Web Mercator coordinate reference system, EPSG:3857?
- Which UTM zone number contains the WGS84 location at longitude -122.42, latitude 37.77? Return just the zone number.
PROJ is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.
Related workers
ArcGIS
Maps & places
Live ArcGIS feature queries, server summaries and raster sampling from service URLs worldwide
Geocode
Maps & places
Turn latitude/longitude into city, country, admin region and timezone offline, plus haversine distance
Vector tiles (MVT)
Maps & places
Decode PMTiles, MBTiles, XYZ and .mvt vector tiles into DuckDB rows with GEOMETRY columns