SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,352 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello
I am trying to extract the x,y coordinates in british national grid (27700) for the centre of each polygon from the OS_NGD_LUS_FTS_SITE.SHAPE and export them as the fields x_coord and y_coord. My code is below, but not sure where to start so any advice taken.
SELECT
OS_NGD_LUS_FTS_SITE.OBJECTID, OS_NGD_LUS_FTS_SITE.osid AS LUS_OSID, OS_NGD_LUS_FTS_SITE.description, OS_NGD_LUS_FTS_SITE.name1_text, OS_NGD_LUS_FTS_SITE.geometry_area, OS_NGD_LUS_FTS_SITE.primaryuprn, OS_NGD_LUS_FTS_SITE.SHAPE, LR_NSDC_LAND_OWNERSHIP.Title_Number
FROM
OS_NGD_LUS_FTS_SITE join LR_NSDC_LAND_OWNERSHIP
on OS_NGD_LUS_FTS_SITE.SHAPE.STIntersects(LR_NSDC_LAND_OWNERSHIP.SHAPE) = 1
WHERE description = 'Allotments' and primaryuprn is null
ORDER BY description ASC
Maybe like this:
select
OS_NGD_LUS_FTS_SITE.SHAPE.STCentroid().STX as x_coord,
OS_NGD_LUS_FTS_SITE.SHAPE.STCentroid().STY as y_coord
from . . .