WARNING: This server is unstable and will be retired in the next days. If you want to keep this forum available, please request immediately a migration on the Nabble Support forum. Forums that don't receive any migration request will be deleted forever.

Layer worker Construct

View: New views
4 Messages — Rating Filter:   Alert me  

Layer worker Construct

by Jeff_K :: Rate this Message:

| View Threaded | Show Only this Message

Hey everyone,

I have recently upgraded to the new version of openmap, version 4.6.3
to 4.6.4.  In my application I have several shapefiles that I have
been using with no problems at all.  After I upgraded to the new
version I am now getting an error from the openmap code
"layername|LayerWorker.construct(): null".  I am getting this error
with two of my shapefiles but a third that is very similar is just
fine.  I googled the problem and found an old post on the openmap
forums to modify come code in the ESRIPolygonRecord.java file, but the
openmap code already has this modification.

I am assuming that this problem has to do with the new version since
the application worked just fine before had and I was wondering if
anyone else has ran into this problem using the new version of
openmap?  If you have any tips, suggestions, hints or anything it
would be awsome to hear about them.

Thanks,

Jeff

--
[To unsubscribe to this list send an email to "majdart@..."
with the following text in the BODY of the message "unsubscribe openmap-users"]

Re: Layer worker Construct

by Jeff_K :: Rate this Message:

| View Threaded | Show Only this Message

On Fri, Nov 7, 2008 at 10:56 AM, Jeff Kuntz <jeffrey.kuntz@...> wrote:

> Hey everyone,
>
> I have recently upgraded to the new version of openmap, version 4.6.3
> to 4.6.4.  In my application I have several shapefiles that I have
> been using with no problems at all.  After I upgraded to the new
> version I am now getting an error from the openmap code
> "layername|LayerWorker.construct(): null".  I am getting this error
> with two of my shapefiles but a third that is very similar is just
> fine.  I googled the problem and found an old post on the openmap
> forums to modify come code in the ESRIPolygonRecord.java file, but the
> openmap code already has this modification.
>
> I am assuming that this problem has to do with the new version since
> the application worked just fine before had and I was wondering if
> anyone else has ran into this problem using the new version of
> openmap?  If you have any tips, suggestions, hints or anything it
> would be awsome to hear about them.
>
> Thanks,
>
> Jeff
>

I just wanted to add to my previous post.  I debugged the problem a
bit more by adding some print statements to the openmap code to try to
figure out what was causing the problem.  Below is a stack trace from
the the construct() method in the LayerWorker class that is defined in
OMGraphicHandlerLayer.

java.lang.NullPointerException
        at com.bbn.openmap.dataAccess.shape.DbfHandler.evaluate(DbfHandler.java:249)
        at com.bbn.openmap.layer.shape.SpatialIndex.getOMGraphics(SpatialIndex.java:519)
        at com.bbn.openmap.layer.shape.ShapeLayer.prepare(ShapeLayer.java:522)
        at com.bbn.openmap.layer.policy.StandardRenderPolicy.prepare(StandardRenderPolicy.java:99)
        at com.bbn.openmap.layer.OMGraphicHandlerLayer$LayerWorker.construct(OMGraphicHandlerLayer.java:695)
        at com.bbn.openmap.util.SwingWorker$2.run(SwingWorker.java:127)
        at java.lang.Thread.run(Unknown Source)

In the DbfHandler.evaluate method it seems that this line of code is breaking:

Integer index = (Integer)
omg.getAttribute(ShapeConstants.SHAPE_INDEX_ATTRIBUTE);

Is this caused by a bad dbf file?  Have there been any changes to this
code from the last version?

Jeff

--
[To unsubscribe to this list send an email to "majdart@..."
with the following text in the BODY of the message "unsubscribe openmap-users"]

Re: Layer worker Construct

by Jeff_K :: Rate this Message:

| View Threaded | Show Only this Message


