Print

Print


Thanks for the reply. Unfortunately it looks like toURL(), a File method, has been deprecated and when you use toURI().toURL() you end up with the same problem. I did find a solution that works, but I have to do a string replace. I'm just worried about what this will do to my colleague using Mac or Linux:

URL roadsFile = new URL(Gridlock.class.getResource("data/roads.shp").toString().replace("%20",  " "));

One more question. In both 1.5 and 1.4.1 demo zips there is a missing data file. I can't run the gridlock demo without roads_points_place.csv. Was that an intentional omission?

Regards,

-ricardo

From: MASON Multiagent Simulation Toolkit [mailto:[log in to unmask]] On Behalf Of Mark Coletti
Sent: Friday, January 10, 2014 2:39 PM
To: [log in to unmask]
Subject: Re: geomason ShapeFileImporter read method problems

On Fri, Jan 10, 2014 at 3:01 PM, Sanchez, Ricardo <[log in to unmask]<mailto:[log in to unmask]>> wrote:
I hope it's okay to ask geomason questions here.

Yep.  Though sometimes it might take a while to get an answer.  Luckily I happened to be checking my email just now.  ;)


The geomason ShapeFileImporter read method requires a URL. However, my Windows computer converts spaces in URLs - really the file path - to "%20" which then causes a FileNotFoundException when I try to run code. I can fix this by doing a string substitution, but I was wonder what the right way/long term solution is for this problem.


http://stackoverflow.com/questions/2166039/java-how-to-get-a-file-from-an-escaped-url

So:




File file = new File(url.toURI());

__________________________________________________________________________

This email message is for the sole use of the intended recipient(s) and
may contain confidential information. Any unauthorized review, use,
disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies
of the original message.