Unknown type: CURVEPOLYGON

Unknown type: CURVEPOLYGON

Postby danicor » Thu 22 May 2014 12:28

Hi everybody,

I'm using the trial of dotConnect for Oracle 8.3.161 and get the following error when reading from database:

"Unknown type: CurvePolygon"

I set NetTopologySuite as spatial service. What options do I have? It's important to map these objects to purchase the product.

Thanks.
danicor
 
Posts: 2
Joined: Thu 22 May 2014 12:20

Re: Unknown type: CURVEPOLYGON

Postby Shalex » Mon 26 May 2014 14:07

The CurvePolygon type is not supported by NetTopologySuite (and SharpMap) spatial service.

As a workaround, use Extended Well-Known Text (EWKT) spatial service instead. For this, replace NetTopologySuite with EWKT in *.config of your application:
Code: Select all
    <SpatialOptions SpatialServiceType="ExtendedWellKnownText" AlwaysUseGeographyDefaultSrid="true" GeographyDefaultSrid="4326" />

There is a limitation of this approach: you can use LINQ to Entities functionality but don't talk to the properties of the DbGeometry/DbGeography objects retrieved from database.
Shalex
Devart Team
 
Posts: 7530
Joined: Thu 14 Aug 2008 12:44

Re: Unknown type: CURVEPOLYGON

Postby danicor » Wed 28 May 2014 09:32

Ok...

But how can I do a database insert using Entity Framework and EWKT?

Thx
danicor
 
Posts: 2
Joined: Thu 22 May 2014 12:20

Re: Unknown type: CURVEPOLYGON

Postby Shalex » Tue 03 Jun 2014 08:11

Here is a simple walkthrough:

1. Create a table in the database
Code: Select all
CREATE TABLE SPATIALTABLE(
  ID NUMBER PRIMARY KEY,
  GEOMCOLUMN MDSYS.SDO_GEOMETRY);

2. Right click on your project in Solution Explorer > Add > New Item > Data > Devart Entity Model, go through the wizard and add the SPATIALTABLE table in your model.

3. EITHER add this in your *.config
Code: Select all
<configuration>
  <configSections>
    <section name="Devart.Data.Oracle.Entity" type="Devart.Data.Oracle.Entity.Configuration.OracleEntityProviderConfigurationSection, Devart.Data.Oracle.Entity, Version=8.3.161.6, Culture=neutral, PublicKeyToken=09af7300eec23701" />
  </configSections>
  <Devart.Data.Oracle.Entity xmlns="http://devart.com/schemas/Devart.Data.Oracle.Entity/1.0">
    <SpatialOptions SpatialServiceType="ExtendedWellKnownText" AlwaysUseGeographyDefaultSrid="true" GeographyDefaultSrid="4326"/>
  </Devart.Data.Oracle.Entity>
</configuration>
Replace 8.3.161.6 with your actual version.

OR use the configuration option in the code
Code: Select all
    var config = OracleEntityProviderConfig.Instance;
    config.SpatialOptions.SpatialServiceType = SpatialServiceType.ExtendedWellKnownText;

4. This code inserts a record in the SPATIALTABLE table
Code: Select all
    using (MyDbContext context = new MyDbContext()) {
        SPATIALTABLE st = new SPATIALTABLE();
        st.ID = 1;
        st.GEOMCOLUMN = System.Data.Entity.Spatial.DbGeometry.FromText(
                @"SRID=0;CURVEPOLYGON(CIRCULARSTRING(143.62025166838282 -30.037497356076827,142.92857147299705 -32.75101196874403, 145.96132309891922
                -34.985671061528784, 149.57565307617188 -33.41153335571289,149.41972407584802 -29.824672680573517, 146.1209416055467
                -30.19711586270431, 143.62025166838282 -30.037497356076827),(144.84399355252685 -31.26123924022086, 144.20551952601693 -32.27215644886158, 145.55230712890625
                -33.49203872680664, 147.97080993652344 -32.03618621826172, 146.38697244992585 -31.47406391572417, 144.84399355252685 -31.26123924022086))");
        context.SPATIALTABLEs.Add(st);
        context.SaveChanges();
    }
Shalex
Devart Team
 
Posts: 7530
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for Oracle