Jeff_K wrote:
On Fri, Nov 7, 2008 at 10:56 AM, Jeff Kuntz <jeffrey.kuntz@gmail.com> wrote:
> Hey everyone,
>
> I have recently upgraded to the new version of openmap, version 4.6.3
> to 4.6.4.  In my application I have several shapefiles that I have
> been using with no problems at all.  After I upgraded to the new
> version I am now getting an error from the openmap code
> "layername|LayerWorker.construct(): null".  I am getting this error
> with two of my shapefiles but a third that is very similar is just
> fine.  I googled the problem and found an old post on the openmap
> forums to modify come code in the ESRIPolygonRecord.java file, but the
> openmap code already has this modification.
>
> I am assuming that this problem has to do with the new version since
> the application worked just fine before had and I was wondering if
> anyone else has ran into this problem using the new version of
> openmap?  If you have any tips, suggestions, hints or anything it
> would be awsome to hear about them.
>
> Thanks,
>
> Jeff
>

I just wanted to add to my previous post.  I debugged the problem a
bit more by adding some print statements to the openmap code to try to
figure out what was causing the problem.  Below is a stack trace from
the the construct() method in the LayerWorker class that is defined in
OMGraphicHandlerLayer.

java.lang.NullPointerException
        at com.bbn.openmap.dataAccess.shape.DbfHandler.evaluate(DbfHandler.java:249)
        at com.bbn.openmap.layer.shape.SpatialIndex.getOMGraphics(SpatialIndex.java:519)
        at com.bbn.openmap.layer.shape.ShapeLayer.prepare(ShapeLayer.java:522)
        at com.bbn.openmap.layer.policy.StandardRenderPolicy.prepare(StandardRenderPolicy.java:99)
        at com.bbn.openmap.layer.OMGraphicHandlerLayer$LayerWorker.construct(OMGraphicHandlerLayer.java:695)
        at com.bbn.openmap.util.SwingWorker$2.run(SwingWorker.java:127)
        at java.lang.Thread.run(Unknown Source)

In the DbfHandler.evaluate method it seems that this line of code is breaking:

Integer index = (Integer)
omg.getAttribute(ShapeConstants.SHAPE_INDEX_ATTRIBUTE);

Is this caused by a bad dbf file?  Have there been any changes to this
code from the last version?

Jeff

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Just wanted to post one more time because I think I know what the problem is now and I am trying to figure out a good solution.  The problem that I can see is that the openmap code is throwing an exception in the getOMGraphics method in the SpatialIndex.java file.  Inside this method there is a section of code that says:

                    if (dbf != null) {
                        omg = dbf.evaluate(omg, labels, mapProj);
                    }

If i comment this line out my program works like it used to without a problem.  I am getting a null pointer out of this line of code.  I specify these layers in the openmap properties file and only set the keys layerName.shapeFile and layerName.spatialIndex.  What I don't understand is how the dbf object is getting set to a non null value.  I would imagin that a quick solution would be to set a dbf file in the properties file but I am not certain whether there is a key for this.  Is there a "layerName.dbfFile" key?

Or can I leave these three lines commented out and just compile openmap like this?  will there be any adverse effects by doing this?

Thanks,

Jeff

Re: Layer worker Construct

by Don Dietrick :: Rate this Message:

| View Threaded | Show Only this Message

Hi Jeff,

I've updated the CVS repository on the website with a fix for  
DbfHandler to check that the attribute isn't null:

     public OMGraphic evaluate(OMGraphic omg, OMGraphicList labelList,
                               Projection proj) {
         Object obj =  
omg.getAttribute(ShapeConstants.SHAPE_INDEX_ATTRIBUTE);

         if (obj instanceof Integer) {
             Integer index = (Integer) obj;
             // Off by one, the index in the shp file starts at 1,
             // the dbf starts at 0
             return evaluate(index.intValue() - 1, omg, labelList,  
proj);
         }

         return omg;
     }

There are further checks in that SpatialIndex method as well that  
might help you.  But to answer your question, you can comment out that  
code if you want all of the OMGraphics in the shape file to show up.  
The DbfHandler just filters out OMGraphics that don't pass attribute  
value rules (or sets tooltips, colors, etc.).

Hope this helps,

Don

On Nov 10, 2008, at 7:07 PM, Jeff_K wrote:

