restoring/loading spatial data from XML

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

restoring/loading spatial data from XML

Mark Prins
Hi,
I have an XML dataset that contains geometry data in WKB [1] in some
fields that I want to load into an Oracle schema but I'm running into a
TypeCastException while loading the data:


org.dbunit.dataset.datatype.TypeCastException: Unable to typecast value
<010600002040710000010000000103000000010000000D000000022B8716B81D0C417F6ABCF450D31C41D7A3703D301D0C41A8C64B37F5D21C41C3F5285C1B1E0C4196438B6CA1D21C416DE7FBA9651E0C41295C8F427BD21C411283C0CAA51E0C41CBA14536A3D21C414E621058911E0C41BA490C02B3D21C4139B4C8763C1E0C41B4C876BEC6D21C416F1283C0901D0C410AD7A3F003D31C41B81E85EB611E0C41C1CAA14591D31C41621058396A1F0C410E2DB21D36D31C41B81E85EB7E1F0C413BDF4F8D3DD31C410AD7A370431E0C4177BE9F1AAFD31C41022B8716B81D0C417F6ABCF450D31C41>
of type <java.lang.String> to SDO_GEOMETRY


for eg.

...
<value>I</value>
<value>010600002040710000010000000103000000010000000D000000022B8716B81D0C417F6ABCF450D31C41D7A3703D301D0C41A8C64B37F5D21C41C3F5285C1B1E0C4196438B6CA1D21C416DE7FBA9651E0C41295C8F427BD21C411283C0CAA51E0C41CBA14536A3D21C414E621058911E0C41BA490C02B3D21C4139B4C8763C1E0C41B4C876BEC6D21C416F1283C0901D0C410AD7A3F003D31C41B81E85EB611E0C41C1CAA14591D31C41621058396A1F0C410E2DB21D36D31C41B81E85EB7E1F0C413BDF4F8D3DD31C410AD7A370431E0C4177BE9F1AAFD31C41022B8716B81D0C417F6ABCF450D31C41</value>
<value>010100002040710000F4FDD4782F1E0C41A245B673B7D21C41</value>
</row>
...


Is there any way to make DBunit work with this?
Would I need to extend OracleSdoGeometryDataType#typeCast(Object) to
return (SDO_UTIL.FROM_WKBGEOMETRY('WKB')) [2]
It seem that currently OracleSdoGeometryDataType can only handle the
struct form of sdo_geomtery

Note, this is for cross-database testing; I currently have this working
for PostgreSQL and would like to keep using the same xml source across
differnt DB flavors.


[1]
https://github.com/B3Partners/brmo/pull/309/files#diff-bd3feaac03224d364fb76e7f547023c3R112

[2]
https://docs.oracle.com/database/121/SPATL/GUID-4BF848D3-739F-4994-B364-C0171B69EE04.htm#SPATL1233

------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: restoring/loading spatial data from XML

Mark Prins
On 10-03-17 16:56, Mark Prins wrote:

> Hi,
> I have an XML dataset that contains geometry data in WKB [1] in some
> fields that I want to load into an Oracle schema but I'm running into a
> TypeCastException while loading the data:
>
>
> org.dbunit.dataset.datatype.TypeCastException: Unable to typecast value
> <010600002040710000010000000103000000010000000D000000022B8716B81D0C417F6ABCF450D31C41D7A3703D301D0C41A8C64B37F5D21C41C3F5285C1B1E0C4196438B6CA1D21C416DE7FBA9651E0C41295C8F427BD21C411283C0CAA51E0C41CBA14536A3D21C414E621058911E0C41BA490C02B3D21C4139B4C8763C1E0C41B4C876BEC6D21C416F1283C0901D0C410AD7A3F003D31C41B81E85EB611E0C41C1CAA14591D31C41621058396A1F0C410E2DB21D36D31C41B81E85EB7E1F0C413BDF4F8D3DD31C410AD7A370431E0C4177BE9F1AAFD31C41022B8716B81D0C417F6ABCF450D31C41>
> of type <java.lang.String> to SDO_GEOMETRY
>
>
> for eg.
>
> ...
> <value>I</value>
> <value>010600002040710000010000000103000000010000000D000000022B8716B81D0C417F6ABCF450D31C41D7A3703D301D0C41A8C64B37F5D21C41C3F5285C1B1E0C4196438B6CA1D21C416DE7FBA9651E0C41295C8F427BD21C411283C0CAA51E0C41CBA14536A3D21C414E621058911E0C41BA490C02B3D21C4139B4C8763C1E0C41B4C876BEC6D21C416F1283C0901D0C410AD7A3F003D31C41B81E85EB611E0C41C1CAA14591D31C41621058396A1F0C410E2DB21D36D31C41B81E85EB7E1F0C413BDF4F8D3DD31C410AD7A370431E0C4177BE9F1AAFD31C41022B8716B81D0C417F6ABCF450D31C41</value>
>
> <value>010100002040710000F4FDD4782F1E0C41A245B673B7D21C41</value>
> </row>
> ...
>
>
> Is there any way to make DBunit work with this?
> Would I need to extend OracleSdoGeometryDataType#typeCast(Object) to
> return (SDO_UTIL.FROM_WKBGEOMETRY('WKB')) [2]
> It seem that currently OracleSdoGeometryDataType can only handle the
> struct form of sdo_geomtery
>
> Note, this is for cross-database testing; I currently have this working
> for PostgreSQL and would like to keep using the same xml source across
> differnt DB flavors.

Alternatively any suggestions for another common, cross-database format
for encoding geometry in an XmlDataSet are welcome.
Mark



------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user