+ Reply to Thread
Results 1 to 19 of 19

Thread: Generate a grid of latitude values

  1. #1
    Todd McDonnell
    Join Date
    Apr 2010
    Posts
    3
    Points
    0
    Answers Provided
    0


    0

    Default Generate a grid of latitude values

    I need to convert a 30m elevation grid to a grid that gives values for the cell latitude rather than elevation.

    I tried converting the GRID to point, adding x,y data to the points, then converting back to GRID using the y-coordinate as the value, however, the large region I am working with is preventing the processes from completing successfully.

    Any advice will certainly be appreciated.

    Todd

  2. #2
    Sean McLaughlin
    Join Date
    Apr 2010
    Posts
    1
    Points
    0
    Answers Provided
    0


    0

    Default Re: Generate a grid of latitude values

    What is the area, or how large of an area is it?

  3. #3
    Luke Pinner
    Join Date
    Apr 2010
    Posts
    5
    Points
    0
    Answers Provided
    0


    0

    Default Re: Generate a grid of latitude values

    Is the grid in a geographic coordinate system?

    If so, just set your output extent and cell size (ArcToolbox environment settings or Spatial Analyst toolbar options) to match your DEM then use $$YMAP built in scalar variable in a SOMA/MOMA tool or Raster Calculator expression:

    E.g.
    C:\workspace\latgrid = $$YMAP


    Luke

    PS: For info...

    Built-in GRID scalar variables:
    $$NROWS: the number of rows in the analysis window
    $$NCOLS: the number of columns in the analysis window
    $$CELLSIZE: the current cell size specified in the analysis environment
    $$WX0: minimum x-map coordinate of the current analysis window
    $$WY0: minimum y-map coordinate of the current analysis window
    $$WX1: maximum x-map coordinate of the current analysis window
    $$WY1: maximum y-map coordinate of the current analysis window
    $$XMAP: x-map coordinate for the center of the processing cell
    $$YMAP: y-map coordinate for the center of the processing cell

    Built-in GRID constants.
    PI: 3.142
    E: 2.718 (e)
    DEG: 57.296 (Degree to radian conversion)
    GAMMA: 0.577
    PHI: 1.618

    Built-in grids.
    $$ROWMAP
    $$COLMAP

  4. #4
    Daniel Lusher
    Join Date
    Jul 2010
    Posts
    17
    Points
    0
    Answers Provided
    0


    0

    Default Re: Generate a grid of latitude values

    Luke (or anyone else who can help),

    I've read your post on this thread, and your thread on the old forums (http://forums.esri.com/Thread.asp?c=...=6#msgid538607), but I'm struggling to get the $$xmap scalar variable to work with the SOMA tool. It works in the Raster Calculator, but since I am trying to create a model, I need to use the SOMA tool. At the moment, I am trying

    $$xmap = (D:\...\Base Data\dem3_4m)

    in the "Map Algebra expression" box, and have tried variations including switching the order of variables, spaces and no spaces, no equal sign, etc. I still get an error saying that "$$xmap = is not a valid function or operator." I also cannot find where it would be in the "Usage" listing.

    I am currently running ArcView 9.3.1 SP 2 with the Spatial Analyst extension, on Windows 7.

    Thank you for any ideas you might have!
    Last edited by lusher88; 08-06-2010 at 05:15 AM.

  5. #5
    Daniel Lusher
    Join Date
    Jul 2010
    Posts
    17
    Points
    0
    Answers Provided
    0


    0

    Default Re: Generate a grid of latitude values

    Figured it out - needed to set the extent, snap raster, and cell size in the "Model Properties" to make it run. Put "$$xmap" in the "Map Algebra expression" text box and it ran fine.

  6. #6

    Join Date
    Nov 2010
    Posts
    1
    Points
    0
    Answers Provided
    0


    0

    Question Re: Generate a grid of latitude values

    Dear Sir
    I need to create a lattitude grid from the DEM. I have gone through the threads and followed the steps. When I type the statement $$YMAP in SOMA window after setting the extent, working directory and cell size by the spatial analyst > options, i get an error message that "Syntax error at locations 0 of expressions $$YMAP". I even changed the expression as E:\Ph.D\Data_dump\DEM = $$YMAP. How to access these built in functions? Kindly help me sir.
    With Thanks

  7. #7

    Join Date
    Jan 2011
    Posts
    1
    Points
    0
    Answers Provided
    0


    0

    Default Re: Generate a grid of latitude values

    I have tried this is arcGIS10 raster calculator and it doesn't work!! Any new detailed instructions on how to generate the grid of latitudes?

    See screen capture attached please.
    Attached Thumbnails Attached Thumbnails Click image for larger version

