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

I have found a lot of info on mapping and I'm looking forward to learning about GIS. And how to use the many free software utilities out there.

Where should I start?

Now the data is in a csv file format, but I could change that.

It seems that I want to get the information I have into a "shapefile" or a raster format.

I supose I could look up the formats and do this, but it seems that I havn't come accross the proper utility for this part of the process.

Thank You Peter

有帮助吗?

解决方案

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

其他提示

You can convert a CSV file into any OGR supported format. All you need is a header file for the CSV file. Here you have an example:

 <ogrvrtdatasource>
 <ogrvrtlayer name="bars">
    <srcdatasource>bars.csv</srcdatasource>
    <geometrytype>wkbPoint</geometrytype>
    <layersrs>EPSG:4326</layersrs>
    <geometryfield encoding="PointFromColumns" x="longitude" y="latitude">
    </geometryfield>
 </ogrvrtlayer>
 </ogrvrtdatasource>

In the datasource field you set the CSV file name. In your case, you have points, so the example is ok. The field layersrs indicates the projection of the coordinates. If you have longitude and latitude, this one is ok. The geometryfields must contain the x and y properties, that define the columns in the CSV file that containt the coordinates. The CSV file must have a first line defining the field names. Save the file with a .vrt extension.

Once you have this, use the ogr2ogr program, which you have if GDAL is installed. If you want to convert the file to a Shapefile, just type in a console:

ogr2ogr -f "ESRI Shapefile" bars.shp bars.vrt

If your question is what to do with the data, you can check the gdal_grid utility program, which converts scattered data (as yours) to raster data. You can use the CSV with the vrt header file as the input, without changing the format.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top