页首Html代码

返回顶部

ArcGIS之xy坐标系放大|由GCS_WGS_1984坐标系转换到投影平面坐标系'WGS_1984_Web_Mercator_Auxiliary_Sphere',X Y坐标系变大许多倍.单位由十进制变成米

由于VISSIm Synchro等交通类的软件 要加载GIS 资源的background底图资源,而直接加载GIS(shp格式)资源后,发现很小,甚至没有底图,无法显示.尤其是Synchro软件加载GIS资源底图后,左上角Xy 和右下角XY 都是整数,直接重合,在软件上无显示.开始我想 把坐标系的XY 都放大10000倍,就可以显示了.其实我真是不专业啊...

由于我给的GIS资源shp文件的坐标系是GPS标准坐标系WGS1984,XY范围 是 -180到180度,-90度到90度,而我们这个地区连1度都没有的.想要XY变大很简单,将地理坐标系投影转换为平面坐标系就可以了.

平面坐标系,比如西安80(大约在arcgis坐标系文件夹的 投影/高斯 下面),我使用了WGS1984的一种web平面坐标系,ID是102100(在该网站可以看到arcgis定义的ID和对应的坐标系名称以及坐标系的参数).

用catalog或arcmap的tooolbox工具箱的 数据工具/投影转换/投影 工具可以进行转换,在结果显示,从结果可以复制python脚本,然后自己编辑python脚本来调用转换过程.貌似python中间不要加上中文路径,或者子python上面添加编码声明.

下面是我的python脚本(从ArcGIS工具箱复制python脚本修改的)

# Replace a layer/table view name with a path to a dataset (which can be a layer file) or create the layer/table view within the script
#
The following inputs are layers or table views: "Rshenzhen"
import arcpy;
in_dataset="F:/1.EnglishDir/m2 shenzhen x10000/road/Rshenzhen_polyline.shp"
out_dataset="F:/1.EnglishDir/document/prj/rshenzhen_project3.shp"

out_coor_system="PROJCS['WGS_1984_Web_Mercator_Auxiliary_Sphere',GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Mercator_Auxiliary_Sphere'],PARAMETER['False_Easting',0.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',0.0],PARAMETER['Standard_Parallel_1',0.0],PARAMETER['Auxiliary_Sphere_Type',0.0],UNIT['Meter',1.0]]"
transform_method="#"
in_coor_system="GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]"

arcpy.Project_management(in_dataset,out_dataset,out_coor_system,transform_method,in_coor_system)

Python真是很有意思的语言,很想学,只是不知用处以及不知如何提高工作效率,而且学习难度费记忆啊.

下面是在python中输入help(arcpy.Project_management)的结果.附上一个linux下gtk类脚本的模板.

View Code
"""
help(Project_management);

Help on function Project in module arcpy.management:

Project(in_dataset=None, out_dataset=None, out_coor_system=None, transform_method=None, in_coor_system=None)
Project_management(in_dataset, out_dataset, out_coor_system, {transform_method;transform_method...}, {in_coor_system})

Creates a new dataset or feature class with the coordinate system specified.

* If the input is a feature class Features from the input feature class are
projected to the new coordinate system and written to the output feature class.


* If the input is a feature dataset ll feature classes in the input feature
dataset will be projected to the new coordinate system and written to the output
feature dataset.

INPUTS:
in_dataset (Feature Layer or Feature Dataset):
The feature class, feature layer, or feature dataset to be projected.
out_coor_system (Coordinate System):
Valid values are a file with a .prj extension (.prj files shipped with ArcGIS
are available at the ArcGIS installation directory in the Coordinate System
folder) or a string representation of a coordinate system. This string
representation can be generated by adding a coordinate system variable to
ModelBuilder, setting the variable's value as desired, then exporting the model
to a Python script. The string can then be copied from the Python script.
transform_method {String}:
This method can be used for converting data between two geographic coordinate
systems or datums. This initially optional parameter may be required if the
input and output coordinate systems have different data.Transformations are bi-
directional. For example, if converting data from WGS
1984 to NAD 1927, you can pick a transformation called NAD_1927_to_WGS_1984_3
and the tool will apply it correctly.
in_coor_system {Coordinate System}:
The coordinate system of the input feature class or dataset.

OUTPUTS:
out_dataset (Geodataset):
The new feature dataset or feature class that has the coordinate system
specified in the output coordinate system parameter.


"""

"""
Demo of Class of python



#!/usr/bin/python

import pygtk
pygtk.require('2.0')
import gtk

class HelloWorld:
def __init__(self):
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.set_border_width(10)

self.window.connect("delete_event", self.delete_event)
self.window.connect("destroy", self.destroy)

self.button = gtk.Button("Hello World")
self.button.connect("clicked", self.hello)
self.button.connect_object("clicked", gtk.Widget.destroy, self.window)

self.window.add(self.button)
self.window.show_all()

def hello(self, widget):
print 'Hello World'

def delete_event(self, widget, event, data=None):
print "delete event occurred"

return False

def destroy(self, widget, data=None):
print "destroy signal occurred"
gtk.main_quit()

def main(self):
gtk.main()

if __name__ == "__main__":
hello = HelloWorld()
hello.main()


"""

 

posted @ 2012-03-27 12:20  ayanmw  阅读(13598)  评论(1编辑  收藏  举报

页脚Html代码