Hexagon Geospatial
MENU

GeoMedia Smart Client

GeoMedia Smart Client community discussion board is where you can create, contribute and share information and knowledge in regards to configuring as well as working with GeoMedia Smart Client. Find your answers, share your knowledge and help build a strong GeoMedia Smart Client community.
Showing results for 
Search instead for 
Do you mean 
Reply
Frequent Contributor
Posts: 79
Registered: ‎09-19-2018
Accepted Solution

Editing Geometry: GE_MODIFY Invalid cast from 'System.Int32' to 'Intergraph.Emea.GeoSpatial.Geometry

Hi,

 

 I'm having this issue when I try to modify my geometry.

 

Capture.PNG

 

 

The error log shows 

03.05.2019 16:04:16 ERROR - Controller SmartClient has raised an exception in Action SaveAttributes.
System.InvalidCastException: Invalid cast from 'System.Int32' to 'Intergraph.Emea.GeoSpatial.Geometry'.
   at System.Convert.DefaultToType(IConvertible value, Type targetType, IFormatProvider provider)
   at System.ConvertExtension.ChangeType(Object value, Type conversionType, IFormatProvider provider)
   at Intergraph.Emea.Data.SqlServerProvider.GetValue(Object value, Type conversionType, Object gdoValue, Nullable`1 srid)
   at Intergraph.Emea.Data.SqlServerProvider.GetValue[T](IDataReader reader, String columnName)
   at Intergraph.Emea.Data.Database.<>c__DisplayClass44_0`1.<Select>b__0(DbDataReader reader)
   at Intergraph.Emea.Data.Database.ExecuteReader(String sql, Action`1 readCallback, IEnumerable`1 parameters, DbConnection connection, DbTransaction transaction, String[] spatialColumns)
   at Intergraph.Emea.Data.Database.Select[T](String sql, IEnumerable`1 parameters, DbConnection connection, DbTransaction transaction, String[] spatialColumns)
   at Intergraph.Emea.Data.DatabaseContext.Select[T](String sqlCommand, IEnumerable`1 parameters, String[] spatialColumns)
   at Intergraph.Emea.SmartClient.Workflows.SmartClientController.SaveAttributes(DomainObject domainObject)
   at lambda_method(Closure , ControllerBase , Object[] )
   at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.<BeginInvokeAction>b__1c()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult)

Any reason why there is this invalid cast?

 

Thank you

 

Technical Evangelist
Posts: 1,093
Registered: ‎09-11-2015

Re: Editing Geometry: GE_MODIFY Invalid cast from 'System.Int32' to 'Intergraph.Emea.GeoSpatial.Geom

Hi Eduardo,

 

Can you provide the related Form definition?

DB table DDL could also be handy.

 

Thanks,

Jan

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Frequent Contributor
Posts: 79
Registered: ‎09-19-2018

Re: Editing Geometry: GE_MODIFY Invalid cast from 'System.Int32' to 'Intergraph.Emea.GeoSpatial.Geom

[ Edited ]

Hi Jan,

Thank you for your reply,

this is my table definition:

CREATE TABLE [dbo].[DB_TABLE](

[ID] [int] IDENTITY(1,1) NOT NULL,

[TBL_Code] [varchar](15) NOT NULL,

[Geometry] [varbinary](max) NULL,

[Geometry_SPA] [geometry] NULL,

PRIMARY KEY CLUSTERED

(

[ID] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO

So the DDL is related to simpleid = 2717 as you see in the picture below.

 

Capture.PNG

Thank you.

Staff
Posts: 1,030
Registered: ‎10-19-2015

Re: Editing Geometry: GE_MODIFY Invalid cast from 'System.Int32' to 'Intergraph.Emea.GeoSpatial.Geom

you did not put the name of the formGeometry element, it should be Geometry_SPA in your case, can you please confirm this?

 

Annotazione 2019-05-14 100739.png

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Do you need immediate support?
If you encounter a critical issue and need immediate assistance please submit a Service Request through our Support Portal.