Wednesday, 18 February 2015

postgis - Get relative north aligned point 2163 (US Equal Area)


What I'm trying to do is create a grid where the y axis is north aligned. I have a origin Lat/Lon point which is the bottom left corner of the grid and each cell should be 100 by 100 meters. So I projected my points to SRID 2163 (US Equal Area) and figured id use each the grid x,y values with the cell size relative to my origin point.


like this:



cell_bottom_left = { lon: origin.lon + (100 * x), lat: origin.lat + (100 * y)}
cell_top_left = { lon: origin.lon + (100 * x), lat: origin.lat + (100 * y) + 100}
cell_bottom_right= { lon: origin.lon + (100 * x) + 100, lat: origin.lat + (100 * y)}
cell_top_right = { lon: origin.lon + (100 * x) + 100, lat: origin.lat + (100 * y) + 100}

it worked fine, except the grid was tilted. I then found out that 2163 is not north aligned which explains what is happening here.


How would I go about creating a north aligned grid?



Answer



You'll need to change the projection of the map (but not necessarily the grid) to one in which north is orthogonal, such as Mercator. Note that changing the map projection will only change the way the image appears - it won't change the underlying data in the grid, so I assume you need an orthogonal grid for graphics reasons.


I'm not as familiar with PostGIS's method for displaying spatial data, so if there is no "map" with a projection, just reproject your grid to some form of Mercator, and I assume PostGIS will display it orthoganally.



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...