Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am having a puzzle about using mmqgis create vector layer option. I want to use UTM CSRThis are my options:

this are my options. I want a grid of 20,000 meters in the east and north axis. Nevertheless i have an error screen stating: "invalid width/height 6.0/6.0". As I understand my settings I should have 6 lines separated by 20,000 meters Am I understanding this in the wrong way? Thanks in advance

share|improve this question

3 Answers 3

up vote 5 down vote accepted

Without checking, I would interpret to options as follows:

  • left x: min x
  • width: width of the complete grid, therefore ... min x + width = max x
  • h spacing: width of one cell

same for the second dimension

share|improve this answer
    
Yes! That was what I was looking to understand! Thanks for your time –  Gerardo Jimenez Nov 20 '12 at 19:16
    
If the answer was current, please consider to upvote it and\or accept it. –  Alexandre Neto Nov 20 '12 at 19:45

I was getting this error too. The problem is is that the Width is less than the H Spacing you should just lower the H Spacing and the V Spacing will update automatically.

you can see the error in the source here:

search for Invalid width / height

share|improve this answer
    
also here is the documentation michaelminn.com/linux/mmqgis –  Benjamin Rothschild May 1 '13 at 4:51

I struggled with setting up the V and H spacing for hexagons. The dialogue box in mmqgis is less than helpful. What exactly does V spacing mean? What if I want to specify an area for each hexbin? What if I want to specify a side length? What does a V spacing of 1000 units mean in area?

I made a simple Python script (and an accompanying graphic) to help users with this problem. The issue is that the parameters are used to create the bounding of the hexagons, rather than any one hexagon itself.

Copy and paste this into a text file called get_params.py, then open console/command line and change the directory to where the file is and run » python get_params.py.

from math import sqrt

# Passes a desired area (in acres) and returns a dictionary of mmqgis v- and h-spacing parameters
def getParamsFromArea(target_area_ac):
  target_area_ft = 43560 * target_area_ac
  target_side_length = sqrt( target_area_ft / (3 * sqrt(3) / 2) )
  bounding_side_length = target_side_length * sqrt(3)
  bounding_incircle_radius = 3 * target_side_length / 2
  params = {'h-spacing': bounding_incircle_radius, 'v-spacing': bounding_side_length}
  print("""A target hexbin of {} acres yields a side 
  length of {:.4f} feet and is {} sq.ft. in area""".format(target_area_ac, target_side_length, target_area_ft))
  for k, v in params.iteritems():
    print("{}: {:10.8f} feet".format(k, v))
  for k, v in params.iteritems():
    print("{}: {:10.8f} meters".format(k, v * 0.3048))
  return params

# Passes a desired side length (in feet) and returns a dictionary of mmqgis v- and h-spacing parameters
def getParamsFromLength(target_side_length):
  target_area_ft = ( target_side_length * target_side_length ) * ( (3 * sqrt(3) ) / 2 )
  target_area_ac = target_area_ft * 2.29568e-5
  bounding_side_length = target_side_length * sqrt(3)
  bounding_incircle_radius = 3 * target_side_length / 2
  params = {'h-spacing': bounding_incircle_radius, 'v-spacing': bounding_side_length}
  print("A target hexbin with side length {} feet yields an area of {:.2f} acres and {} sq.ft. in area".format(target_side_length, target_area_ac, target_area_ft))
  for k, v in params.iteritems():
    print("{}: {:10.8f} feet".format(k, v))
  for k, v in params.iteritems():
    print("{}: {:10.8f} meters".format(k, v * 0.3048))
  return params

# Passes the mmqgis dialogue parameter 'V spacing' and prints the resulting side length and area
def translateVsp(v_spacing):
  bounding_side_length = v_spacing
  target_side_length = bounding_side_length / sqrt(3)
  target_area_ft = ( target_side_length * target_side_length ) * ( (3 * sqrt(3) ) / 2 )
  target_area_ac = target_area_ft * 2.29568e-5
  print("A V spacing of {} units yields a side length of {} units and an area of {} units squared.".format(v_spacing, target_side_length, target_area_ft))

# Get user input
mode = raw_input("Do you want to get parameters or translate V spacing? ('p' or 't'): ")
if mode == 't':
  v = input("Enter the V spacing from mmqgis input dialogue: ")
  translateVsp(v)
elif mode == 'p':
  calc_type = raw_input("Do you want to get parameters from a side length or an area? ('l' or 'a'): ")
  if calc_type == 'a':
    a = input("Enter the number of acres for the hexbin: ")
    getParamsFromArea(a)
  elif calc_type == 'l':
    l = input("Enter the side length for the hexbin: ")
    getParamsFromLength(l)
  else:
    print("Error: enter 'l' or 'a' (without quotes) when prompted.")
else:
  print("Error: enter 'p' or 't' (without quotes) when prompted to select a calculation mode.")

explanation of mmqgis grid overlay for hexbins

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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