RE: [OpenMap Users] How to retrieve names of places from OpenStreetMap data?

From: Bin Liu <liubin79_at_msn.com>
Date: Thu, 19 Jul 2012 16:43:43 +0800

There is no any other exception. In Eclipse: public class GISTest { public static void main(String[] args) {
  // TODO Auto-generated method stub
  com.bbn.openmap.dataAccess.shape.DbfTableModel dbfTable = com.bbn.openmap.dataAccess.shape.DbfFile.getDbfTableModel("d:\\cntry02.dbf");
  System.out.println(dbfTable.getRowCount());
  dbfTable.getColumnCount();
  dbfTable.getRecords();
 }} Console output:251
Exception in thread "main" java.lang.NullPointerException
 at com.bbn.openmap.dataAccess.shape.DbfTableModel.getRecords(DbfTableModel.java:353)
 at GISTest.main(GISTest.java:16)

cntry02.dbf is provided by OpenMap Demo. By the way, the GIS module I mentioned in the first post was developed in Year 2008-2009. There is no com.bbn.openmap.dataAccess.shape.DbfFile. How can I access dbf file in that verson of OpenMap? Thanks!
> Subject: Re: [OpenMap Users] How to retrieve names of places from OpenStreetMap data?
> From: dfdietrick_at_gmail.com
> Date: Mon, 16 Jul 2012 09:37:31 -0400
> CC: openmap-users_at_bbn.com
> To: liubin79_at_msn.com
>
> Hi Liu,
>
> Is there another exception occurring that might be preventing the records from being read?
>
> - Don
>
> On Jul 16, 2012, at 5:22 AM, Bin Liu wrote:
>
> > Now I try to retrieve data from DBF file directly.
> >
> > com.bbn.openmap.dataAccess.shape.DbfTableModel dbfTable = com.bbn.openmap.dataAccess.shape.DbfFile.getDbfTableModel("abc.dbf");
> > for(int i = 0; i < dbfTable.getColumnCount(); i++) {
> > println(dbfTable.getColumnName(i));
> > }
> > println(dbfTable.getRowCount());
> > dbfTable.getValueAt(1,1);
> >
> > getColumnCount(), getColumnName(i) and getRowCount() return correct values. But getValueAt(i,j) or getRecords() will cause java.lang.NullPointerException. The DBF file works fine in DBF Viewer 2000 (http://www.dbf2002.com/).
> >
> > > Subject: Re: [OpenMap Users] How to retrieve names of places from OpenStreetMap data?
> > > From: dfdietrick_at_gmail.com
> > > Date: Fri, 6 Jul 2012 13:15:33 -0400
> > > CC: openmap-users_at_bbn.com
> > > To: liubin79_at_msn.com
> > >
> > > Hi Liu,
> > >
> > > Do you ! know what version of OpenMap the GIS module is using?
> > >
> > > Anyway, the OMGraphic.getAttributes will not give you what you are looking for. Those key-value pairs are stored somewhere else. Each OMGraphic should have a index stored under the com.bbn.openmap.dataAccess.shape.ShapeConstants.SHAPE_INDEX_ATTRIBUTE key. That will tell you the index of the shape from the shape file. The table holding the attributes is stored in the top level list attributes, under the DBF_ATTRIBUTE key. Asking the top level list for the DBF_ATTRIBUTE will get you the DbfTableModel, which holds all the attributes. You can ask it for column information, and for values at particular indexes (which you retrieve from the OMGraphic).
> > >
> > > If you want to use the OpenMap API directly on your shape files, you can use the com.bbn.openmap.dataAccess.shape.EsriGraphicList to create an OMGraphicList from the file that holds the information I've described. That might be a more dire! ct route.
> > >
> > > Hope this helps,
> > >
> > > D! on
> > >
> > > On Jul 4, 2012, at 9:38 AM, Bin Liu wrote:
> > >
> > > > Hi,
> > > >
> > > > I am new to GIS and just start to learn OpenMap. Now I meet a basic problem that is how to get info of places, such as buildings, streets and so on. My work is based on a software having a GIS module based on OpenMap. Using that software's API, I can get the com.bbn.openmap.layer.shape.areas.AreaShapeLayer instance. Then by areaShapeLayer.getAreas().getGraphics().getOMGraphicAt(i), I can access to each OMGraphic, such as OMPoly and OMPoint. But oMGraphic.getAttributes() returns null, which I expected to get the Key-Value Map info. My sample data is OpenStreetMap data from http://metro.teczno.com/, and I convert it to shp and dbf files by Quantum GIS with OpenStreetMap plugin. In both OpenStreetMap and Quantum, I can read place info, such as ABC school or XYZ hospital. In my software with OpenMap module, I can also see the signs of places, like OMPoint? But I ! need to know how to retrieve these info, like names by Op! enMap API. Please Help!
> > > >
> > > > Best regards,
> > > > Liu, Bin
> > > >
> > >
> > > --
> > > [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"]
>
                                               

--
[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 Thu Jul 19 2012 - 04:44:39 EDT

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