pythonterrain

Using x,y,z data to display a building lot


I used a builder's level to get x,y,z coordinates on a 110 x 150 building lot. They are not in equally spaced rows and columns, but randomly placed. Where should I start?

The data is in CSV format, but I could change that. I want to get the information into a "shapefile" or raster format. I haven't come across the proper utility for this part of the process.


Solution

  • You can convert your coordinate into a shapefile to display them in QGIS, ArcMAP, or similar GIS programs. You probably want a polygon shapefile.

    One easy way to do this is with the PySAL

    >>> import pysal
    >>> coords = [(0,0), (10,0), (10,10), (0,10), (0,0)]
    >>> pts = map(pysal.cg.Point, coords)
    >>> polygon = pysal.cg.Polygon(pts)
    >>> shp = pysal.open('myPolygon.shp','w')
    >>> shp.write(polygon)
    >>> shp.close()
    

    Note: pysal currently doesn't support (Z coordinates) but there are plenty of similar libraries that do.

    Also notice the first and last point are the same, indicating a closed polygon.

    If your X,Y,Z coordinates are GPS coordinates you'll be able to align your data with other GIS data easily by telling the GIS what projection your data is in (WGS84, UTM Zone #, etc). If your coordinates are in local coordinates (not tied to a grid like UTM, etc) you'll need to "Georeference" you coordinates in order to align them with other data.

    Finally using the ogr2ogr command you can easilly export your data from shapefile to other formats like KML,

    ogr2ogr -f KML myPolygon.kml myPolygon.shp