In QGIS 3.6 I linked a SQL Server table with a field 'X' and a field 'Y', together representing positions in a known co-ordinate system.

How can I show these positions directly in QGIS, without having to use the tool 'Create points layer from table' in the Processing Toolbox (under 'Vector creation') and then using this points layer to view the data in the map?

  • create a view with the X,Y attributes converted into POINTS - ST_MAKEPOINT in postgis, sql-server must have a similar function. – Ian Turton Jun 14 '19 at 14:01
  • Thanks. Does such a function exist (or work) in SQL Server 2005, which has no spatial functionality? – SWP_IB Jun 17 '19 at 7:18

You can create a virtual layer in QGIS that builds the geometry. Changes to the data source should be reflected upon panning/refreshing the attribute table.

Go to the menu layer / Add layer / Add-Edit virtual layer and use MakePoint(longitude, latitude, CRS) to create the geometry :

select myID, myField, 
       MakePoint(myLong,myLat,3857) as geometry
from myTable

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.