ThinkGeo.com    |     Documentation    |     Premium Support

Map Click Event issues

Hello.  I have two separate issues regarding the Map Click postback event.  The first is in regards to the Edit Layer, and the second is in regards to a MSSQL2008 Layer.



        
  • Edit Layer - In the Page Load event I am moving a feature into the Edit Layer.  The client draws the edit feature just fine and allows the feature to be changed.  The problem, however, occurs on the postback.  I get the following error:


Line: 4724

Char: 21

Error: Sys.WebForms.PageRequestManagerServerErrorException: There was an error deserializing the object of type

 ThinkGeo.MapSuite.WebEdition.JsonFeatureCollection. End element'Value' from namespace " expected. Found   element 'Key' from namespace."


If I remove the edit feature first (using cancellastfeature) and then add a new one I have no problem on the postback.


 



        
  • MSSQL2008 Layer - I have a MSSQL2008 layer on which I want to query the feature which the user clicks.  I am using the GetFeaturesContaining method of the QueryTools object and am getting the following error:


System.Data.SqlClient.SqlException: A .NET Framework error occurred during execution of user-defined routine or aggregate "geometry": System.FormatException: 24305: The Polygon input is not valid because the ring does not have enough distinct points. Each ring of a polygon must contain at least three distinct points. System.FormatException: at Microsoft.SqlServer.Types.Validator.Execute(Transition transition) at Microsoft.SqlServer.Types.Validator.EndFigure() at Microsoft.SqlServer.Types.ForwardingGeoDataSink.EndFigure() at Microsoft.SqlServer.Types.OpenGisWkbReader.ReadLinearRing(ByteOrder byteOrder, FigureAttributes attributes, UInt32 ringNumber) at Microsoft.SqlServer.Types.OpenGisWkbReader.ParseWkbPolygonWithoutHeader(ByteOrder byteOrder) at Microsoft.SqlServer.Types.OpenGisWkbReader.ParseWkb(OpenGisType type) at Microsoft.SqlServer.Types.OpenGisWkbReader.Read(OpenGisType type, Int32 srid) at Microsoft.SqlServer.Types.SqlGeometry.GeometryFromBinary(OpenGisType type, SqlBytes binary, Int32 srid) at Microsoft.SqlServer.Types.SqlGeometry.STGeomFromWKB(SqlBytes wkbGeometry, Int32 srid) . at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.HasMoreRows() at System.Data.SqlClient.SqlDataReader.ReadInternal(Boolean setTimeout) at System.Data.SqlClient.SqlDataReader.Read() at ThinkGeo.MapSuite.Core.MsSql2008FeatureSource.x278e6cfeb3a2b342(BaseShape x8c1dcba6678ab3e6, Int32 x733eadfaaf7df35a, IEnumerable`1 xb3da24dbcff0ab0a) at ThinkGeo.MapSuite.Core.MsSql2008FeatureSource.GetFeaturesInsideBoundingBoxCore(RectangleShape boundingBox, IEnumerable`1 returningColumnNames) at ThinkGeo.MapSuite.Core.FeatureSource.x693b0364c8825b80(BaseShape x8c1dcba6678ab3e6, IEnumerable`1 xb3da24dbcff0ab0a) at ThinkGeo.MapSuite.Core.FeatureSource.SpatialQueryCore(BaseShape targetShape, QueryType queryType, IEnumerable`1 returningColumnNames) at ThinkGeo.MapSuite.Core.FeatureSource.SpatialQuery(BaseShape targetShape, QueryType queryType, IEnumerable`1 returningColumnNames) at ThinkGeo.MapSuite.Core.QueryTools.GetFeaturesContaining(BaseShape targetShape, IEnumerable`1 returningColumnNames) at _Default.Map1_Click(Object sender, MapClickedEventArgs e)


As a separate issue concerning MSSQL2008 layers, have you noticed that these layers tend to load slower than Shapefile layers?  Are there any particular indices that we need to include to ensure optimal performance regarding MSSQL2008 layers?  If you have a Shapefile layer and a MSSQL2008 layer with the same features and tabular data residing on the same computer, which one should perform better?


Thanks for all your help.  I'm really enjoying working with this product.


Binu



Binu,


Thanks for the post and thanks for using our sql2008layer, as seems few people ask questions here:)


I couldn’t recreate your first issue. Could you let me know more about how to recreate it or if you can write a simple sample that’s the best? Here attached is my sample and you can see it works fine.


 


About the 2nd issue, I think your data in SQL 2008 has some problems. Can you reduce the database(remove the rows and columns) and send it to us so we can recreate it? Send to support@thinkgeo.com and ask to forward to Ben if you do not want to post it here.


 


Spatial index can be added to SQL2008 to speed it up. We haven’t spent much time on investigating this but I think you can find a lot of information on internet. For example, here is one link shows how to create the spatial index. We will keep investigating and if we find anything, I will let you know here.   


 


Ben.



112-EditLayerIssueForBinu.zip (96.8 KB)

Ben,


Thank you for the response and the example.  I am able to provide you an example of the first issue I am having with the edit layer.  Using the example you provided, I modified just a few lines of code as follows:



//Feature feature = new Feature("Polygon((-100 0, -50 0, -50 50, -100 50, -100 0))");



shapeFileLayer.Open();


 



Collection<Feature> features = shapeFileLayer.FeatureSource.GetAllFeatures(new string[] { "STATE_ID", "STATE_NAME" });

 


I commented out the feature you manually created and moved a feature from the shapefile layer to the edit layer.  The attached html file (had to rename the extension to txt) shows the error page I receive after clicking the Post button.


I'm still working on providing an example of the MSSQL2008Layer issue.  I'll post an example as soon as I can simplify the problem.


 


Thank you,


Binu


 



shapeFileLayer.Close();


Map1.EditLayer.Features.Add(features[30].Id, features[30]);



114-EditLayerError.txt (17.3 KB)

I previewed my post and it didn’t look as it does now.  The last two lines in my post are part of the code after the GetAllFeatures call.

Binu, 
  
 Thanks for the codes. This problem has been solved in the latest version which will be released in a couple days. Please have another try then. 
  
 Ben. 


I realized the problem is related to passing in column values to the edit layer.  Without the column values it works ok.  I’ve been able to work around this for now. 
  
 Thanks, 
 Binu

Binu, thanks for letting us know. The latest version which will be available pretty soon has completly solved this issue so you can also pass in column values to the edit layer without any exception.


Ben.