Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Calling mapping toolbox functions from java

Subject: Calling mapping toolbox functions from java

From: sarah

Date: 24 May, 2012 05:36:11

Message: 1 of 2

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!

Subject: Calling mapping toolbox functions from java

From: Rob Comer

Date: 29 May, 2012 02:13:06

Message: 2 of 2

"sarah" wrote in message <jpkhcb$q77$1@newscl01ah.mathworks.com>...
> 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.

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

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us