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

From: B <gml.check.tool_at_gmail.com>
Date: Thu, 06 Jan 2011 13:18:28 +0900

Hi,

Thanks a lot to Don for guiding to right direction on how to read the
shp and dbf files
to extract the Geographic Objects (point, line, polygon)..

But I have problem design on how to output the customized tags such as
Earthquake, EarthquakeMotionMesh tags etc..
I am thinking of putting the customized tags(tag names, as well as the
child tags) information to dbf during shape to gml conversion..

Please guide me the right direction on how to support it..
Thanks in advance..

Eros

(2010/11/24 9:51), GML$B%A%'%C%/%D!<%k(B wrote:
> Hi Don,
>
> Thanks a lot for complete snippet..
> it's cool...and look easy to extract the information I need from shp and
> dbf file using openMap.
> Now, I opted to use openMap java library for shp reader..
>
> Regarding on how to convert it to gml3.2.1, I am thinking of using
> VTD-XML library to write the extracted
> info to a file (xml). Do you have recommendation or would you share
> better approach on how to do it?
>
> I am worrying on how to extract the customized xml tag (features) from
> shp/dbf file..
> Here's the gml file to be converted to shp and vice versa (expected
> output from shp to gml).
> Would you take a look at <cao:Earthquake> tag and other cao tag...
>
> <?xml version="1.0" encoding="UTF-8"?>
> <cao:Dataset gml:id="earthquake"
> xmlns:cao="http://www.cao.go.jp/schemas/mieruka/gml"
> xmlns:gml="http://www.opengis.net/gml/3.2"
> xmlns:xlink="http://www.w3.org/1999/xlink"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.cao.go.jp/schemas/mieruka/gml
> Earthquake.xsd">
> <gml:description>Earthquake damage hypothesis data</gml:description>
> <gml:boundedBy>
> <gml:EnvelopeWithTimePeriod srsName="JGD2000 / (B, L)" frame="GC / JST">
> <gml:lowerCorner>24.03 122.93</gml:lowerCorner>
> <gml:upperCorner>45.52 145.82</gml:upperCorner>
> <gml:beginPosition calendarEraName="AD">2010</gml:beginPosition>
> <gml:endPosition calendarEraName="AD">2010</gml:endPosition>
> </gml:EnvelopeWithTimePeriod>
> </gml:boundedBy>
> <gml:Point gml:id="pt_1">
> <gml:pos>35.682417 139.75306</gml:pos>
> </gml:Point>
> <gml:Grid gml:id="grid" dimension = "2">
> <gml:description>1/10 boundary</gml:description>
> <gml:limits>
> <gml:GridEnvelope>
> <gml:low>0 0</gml:low>
> <gml:high>9 9</gml:high>
> </gml:GridEnvelope>
> </gml:limits>
> <gml:axisLabels>x y</gml:axisLabels>
> </gml:Grid>
> <gml:CompositeValue gml:id="recordType">
> <gml:valueComponents>
> <gml:CategoryList>meshcode</gml:CategoryList>
> <gml:CategoryList>earthquakescaleclass</gml:CategoryList>
> <gml:QuantityList uom="scale">meassure</gml:QuantityList>
> <gml:QuantityList uom="%">scaleincrease</gml:QuantityList>
> <gml:QuantityList uom="gal">groundmaxacceleration</gml:QuantityList>
> <gml:QuantityList uom="gal">basemaxacceleration</gml:QuantityList>
> <gml:QuantityList uom="kine">groundmaxrate</gml:QuantityList>
> <gml:QuantityList uom="kine">basemaxrate</gml:QuantityList>
> <gml:QuantityList uom="kine">SIvalue</gml:QuantityList>
> <gml:QuantityList uom="cm">displacement</gml:QuantityList>
> </gml:valueComponents>
> </gml:CompositeValue>
> <cao:Earthquake gml:id="fi_1">
> <cao:earthquakeName>earthquake1</cao:earthquakeName>
> <cao:projectName>earthquake1DamageResearch</cao:projectName>
> <cao:date>
> <gml:TimeInstant gml:id="ti_1">
> <gml:timePosition>2010-10-00</gml:timePosition>
> </gml:TimeInstant>
> </cao:date>
> <cao:length>10.0</cao:length>
> <cao:width>11.1</cao:width>
> <cao:depth>12.2</cao:depth>
> <cao:strikeAngle>13.3</cao:strikeAngle>
> <cao:dip>14.4</cao:dip>
> <cao:angleOfSlide>15.4</cao:angleOfSlide>
> <cao:slideDepth>15.5</cao:slideDepth>
> <cao:earthquakeMoment>16.6</cao:earthquakeMoment>
> <cao:magnitude>5.5</cao:magnitude>
> <cao:faultControlPoint xlink:href="#pt_1"/>
> <cao:note>memo</cao:note>
> <cao:EarthquakeMotionMesh>
> <cao:EarthquakeMotionMesh gml:id="mesh_1">
> <gml:gridDomain xlink:href="#grid"/>
> <gml:rangeSet>
> <gml:DataBlock>
> <gml:rangeParameters xlink:href="#recordType"/>
> <gml:tupleList>
> 5339463400,0,1,5,6,100,50,1,2
> 5339463401,1,1,5,6,100,50,1,2
> 5339463402,2,1,5,6,100,50,1,2
> 5339463403,3,1,5,6,100,50,1,2
> 5339463404,4,1,5,6,100,50,1,2
> 5339463405,5-lower,1,5,6,100,50,1,2
> 5339463406,5-upper,1,5,6,100,50,1,2
> 5339463407,6-lower,1,5,6,100,50,1,2
> 5339463408,6-upper,1,5,6,100,50,1,2
> 5339463409,7,1,5,6,100,50,1,2
> ..
> 5339463499,0,1,5,6,100,50,1,2
> </gml:tupleList>
> </gml:DataBlock>
> </gml:rangeSet>
> <gml:coverageFunction>
> <gml:GridFunction>
> <gml:sequenceRule axisOrder="+1 +2">Linear</gml:sequenceRule>
> <gml:startPoint>0 0</gml:startPoint>
> </gml:GridFunction>
> </gml:coverageFunction>
> <cao:upperLevelMeshCode>53394634</cao:upperLevelMeshCode>
> </cao:EarthquakeMotionMesh>
> </cao:EarthquakeMotionMesh>
> </cao:Earthquake>
> </cao:Dataset>
>
> In order to convert it from shp to gml, I need to determine the
> customized tag names... and my idea is
> to include it (tag names...attributes...values...etc..) to dbf file...
> then extract it during shp reading process..
>
> is there better approach on how to do it? please share some comments..
>
> thanks a lot...
>
>
> (2010/11/24 0:37), Don Dietrick wrote:
>> 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 Wed Jan 05 2011 - 23:20:34 EST

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