Re: [OpenMap Users] Map Data Access

From: Don Dietrick <dietrick_at_bbn.com>
Date: Tue, 5 Jul 2005 13:35:34 -0400

That's OK. Then the path to the data files should match the path
inside the jar file, as they look if you type:

jar -tvf jarfile.jar

Then the jar goes in the classpath.

- Don



On Jul 5, 2005, at 1:20 PM, Vincent, Chuck wrote:

> I am trying to read the shape files from within the jar file. I used
> the method I asked about to read an image from within the jar file,
> and
> was hoping it would be similar. I am very new to Java and trying to
> learn as fast as I can.
>
>
>
> -----Original Message-----
> From: Don Dietrick [mailto:dietrick_at_bbn.com]
> Sent: Tuesday, July 05, 2005 1:08 PM
> To: Vincent, Chuck
> Cc: openmap-users_at_bbn.com
> Subject: Re: [OpenMap Users] Map Data Access
>
>
> On Jul 5, 2005, at 11:45 AM, Vincent, Chuck wrote:
>
>
>> Should this work?
>>
>> shapeLayerProps.put("shapeFile",
>> this.getClass().getResource("dcwpo-browse.shp"));
>> shapeLayerProps.put("spatialIndex",
>> this.getClass().getResource("dcwpo-browse.ssx"));
>>
>
> No. The ShapeLayer is expecting a String to be stored as the value
> for the shapeFile key.
>
> Try:
>
> shapeLayerProps.put("shapeFile", "dcwpo-browse.shp");
> shapeLayerProps.put("spatialIndex", "dcwpo-browse.ssx");
>
> with the parent of the data files being in the classpath.
>
> If you really wanted to associate the data files as a resource to a
> class, you could do something like: this.getClass().getPackage
> ().getName().replace(".", "/");
>
> and create the front part of the path to the data files as it matches
> the current class. To be safe, you'd want to put in null checks for
> non-packaged classes, etc.
>
> - Don
>
>
>
>>
>>
>>
>> -----Original Message-----
>> From: Don Dietrick [mailto:dietrick_at_bbn.com]
>> Sent: Monday, June 27, 2005 1:24 PM
>> To: Vincent, Chuck
>> Cc: openmap-users_at_bbn.com
>> Subject: Re: [OpenMap Users] Map Data Access
>>
>> Hi Chuck,
>>
>> On Jun 27, 2005, at 10:59 AM, Vincent, Chuck wrote:
>>
>>
>>
>>> I have successfully integrated a mabBean into my Java app, but I
>>> need
>>> help with map data access options.
>>>
>>> When I run the app locally and have the data files stored on the
>>> machine
>>> everything is good, fast projection changes.
>>>
>>> I am also trying to implement a applet version, I changed the
>>> shapeLayerProps.put() command to access the shapeFile and
>>> spatialIndex
>>> files using "http://path_to_files" and all is well, except
>>> projection
>>> changes are slow.
>>>
>>>
>>
>> That's because the ShapeLayer re-reads the data files when the
>> projection changes, in an effort to hold on to the least amount of
>> geometries necessary. See more below...
>>
>>
>>
>>> I have not had success packaging the files in the jar
>>> file, actually I have them packaged in the jar file, the
>>> shapeLayerProps.put() method only complains that the file path is
>>> invalid. I have packaged image files into the jar file and can
>>> access
>>> them with out issue. Is there something I am missing?
>>>
>>>
>>
>> You probably have to add the jar file as a resource to load in the
>> applet html file. In the properties, the file should be referenced
>> with the path to the file from the root inside the jar.
>>
>>
>>
>>> The second option is to speed up the projection changes when
>>> linked to
>>> the files via http. Is there a way to cache the files once they are
>>> read in so future projection changes will be faster?
>>>
>>>
>>
>> You can use the BufferedShapeLayer for that.
>>
>> - Don
>>
>>
>>
>>
>
>

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Tue Jul 05 2005 - 13:35:47 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:07 EDT