MATLAB Answers

What happened to the ESRI file in the mapping toolbox projection files in 2020b PR?

5 ビュー (過去 30 日間)
Thomas Watson
Thomas Watson 2020 年 6 月 19 日
コメント済み: Kelly Kearney 2020 年 6 月 19 日
Prior to 2020b PR, there was an 'esri' file inside MATLAB\R20xx\toolbox\map\mapproj\projdata\proj that was used by 3rd party code like shaperead2 https://github.com/gdherbert/MatLab_Shaperead2
This file was read in as a sort of lookup table for what projection to use on the .prj file's WKT PROJCS field. E.g., if a .prj file's WKT had PROJCS["WGS 84 / UTM zone 10S", it would be associated with "<32710> +proj=utm +zone=10 +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs no_defs <>" from the ESRI file, and the various attributes would be parsed out (+proj, +zone, etc) and used to construct an mstruct.
As of 2020b PR, the ESRI file seem to have been removed, and shaperead2 fails to work as it required that ESRI file.
I've tried looking for any mapping toolbox related functions that might have been added to fill the gap, such as something that reads from the new proj.db SQLite database and possibly does an alias to projection lookup, but I haven't found anything.
What do I have to do moving forward to get this to work in 2020b and on?

  0 件のコメント

サインインしてコメントする。

回答 (2 件)

Kelly Kearney
Kelly Kearney 2020 年 6 月 19 日
I'm not sure if this will work for your use case, but I wrote my shapeprjread function to parse certain projected shapefiles. It's somewhat limited, given that I don't myself work with ArcGIS and therefore have never gotten a full list of the possible projections, so it only supports the following projection so far (column 1 = .proj file projection name, column 2 = Mapping Toolbox projection name):
'Transverse_Mercator' 'tranmerc'
'Albers' 'eqaconicstd'
'Albers Conical Equal Area' 'eqaconicstd'
'Lambert_Azimuthal_Equal_Area' 'eqaazim'
But I've found that this covers the vast majority of projected shapefiles I need to read in. And it doesn't require any external ESRI-based dependencies.
If I get some time, I may take a look at that proj.db database to see if it might fill in some of the remaining gaps...

  1 件のコメント

Kelly Kearney
Kelly Kearney 2020 年 6 月 19 日
As a followup, if you get the error "Need to add this projection to the list", that's a really fast fix. It means that the prjread function read in all the necessary info, but I just hadn't encountered that projection name yet, so need to add a translation to the table shown above. Just let me know what the new projection name is and I'll add it.

サインインしてコメントする。


Steven Lord
Steven Lord 2020 年 6 月 19 日
Please do not ask questions about the prerelease here on Answers. Send those questions / feedback to Technical Support using the telephone icon in the upper-right corner of this page.

  1 件のコメント

Thomas Watson
Thomas Watson 2020 年 6 月 19 日
My apologies, thanks for the information.

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by