Re: [OpenMap Users] Map Data Access

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

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:08:28 EDT

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