[mapguide-users] MSSqlServer Spatial problem

zolinko zolinko at freemail.hu
Thu Jun 25 05:53:13 EDT 2009


Hi,
Thanks for your answer,

A test code is here at the end. (I use custom geomtry parser to craete
geometry, but I checked, that it creates valid geometry.)
Simply the next row doesn't return:
MgPropertyCollection propColl = fSrv.UpdateFeatures(cspResId, commands,
false);

Trace, Error and the other logs are at max level. Error log doesn't contain
anything.
Trace log contains only the following rows:
<2009-06-25T11:01:02.016975> 	2964	MgServerFeatureService::UpdateFeatures()
<2009-06-25T11:01:02.016975> 	2964
MgServerResourceService::CheckPermission()
<2009-06-25T11:01:02.016975> 	2964
MgServerResourceService::CheckPermission()
And then nothing.

By the way, I can read the FeatureSource very well. Also have run a test,
that used directly the Spatial FDO provider (code in C#), and that
succeeded.
(In the FDO api there were no AGF format, instead of that, there was a FGF
(fdo geometry format)). Maybe this causes the problem, I mean the wrong
format?...

We use HUN-EOV72-7P (Hungary, Uniform National Projection System of 1972)
coordinate system (SRID 23700), but it seems to be working very well (we can
view the stored data in maps).

Any further idea?
TIA, 
zolinko


And the sample code:

double kcspX = 100000;
double kcspY = 600000;
double mcspX = 300000;
double mcspY = 600000;
double vcspX = 300000;
double vcspY = 900000;

String fsName = "Library://TEST/Data/TESTDB.FeatureSource";
MgResourceIdentifier resId = new MgResourceIdentifier(fsName);
MgFeatureCommandCollection commands = new MgFeatureCommandCollection();
MgAgfReaderWriter agfRW = new MgAgfReaderWriter();
MgLineString geomL = null;

//Create New geometry With Custom Parser
coordsString = "3" + GeometryConsts.GEOM_COORD_COUNT_SEPARATOR;
coordsString +=
	kcspX + GeometryConsts.GEOM_COORD_SEPARATOR + kcspY +
		GeometryConsts.GEOM_MAIN_COORD_SEPARATOR +
	mcspX + GeometryConsts.GEOM_COORD_SEPARATOR + mcspY +
		GeometryConsts.GEOM_MAIN_COORD_SEPARATOR +
	vcspX + GeometryConsts.GEOM_COORD_SEPARATOR + vcspY;
geomL = (MgLineString)GeometryParser.parseString(coordsString,
MgGeometryType.LineString);
//TESTED: geomL.IsValid() == true

MgCoordinateCollection coordsCollL = new MgCoordinateCollection();
MgCoordinateIterator coordItL = geomL.GetCoordinates();
while(coordItL.MoveNext()) coordsCollL.Add(coordItL.GetCurrent());

MgGeometryFactory geomFactory = new MgGeometryFactory();
MgLineString newGeomL = geomFactory.CreateLineString(coordsCollL);

//GEOMETRY PROPERTY UPDATE
MgPropertyCollection props = new MgPropertyCollection();
props.Add(new MgGeometryProperty("SDOOBJ", agfRW.Write(newGeomL)));

//setting up command
commands.Add(new MgUpdateFeatures("FDO_SCHEMA:GM_LINES", props, "L_ID =
'1000'"));

MgPropertyCollection propColl = fSrv.UpdateFeatures(resId, commands, false);
MgProperty result = propColl.GetItem(0);
if (result.GetPropertyType() == MgPropertyType.Int32)
{
	//OK
	System.out.println("Updated: "+((MgInt32Property)result).GetValue()+"
objects.");
}
else	
{
	if (result.GetPropertyType() == MgPropertyType.String) //ERROR
	{
		System.out.println(((MgStringProperty)result).GetValue());
	}
}



Dave Wilson wrote:
> 
> What coordinate system is your data in? Apparently SQL Server has 2
> geometry types, Geometry and Geography. Geography is used for Lat Long
> based data. I haven't worked with inserts and the new provider so I don't
> know if there is anything special about it. Are you inserting features one
> by one? Attaching your code might help.
> 
> Regards,
> Dave
> 

-- 
View this message in context: http://n2.nabble.com/MSSqlServer-Spatial-problem-tp3148712p3154109.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list