我有基本的2-D numpy数组,我想将它们"缩减"到更粗糙的分辨率.是否有一个简单的numpy或scipy模块可以轻松地做到这一点?我还应该注意,这个数组是通过Basemap模块在地理上显示的.
样品:

我在计算我在网页上的div标签内托管的图像的纬度和经度值时遇到了困难.我可以很容易地找出图像的x,y(像素)坐标,并将它们保存到我脚本中的变量中.这是棘手的部分......
地图不是墨卡托投影,因此我不能简单地将x,y像素坐标线性插值为lat和lon值.但是,我确实知道图像所有四个角的纬度和经度(见贴图),图像上的地图投影,中央子午线和原点纬度.

800x600像素图像是美国的,我基本上试图通过传递x,y像素坐标来捕获点击的纬度和经度.我假设我需要某种转换功能.
我有一个类似于以下代码的 XML 文件:
<spotter num="0187" report_at="2014-03-15 20:10:25" lat="49.8696518" lng="-80.0973129"callsign="wxman132" active="1" public="" gps="0" phone="" email="addu@nnu.nne" first="" last=""></spotter>
Run Code Online (Sandbox Code Playgroud)
我已经尝试使用 dom.minidom,但是如何轻松地从 XML 文件中解析出 lat 和 lng 变量值?
提前感谢您的帮助!
我有一个由各个州组成的美国多边形图形文件,作为其属性值。此外,我还有一些数组,用于存储我也感兴趣的点事件的纬度和经度值。从本质上讲,我想“空间连接”点和面(或执行检查以查看每个面和面[即状态])点),然后求和每个州的点数,找出哪个州的“事件”数最多。
我相信伪代码将是这样的:
Read in US.shp
Read in lat/lon points of events
Loop through each state in the shapefile and find number of points in each state
print 'Here is a list of the number of points in each state: '
Run Code Online (Sandbox Code Playgroud)
任何库或语法将不胜感激。
根据我的判断,OGR库是我所需要的,但是我在语法上遇到了麻烦:
dsPolygons = ogr.Open('US.shp')
polygonsLayer = dsPolygons.GetLayer()
#Iterating all the polygons
polygonFeature = polygonsLayer.GetNextFeature()
k=0
while polygonFeature:
k = k + 1
print "processing " + polygonFeature.GetField("STATE") + "-" + str(k) + " of " + str(polygonsLayer.GetFeatureCount())
geometry = …Run Code Online (Sandbox Code Playgroud) python ×3
gdal ×1
geolocation ×1
javascript ×1
jquery ×1
numpy ×1
parsing ×1
php ×1
proj4js ×1
python-2.7 ×1
qgis ×1
scipy ×1
shapefile ×1
shapely ×1
xml ×1
xml-parsing ×1