>
>
>
> Jeff_K wrote:
>>
>> On Fri, Nov 7, 2008 at 10:56 AM, Jeff Kuntz <jeffrey.kuntz@...>
>> wrote:
>>> Hey everyone,
>>>
>>> I have recently upgraded to the new version of openmap, version  
>>> 4.6.3
>>> to 4.6.4.  In my application I have several shapefiles that I have
>>> been using with no problems at all.  After I upgraded to the new
>>> version I am now getting an error from the openmap code
>>> "layername|LayerWorker.construct(): null".  I am getting this error
>>> with two of my shapefiles but a third that is very similar is just
>>> fine.  I googled the problem and found an old post on the openmap
>>> forums to modify come code in the ESRIPolygonRecord.java file, but  
>>> the
>>> openmap code already has this modification.
>>>
>>> I am assuming that this problem has to do with the new version since
>>> the application worked just fine before had and I was wondering if
>>> anyone else has ran into this problem using the new version of
>>> openmap?  If you have any tips, suggestions, hints or anything it
>>> would be awsome to hear about them.
>>>
>>> Thanks,
>>>
>>> Jeff
>>>
>>
>> I just wanted to add to my previous post.  I debugged the problem a
>> bit more by adding some print statements to the openmap code to try  
>> to
>> figure out what was causing the problem.  Below is a stack trace from
>> the the construct() method in the LayerWorker class that is defined  
>> in
>> OMGraphicHandlerLayer.
>>
>> java.lang.NullPointerException
>> at
>> com
>> .bbn.openmap.dataAccess.shape.DbfHandler.evaluate(DbfHandler.java:
>> 249)
>> at
>> com
>> .bbn
>> .openmap.layer.shape.SpatialIndex.getOMGraphics(SpatialIndex.java:
>> 519)
>> at com.bbn.openmap.layer.shape.ShapeLayer.prepare(ShapeLayer.java:
>> 522)
>> at
>> com
>> .bbn
>> .openmap
>> .layer
>> .policy.StandardRenderPolicy.prepare(StandardRenderPolicy.java:99)
>> at
>> com.bbn.openmap.layer.OMGraphicHandlerLayer
>> $LayerWorker.construct(OMGraphicHandlerLayer.java:695)
>> at com.bbn.openmap.util.SwingWorker$2.run(SwingWorker.java:127)
>> at java.lang.Thread.run(Unknown Source)
>>
>> In the DbfHandler.evaluate method it seems that this line of code is
>> breaking:
>>
>> Integer index = (Integer)
>> omg.getAttribute(ShapeConstants.SHAPE_INDEX_ATTRIBUTE);
>>
>> Is this caused by a bad dbf file?  Have there been any changes to  
>> this
>> code from the last version?
>>
>> Jeff
>>
>> --
>> [To unsubscribe to this list send an email to "majdart@..."
>> with the following text in the BODY of the message "unsubscribe
>> openmap-users"]
>>
>>
>
> Just wanted to post one more time because I think I know what the  
> problem is
> now and I am trying to figure out a good solution.  The problem that  
> I can
> see is that the openmap code is throwing an exception in the  
> getOMGraphics
> method in the SpatialIndex.java file.  Inside this method there is a  
> section
> of code that says:
>
>                    if (dbf != null) {
>                        omg = dbf.evaluate(omg, labels, mapProj);
>                    }
>
> If i comment this line out my program works like it used to without a
> problem.  I am getting a null pointer out of this line of code.  I  
> specify
> these layers in the openmap properties file and only set the keys
> layerName.shapeFile and layerName.spatialIndex.  What I don't  
> understand is
> how the dbf object is getting set to a non null value.  I would  
> imagin that
> a quick solution would be to set a dbf file in the properties file  
> but I am
> not certain whether there is a key for this.  Is there a  
> "layerName.dbfFile"
> key?
>
> Or can I leave these three lines commented out and just compile  
> openmap like
> this?  will there be any adverse effects by doing this?
>
> Thanks,
>
> Jeff
>
> --
> View this message in context: http://www.nabble.com/Layer-worker-Construct-tp20384571p20430892.html
> Sent from the OpenMap mailing list archive at Nabble.com.
>
> --
> [To unsubscribe to this list send an email to "majdart@..."
> with the following text in the BODY of the message "unsubscribe  
> openmap-users"]

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, dietrick@...
BBN Technologies, Cambridge MA
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



--
[To unsubscribe to this list send an email to "majdart@..."
with the following text in the BODY of the message "unsubscribe openmap-users"]