1

This question already has an answer here:

Completely new to GIS so this may be the most basic thing in the world however I've followed several other posts on the same question and it does not seem to be working.

My end goal(hopefully) is to take the files(.shp, .dbf, etc) that I've downloaded from the NHESP and turn certain habitats into lat and long values in a .csv.

Basically, I'm trying to determine if bee-hive distance to core habitats etc makes an impact on health, ability to survive, etc(if anyone cares).

I've tried using the field calculator to generate an X & Y coordinate, as well as the "save vector layer as" and changing the geometry to "as_xy."

Is there something I'm missing, or is it possible the files I have simply cannot generate or do not contain the information needed for lat/long?

marked as duplicate by underdark qgis Feb 22 '18 at 19:01

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 4
    Are your habitats point or polygon? Why not perform a nearest calculation (distance matrix qgistutorials.com/en/docs/nearest_neighbor_analysis.html) for each beehive to the nearest habitat(s) and save that as a table? That way you will know for each hive what habitat(s) are close and how far they are. To do this properly you should have both the hive and habitat as a suitable projected coordinate system. I care about bees, of the insects they are one of the most ecologically significant for their role in pollinating plants and generating honey as an aside. – Michael Stimson Feb 22 '18 at 1:31
  • There are two separate sets of habitats, both are polygons. I just checked out the link. This is pretty awesome however I think I'm still stuck since I don't have(or at least I don't think I have) the coordinates of the habitats. When I right click the layers and select "attributable table" I see the acreage, shape_area and shape_len. No x,y, etc. however. My ultimate goal would be to get the distance into a .CSV so I can toss it into some machine learning algos in R. – DataDog Feb 22 '18 at 4:38
  • 1
    You have the geometry (shape) of the features, that is what is being used by distance matrix.. you don't need to do the calculations yourself, the tool will calculate the distance from a hive to the closest vertex in the habitat; you will need to run this twice, once for each set of habitat polygons or merge all the habitats into one feature class. Ensure that the units of your CRS for all feature classes are metres (or feet) as the calculated distance will be in the CRS units. – Michael Stimson Feb 22 '18 at 5:22
  • could you not import the shapefiles into R? – Ian Turton Feb 22 '18 at 9:03
  • Apologies, was tied up with other things: @MichaelStimson - Calculated out the distance matrix but something still feels off with the shapefiles. I'm going through the link you sent me but when one of my points is right next to the shape, it's calculating the distance to a farther feature. Finally, have some time to devote to this. – DataDog Feb 26 '18 at 22:24