File Exchange

image thumbnail

MEX_SHAPE

version 1.0 (807 KB) by

Reads in common ESRI shapefile formats.

4.88889
9 Ratings

9 Downloads

Updated

No License

This mex-file reads SHPT_POINT, SHPT_MULTIPOINT, SHPT_ARC, and SHPT_POLYGON shapefiles into structures.

Comments and Ratings (10)

Gerbert

Mr. Evans, thanks for the submission. In contrast to what has been said below does my mexfile not work on the 2012b version (with the exact same code, it does work on a 2006b account)

Error in mexshape (line 1)
function [s, t] = mex_shape ( shapefile )

Output argument "s" (and maybe others) not assigned during call to "C:\Program
Files\MATLAB\R2012b\mexshape\mexshape.m>mexshape".

Error in shape_get (line 66)
[shape_data] = mexshape ( shapefile );

What do I do wrong?

Mr Evans, thank you very much for this extremely useful submission! Also many thanks to Povl Abrahamsen for the comment below. Just to recap, the compilation on my Win7 64bit R2012b machine:
mex -output mexshape -v mex_shape.c shpopen.c dbfopen.c safileio.c

Still works great in R2012B. With the latest version of Shapelib you also need to include safileio.c when compiling.

Pavan

Pavan (view profile)

Works without a problem. Great job.

Anthony Kendall

The code worked great, I compiled it on a 64-bit machine with the latest version of shapelib, and everything works well. Some of the help is a bit outdated, but I really can't complain.

Seshadri Rajagopal

Great and handy tool. I just saved a bunch of money and time by switching to mexshape :-)) Thank you Mr. Evans

Tim Myers

Great code and documentation. This is exactly what I was looking for. Works great.

Richard Signell

Worked perfectly.

ivica Janekovic

SUPER STUFF!!!
All compliments for done jobe!!

Amer Butt

Updates

Took into account suggestions by mlint.

Wasn't handling special case where a point shapefile had just one point in an entity.

Additional windows dll, code cleanup.

Cleaned up issues revealed by -Wall compile option. Now handling multipart polygons within a single shape by using NaNs.

Modified to handle multiregion polygons. This is done by inserting NaNs into the vertex lists where a separate polygon begins.

Minor change to wording of README. Last submission did not include all files.

Minor wording change to the README file. Previous upload did not include all necessary files.

Added Mac OS X, WinXP, and Digital Unix mex files.

Forgot to include mexopts.sh file.

Improved documentation, addition of linux mex file. Addition of example shapefile.

MATLAB Release
MATLAB 7.0.4 (R14SP2)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video