简体   繁体   English

使用Excel纬度和经度表创建点Shapefile

[英]Create Point Shapefile Using Excel Table of Latitude and Longitude

This should be very simple: I have an Excel table with pollution detection sites, and their corresponding Latitudes and Longitudes. 这应该非常简单:我有一个Excel表,其中包含污染检测站点及其相应的纬度和经度。 I want to create a point shapefile for this table. 我想为此表创建一个点shapefile。

I have written a script to create the file, but cannot figure out how to create the points in it: 我已经编写了一个脚本来创建文件,但是无法弄清楚如何在其中创建点:

#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")

The shapefile is created, but the attribute table is empty. shapefile已创建,但属性表为空。 How can I get ArcMap to recognize my Latutude and Longitude columns? 如何使ArcMap识别我的Latutude和经度列?
The table is very simple: Column A = Site ID#, B = Latitude, C = Longitude 该表非常简单:列A =站点ID#,B =纬度,C =经度

Thanks!! 谢谢!!

I know there is a library which can read/write shape files. 我知道有一个可以读取/写入形状文件的库。 I've used it to read in National Weather Service Shapefiles in the past. 我过去曾用它来读取国家气象局Shapefile。

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

From the examples on that webpage, writing points into a shape file looks fairly easy. 从该网页上的示例中,将点写入形状文件看起来相当容易。

My answer is probably late, but you can use Make XY Event Layer and then save the output layer to a shapefile or feature class with eg Copy Features . 我的答案可能晚了,但是您可以使用“ 制作XY事件图层” ,然后使用 复制要素”将输出图层保存到shapefile或要素类中。 You can also do this without Python by right-clicking your xls sheet in ArcCatalog > Create feature class from XY table. 您也可以在没有Python的情况下通过在ArcCatalog>从XY表创建要素类中右键单击xls表来执行此操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM