使用Excel经纬度表创建点形状文件

时间:2013-11-05 22:45:33

标签: python sql excel arcmap

这应该很简单: 我有一张带有污染检测站点的Excel表格,以及相应的纬度和经度。我想为这个表创建一个point shapefile。

我编写了一个脚本来创建文件,但无法弄清楚如何在其中创建点:

#Creates Observation Site Shapefile

import arcpy
import fileinput
import string
import os
from arcpy import env
env.workspace = "F:\GEOG 487B\Project"
env.overwriteOutput = True
outpath = env.workspace
newfc = "sites.shp"
infile = "site_loc.xls"
arcpy.CreateFeatureclass_management(outpath, newfc, "Point")

创建shapefile,但属性表为空。如何让ArcMap识别我的Latutude和Longitude列? 表非常简单: A列=站点ID#,B =纬度,C =经度

谢谢!

2 个答案:

答案 0 :(得分:0)

我知道有一个可以读/写形状文件的库。我过去用它来阅读National Weather Service Shapefiles。

http://code.google.com/p/pyshp/

从该网页上的示例中,将点写入形状文件看起来相当容易。

答案 1 :(得分:0)

我的回答可能已经很晚了,但您可以使用Make XY Event Layer,然后将输出图层保存到shapefile或要素类,例如Copy Features。 您也可以在没有Python的情况下通过右键单击ArcCatalog中的xls表>来执行此操作。从XY表创建要素类。

相关问题