Name:	latitude error with $yymap.jpg‎
Views:	287
Size:	101.5 KB
ID:	4297  

  8. #8
    todd s
    Join Date
    Aug 2010
    Posts
    134
    Points
    1
    Answers Provided
    1


    0

    Default Re: Generate a grid of latitude values

    I have not tried the raster calculator method.

    However, I have had luck using the function "genvecgrid" in the Geospatial Modeling Environment (GME). After generating the vector point grid I added x-y coordinates to the attribute table. Then, created a raster from these points using the y-coordinate field as values. I think I chose a bilinear interpolation technique when doing this.

  9. #9
    G JtB
    Join Date
    Jan 2011
    Posts
    3
    Points
    0
    Answers Provided
    0


    0

    Default Re: Generate a grid of latitude values

    Hi,
    I have the same Problem as ejjunju ($$XMAP or $$xmap doesn't work in ArcGIS 10)

    I want to create rasters with x-Values and do not have a clue how to Do it with the raster calculatur. I could create point-features, use "Add XY" and then convert it to rasters, but as I have to automatize it it seems to be too complicated.

    I also have problems finding documentation/ tutorials on Map Algebra syntax. Does anyone know some sources for this

    Greetings
    Gerald

  10. #10
    Manny Gimond
    Join Date
    May 2010
    Posts
    21
    Points
    0
    Answers Provided
    0


    0

    Default Re: Generate a grid of latitude values

    Quote Originally Posted by GeraldJtB View Post
    Hi,
    I have the same Problem as ejjunju ($$XMAP or $$xmap doesn't work in ArcGIS 10)
    Unfortunately, ESRI removed those grid functions from 10.0. However, there is a Python alternative, see this link .

  11. #11
    G JtB
    Join Date
    Jan 2011
    Posts
    3
    Points
    0
    Answers Provided
    0


    0

    Default Re: Generate a grid of latitude values

    Hmm,
    Thanks.

    Looks like I have to get a little more familiar with Python then.
    :-/

    Does anyone know Tutorials that make it easier to start with ArcPy?

    Greetings
    Gerald

  12. #12
    Manny Gimond
    Join Date
    May 2010
    Posts
    21
    Points
    0
    Answers Provided
    0


    0

    Default Re: Generate a grid of latitude values

    Quote Originally Posted by GeraldJtB View Post
    Hmm,
    Does anyone know Tutorials that make it easier to start with ArcPy?
    For starters, you might want to read "An Introduction to Python and the ArcPy site-package" in the latest issue of ArcUser.

    Also, if you want to cast a vote for the reintroduction of the grid functions, go to this link.

  13. #13
    William Huber

    Join Date
    Apr 2010
    Posts
    694
    Points
    73
    Answers Provided
    2


    2

    Default Re: Generate a grid of latitude values

    There are several workarounds that use only map algebra. A convenient one is to compute the flow accumulation for a constant map. Use a value of 1 to accumulate left to right and 64 to accumulate bottom to top. This effectively gives you $$ColMap and $$RowMap (indexing begins at 0). Adding 1/2, multiplying by the cellsize, and adding the origin recreates $$XMap and $$YMap. It's reasonably fast and not difficult to remember.

    As a worked example let the origin be at (-500000, 0) and the cellsize be 10. Then
    xmap = (FlowAccumulation(1) + 0.5)*10 - 500000
    ymap = (FlowAccumulation(64) + 0.5)*10
    Doing this in an unprojected coordinate system of course produces grids of longitude and latitude, respectively. Projecting the latitude grid (ymap) answers the question that started this thread. Note that the original elevation grid is used only to determine the extent, cellsize, and projection of the final grid; of course its values are useless.
    Last edited by whuber; 02-03-2011 at 07:02 AM.
    --Bill Huber
    Quantitative Decisions
    For more help, visit the worldwide community at http://gis.stackexchange.com

  14. #14
    Manny Gimond
    Join Date
    May 2010
    Posts
    21
    Points
    0
    Answers Provided
    0


    0

    Thumbs up Re: Arc10 workaround to $$XMAP and $$YMAP

    Quote Originally Posted by whuber View Post
    There are several workarounds that use only map algebra.

    As a worked example let the origin be at (-500000, 0) and the cellsize be 10. Then
    xmap = (FlowAccumulation(1) + 0.5)*10 - 500000
    ymap = (FlowAccumulation(64) + 0.5)*10
    .
    Very clever Bill. This deserves its own sticky (if stickies are implemented on this forum).

  15. #15
    William Huber

    Join Date
    Apr 2010
    Posts
    694
    Points
    73
    Answers Provided
    2


    0

    Default Re: Arc10 workaround to $$XMAP and $$YMAP

    Oops... there's a typo, and now it got quoted! The correct formula in the example is
    xmap = (FlowAccumulation(1) + 0.5)*10 + 500000
    (because one subtracts the coordinates of the origin instead of adding them).
    --Bill Huber
    Quantitative Decisions
    For more help, visit the worldwide community at http://gis.stackexchange.com

  16. #16
    Curtis Price

    Join Date
    Oct 2009
    Posts
    1,798
    Points
    874
    Answers Provided
    127


    1

    Default arcpy map algebra $$ROWMAP, $$COLMAP

    Bill, thank you very much for this!

    I worked out a more detailed implementation of your idea here:
    $$NCOLS + $$ROWMAP?
    Last edited by curtvprice; 05-12-2013 at 05:05 PM. Reason: fixed link

  17. #17
    William Huber

    Join Date
    Apr 2010
    Posts
    694
    Points
    73
    Answers Provided
    2


    0

    Default Re: Generate a grid of latitude values

    Well done, Curtis: that's really clear code. Thank you!
    --Bill Huber
    Quantitative Decisions
    For more help, visit the worldwide community at http://gis.stackexchange.com

  18. #18
    Rakhshan Roohi
    Join Date
    Apr 2013
    Posts
    4
    Points
    0
    Answers Provided
    0


    0

    Default Re: Arc10 workaround to $$XMAP and $$YMAP

    Quote Originally Posted by curtvprice View Post
    Bill, thank you very much for this!

    I worked out a more detailed implementation of your idea here:
    http://forums.arcgis.com/showthread.php?p=166151
    Hi,
    I tried to open this link but it did not work. could you please elaborate this. I am struggling to solve this issue as well. Your help will
    be highly appreciated.

    Cheers

  19. #19
    Curtis Price

    Join Date
    Oct 2009
    Posts
    1,798
    Points
    874
    Answers Provided
    127


    0

    Default Re: Arc10 workaround to $$XMAP and $$YMAP

    I fixed the link above.

    Don't like it that the post number changed -- I thought those were permanent links!

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts