Wednesday, 10 February 2016

coordinate system - The Logic Marker Moving with the Offset Function in QGIS 3.6.2


In QGIS the location of the marker can be changed, without changing the coordinates in the Attribute Table. This is done by changing the X or Y values in the Offset function, located in the Layer Styling panel.


enter image description here


When a positive value is adding to the X bar the Marker moves to the left, and vice versa. Just like a X-axis standard system. enter image description here


However, adding a negative value to the Y bar will move the Marker up. Which is opposite to the a Y-axis.


enter image description here


What is the logic that the offset function is working by?



Answer



In graphic design and computer programming, the origin is at the top/left corner of the screen or page, and the y-axis increases as you go down the page.



enter image description here


According to this question on Game Development SE, the reason for this is historical, going back to the way TVs with cathode ray tubes worked. Even though we don't use CRTs anymore, this plotting method is now common practice. This system is particularly confusing when you're working with a GIS, where map features have geospatial positions defined in a projected coordinate system where Y-coordinates increase as you go up/north.


In QGIS, this coordinate system is used for the symbol "offset" settings, as well as for positioning items in the print composer.


enter image description here


Try this alternate method to offset your points. This method only uses geospatial coordinates.


Use a Geometry Generator style. Choose "point" for the geometry type. Define the geometry with this expression:


make_point( $x + Xoffset,  $y + Yoffset)

Substitute your own offset values for the terms Xoffset and Yoffset. Offset amounts should be in the same units as those used by the point layer's coordinate reference system. In my example below, my points are in a CRS that uses feet. I added a "simple marker" at the feature's actual geographic location so you can see the offset of the "geometry generator" marker.


enter image description here



No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...