Re: [OpenMap Users] shp to gml3.2.1 (viceversa) conversion tool

From: Don Dietrick <dfdietrick_at_gmail.com>
Date: Tue, 23 Nov 2010 10:37:26 -0500

Sorry, hit send too soon...

2010/11/23 Don Dietrick <dfdietrick_at_gmail.com>:
> Hi Eros,
>
> Sure, you can do something like this:
>
> File shpFile = "/data/cntry02.shp";
> String shpFilePath = shpFile.getAbsolutePath();
>
> EsriGraphicList shapeList =
> EsriGraphicList.getEsriGraphicList(shpFile.toURI().toURL(),
> new DrawingAttributes(),
> DbfTableModel.getDbfTableModel(new
> File(shpFilePath.replaceAll(".shp", ".dbf")).toURI().toURL()),
> null);
>
>
> DbfTableModel dbfTM = shapeList.getAttribute(ShapeConstants.DBF_ATTRIBUTE);
>
> for (EsriGraphic eg : shapeList) {
> Integer index = eg.getAttribute(ShapeConstants.SHAPE_INDEX_ATTRIBUTE);
>

if (eg instanceof EsriPolygon) {
    double[] latlonarray = ((EsriPolygon)eg).getLatLonArray();

    // latlonarray in radians, but don't modify! Make copy, then change copy

   double[] newlla = new double[latlonarray.size];
   System.arraycopy(0, latlonarray, 0, newlla, latlonarray.size());
  ProjMath.arrayRadToDeg(newlla);

// newlla has coords. EsriPoint, EsriLine have different methods for
getting coords, check API

}


>
> // To get dbf information
> Vector<Object> dbfInfo = dbfTM.getRecord(index);
>
> // You can get column information from dbfTM
>
> }
>
>

Hope this helps,

Don




> 2010/11/16 GML$B%A%'%C%/%D!<%k(B <gml.check.tool_at_gmail.com>:
>> Hi Don,
>>
>> Thank you for the reply.
>>
>> It helps me a lot... com.bbn.openmap.dataAccess.shape package is the key
>> for shape reader.
>> Due to difficulties of understanding English documentation...would you
>> share snippet on how to read a shp and dbf to extract the Geometry Info?
>>
>> Thanks and regards,
>> Eros
>> Japan
>>
>> (2010/11/16 23:21), Don Dietrick wrote:
>>> Hello,
>>>
>>> If you'd like to read a shape file, I'd use the
>>> com.bbn.openmap.dataAccess.shape.EsriGraphicList class, and use one of
>>> the static methods getEsriGraphicList(...). That EsriGraphicList is
>>> an OMGraphicList containing all of the objects from the shape file
>>> (.shp), and the contents from the dbf file will be contained in a
>>> DbfTableModel held as an attribute to the EsriGraphicList. The order
>>> of the entries of the list and table model will be the same as the
>>> order in the shape file. The list will contain OMGraphics describing
>>> the geometries (OMPoint, or OMLine, or OMPoly). From there, you can
>>> grab the coordinates from each OMGraphic to write to the GML file.
>>>
>>> Hope this helps,
>>>
>>> Don
>>>
>>> 2010/11/14 GML$B%A%'%C%/%D!<%k(B <gml.check.tool_at_gmail.com>:
>>>> Hi to all,
>>>> I am planning to create a shp to gml3.2.1 conversion tool using java as
>>>> desktop application.
>>>> Due to lack of knowledge in shp file.. please guide me on how to read
>>>> shp file in able traverse it to convert as GML file.
>>>> 1) what java library or classes needed to read a shp file.
>>>> 2) an overview or idea on how to convert it as GML file.
>>>> Thanks a lot.
>>>>
>>>> --
>>>> [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 Tue Nov 23 2010 - 10:38:31 EST

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