Yo can access to the centroid of each pixel as doc says with ST_PixelAsCentroids (postgis 2.1)
SELECT x, y, val, ST_AsText(geom) FROM (SELECT (ST_PixelAsCentroids(rast, 1)).* FROM dummy_rast WHERE rid = 2) foo;
x | y | val | st_astext
---+---+-----+--------------------------------
1 | 1 | 253 | POINT(3427927.775 5793243.975)
2 | 1 | 254 | POINT(3427927.825 5793243.975)
Now you have the geom , and its trivial to split the lat/lon into separate columns if you want.
Use the GeoServer SQL view feature, and SQL's ST_Project like,
SELECT id,
ST_SetSRID(ST_MakeLine(
ST_MakePoint(lon,lat),
ST_Project(
ST_SetSRID(ST_MakePoint(lon,lat),4326)::geography,
distance,
pi()*azimuth/180.0)::geometry
),4326) AS geom
FROM mytable;
If you have long lines and want to plot them as great circles on a flat map, you might want to densify them with ST_Segmentize in geographic space to show them as great circles.
SELECT id,
ST_Segmentize(ST_SetSRID(ST_MakeLine(
ST_MakePoint(lon,lat),
ST_Project(
ST_SetSRID(ST_MakePoint(lon,lat),4326)::geography,
distance,
pi()*azimuth/180.0)::geometry
),4326)::geography,100000)::geometry AS geom
FROM mytable;
Added
SELECT id,
ST_SetSRID(ST_MakeLine(
ST_SetSRID(ST_MakePoint(lon,lat),4326),
ST_Project(
ST_SetSRID(ST_MakePoint(lon,lat),4326)::geography,
distance,
pi()*azimuth/180.0)::geometry
),4326) AS geom
FROM mytable
Best Answer
Use for example ST_Within:
You were vague on how you provide lat/lon, so the point construction may need tweaking. The 4326 is the SRID of the WGS84 projection.
Continuing from the comments, your projection is SR-ORG:15, very similar to 4269, so you can try with 4269 first or follow the PostGIS insertion link on the page to add it (if it isn't present already as 915).