Re: [OpenMap Users] tests for TIGER Shape files and associated?

From: Don Dietrick <dietrick_at_bbn.com>
Date: Tue, 14 Oct 2008 02:18:24 -0400

Hi Ray,

Answers below...

On Oct 11, 2008, at 8:04 PM, Ray Kiddy wrote:

>
> Hello -
>
> I am new to OM, but have worked with several other java frameworks
> over the years. OM looks really good in a lot of ways. I think I see
> things that could be improved, but there is a lot of good stuff
> there that I want to understand first.
>
> I usually try to understand a framework by running and/or writing
> tests. Are there unit tests, now, for the data classes in particular?

Kind of. Most data classes have main methods that allow for some
direct testing on data sources, but there's nothing formal and as you
point out, often undocumented.

> I am more of a data guy, so right now I am looking at the data in
> TIGER files (eg ftp://ftp2.census.gov/geo/tiger/TIGER2007FE/06_CALIFORNIA/06085_Santa_Clara/fe_2007_06085_edges.zip)
> and I am trying to open and get data out of the shp and dbf files.
>
> I saw that the com.bbn.openmap.layer.shape.ShapeFile class has a
> main that can be invoked on the command line.
>
> % java -classpath $lib/openmap.jar
> com.bbn.openmap.layer.shape.ShapeFile $dir/06085_Santa_Clara/
> fe_2007_06085_edges.shp
> Shape file: /Users/ray/openmap/06085_Santa_Clara/
> fe_2007_06085_edges.shp
> version: 1000
> length: 7577012
> bounds:
> min: ESRIPoint[-122.202476,36.894155]
> max: ESRIPoint[-121.208178,37.484637]
> records: 76910
> %
>
> Very cool!
>
> I see that there is a main method in
> com.bbn.openmap.dataAccess.shape.DbfFile, but it launches an app
> with a UI. Also, accessing that main from the command-line is not
> documented.
>
> I am interested in using the OM framework for, at first, data access
> only. Is this not a common use? The mixing of data and view
> functionality throughout the framework would seem to suggest that. I
> am used to framework that separate Model, View and Controller
> classes, but there are probably good reasons for why this was not
> done here. Are there things to watch out for if one is ony trying to
> get to the data and not create a UI at the same time?

You can use OpenMap components for data access only. The components
that read the data can also display them if they are added to a GUI,
but you don't have to add them to anything.

> The shp files seem, at least at this initial point, to be well-
> structured and I can get data out of them. But I am trying to get
> info out the DBF files and even something simple like getting a
> record iterator gets me an NPE, which seems not good....

You should be able to use a EsriGraphicList to read a shp file and a
DbfFile or DbfHandler to read the dbf file. The DbfFile can be used
to read the entire dbf file, the DbfHandler is good for setting up
content filters.

> If anyone has suggestions for how to start this, I would be
> interested in creating unit tests that take data known to be good
> and demonstrate and verify the various ways to access the data.
> Obviously I am looking at the TIGER data, but there may be problems
> with that data of which I am not aware. Does anyone have other
> suggestions?

The Layer/Plugin class usually serve as examples of how to use the
data accessing classes. For Shape data, I'd look at the ShapeLayer
and SpatialIndex classes to see how they use EsriGraphicList and
DbfHandler/DbfFile. The com.bbn.openmap.plugin.esri.EsriPlugIn is
also a decent example.

Hope this helps,

Don

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, dietrick_at_bbn.com
BBN Technologies, Cambridge MA
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



--
[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 Oct 14 2008 - 02:18:46 EDT

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