image thumbnail

interpshapefile

version 1.1.0.1 (119 KB) by Kelly Kearney
Determine value at a given location or locations based on data in an ESRI shapefile

2.3K Downloads

更新23 Sep 2021

From GitHub

View license on GitHub

interpshapefile。m文档

Author: Kelly KearneyView interpshapefile on File Exchange

This repository includes the code for theexample.mMatlab function, along with all dependent functions required to run it.

Paragraph description for this function or suite of functions.

Contents

  • 入门
  • Syntax
  • Description
  • Examples
  • Contributions

入门

Prerequisites

This function requires Matlab R14 or later.

下载和安装

This code can be downloaded fromGithub或者MatlabCentral File Exchange. The File Exchange entry is updated daily from the GitHub repository.

Matlab Search Path

The following folders need to be added to your Matlab Search path (viaaddpath.,pathtool, etc.):

interpshapefile-PKG./interpshapefile

Syntax

价值= interpshapefile(S, lat, lon, attribute)

Description

价值= interpshapefile(S, lat, lon, attribute)determines the价值corresponding to location(s) with latitude拉特一个nd longitudelonbased on the一个ttributefield associated with polygons in the geographic data structureS(as returned by a call toshaperead)。至少,Smust include fields of 'Lat', 'Lon', and the specified attribute, and contain one or more elements with 'Polygon' Geometry. The returned价值will either be a numeric or cell array, depending on the class of the attribute field; points outside of the polygons will receive a NaN or empty array as applicable.

Examples

We'll use the usastatlo.shp shapefile for our example; this file is included with the Mapping Toolbox:

States=shaperead('Usastatelo.','umergeocoords.',真的);usamap('芋螺');geoshow('Usastatelo..shp','FaceColor.',ones(1,3)*0.8,……'edgecolor',ones(1,3)*0.7);

Scatter some random points.

拉特lim=Getm.(GCA,'Maplatlimit.'); lonlim=Getm.(GCA,'maplonlimit');rng.(1);%仅用于可重复性lon=rand(40,1)*diff(lonlim)+lonlim(1); lat=rand(40,1)*diff(latlim)+拉特lim(1);Plotm.(lat, lon,'b.');

Determine which state each point is in.

sn=interpshapefile(States, lat, lon,'Name');textm(lat, lon, sname,'fontsize',8);

Contributions

Community contributions to this package are welcome!

要报告错误,请提交一个n issue在GitHub上,包括:

  • your operating system
  • 您的MATLAB版本和所有相关工具箱(类型ver一个t the Matlab command line to get this info)
  • 代码/数据重现错误或错误行为,以及收到任何错误消息的全文

Please also feel free to submit enhancement requests, or to send pull requests (via GitHub) for bug fixes or new features.

I do monitor the MatlabCentral FileExchange entry for any issues raised in the comments, but would prefer to track issues on GitHub.

发布ed with MATLAB R2019a

Cite As

Kelly Kearney (2022).interpshapefile(https://github.com/kakearney/interpshapefile-pkg), GitHub. Retrieved.

Matlab释放兼容性
Created with R14SP3
兼容任何版本
Platform Compatibility
视窗 macOS Linux
Acknowledgements

Inspired:geotiffinterp

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

开始狩猎!

inpolygons.

interpshapefile

在此GitHub附加组件中查看或报告问题,访问GitHub Repository.
在此GitHub附加组件中查看或报告问题,访问GitHub Repository.