Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Calling mapping toolbox functions from java

26 views
Skip to first unread message

sarah

unread,
May 24, 2012, 1:36:11 AM5/24/12
to
Hello everyone,

I succeeded at using Matlab Builder JA. However, when I call Mapping toolbox functions such as shaperead from java, i get get errors like:


??? Error using ==> openShapeFiles>checkSHP at 75
com.mathworks.toolbox.javabuilder.MWException: Error using ==> openShapeFiles>checkSHP at 75
Failed to open both boston_roads.shp and boston_roads.SHP.

Error in ==> openShapeFiles at 19

Failed to open both boston_roads.shp and boston_roads.SHP.


Error in ==> shaperead at 206

Is there a way to solve this problem? Especially that other applications (not using the mapping toolbox or any other toolbox) work perfectly.

Thanks!

Rob Comer

unread,
May 28, 2012, 10:13:06 PM5/28/12
to
"sarah" wrote in message <jpkhcb$q77$1...@newscl01ah.mathworks.com>...
Which other functions have you tried? Do any of those functions open files, as does shaperead?

The error you received is issued if the MATLAB fopen function fails to open an SHP file; Mapping Toolbox is just checking the return value from fopen and reporting the problem.

Note that when you run shaperead from within MATLAB, you can ask it to open boston_roads.shp without providing any path information, because this SHP file is in a folder that is on the path by default. I'd be surprised if things work like this when calling shaperead or fopen from within Java. I'm not absolutely certain, but I'd expect that you'd have to provide at least a relative path, if not a fully qualified path. Try adding explicit path information, and see if that resolves your problem.

Rob Comer
Mapping Toolbox Development
MathWorks
0 new messages