This content has been marked as final.
Show 5 replies

Re: convert point xy coordinate from degree to metres
vbdeepak Feb 20, 2012 1:44 AM (in response to choilon)Hi choilon ,
In Geometry service there is a method called "Project". With this method we can convert xy coordinates from Decimal Degrees to meters.
public ESRI.ArcGIS.ADF.Web.Geometry.Point projection(ESRI.ArcGIS.ADF.Web.Geometry.Point point)
{
#region projection DECIMAL DEGREES TO METERS
string conection = ConfigurationManager.ConnectionStrings["geom"].ToString();
GeometryServerProxy gsp = new GeometryServerProxy("<geometryserver url>");
SpatialReference inputSpatialReference = new GeographicCoordinateSystem();
// WGS_1984(world) to Mercator
inputSpatialReference.WKID = 4326;// esriSRProjCS_WGS1984WorldMercator WGS 1984 World Mercator.
inputSpatialReference.WKIDSpecified = true;
SpatialReference outputSpatialReference = new ProjectedCoordinateSystem();
outputSpatialReference.WKID = 54004;
outputSpatialReference.WKIDSpecified = true;
GeoTransformation transformation = new GeoTransformation();
// esriSRProjCS_WGS1984WorldMercator TO WGS 1984 World Mercator. AND VICEVERSA
transformation.WKID = 1156;
transformation.WKIDSpecified = true;
ESRI.ArcGIS.ADF.ArcGISServer.Geometry[] inputGeometry = new ESRI.ArcGIS.ADF.ArcGISServer.Geometry[] { ESRI.ArcGIS.ADF.ArcGISServer.Converter.FromAdfPoint((point)) };
bool transformForward = false;
EnvelopeN extent = null;
ESRI.ArcGIS.ADF.ArcGISServer.Geometry[] outputGeometry = gsp.Project(inputSpatialReference, outputSpatialReference, transformForward, transformation, extent, inputGeometry);
ESRI.ArcGIS.ADF.Web.Geometry.Point webpt = ESRI.ArcGIS.ADF.ArcGISServer.Converter.ToAdfPoint(outputGeometry[0] as PointN);
return webpt;
#endregion
}
Try this by changing the input spatial reference and output spatial reference WKID
Regards,
Deepak. 
Re: convert point xy coordinate from degree to metres
ahoqueesristaff Feb 20, 2012 7:47 AM (in response to choilon)Choilon,
You don't need to project your search shape for query operation.
All you need to do is to define the spatialReference for the search shape.
In you case, it should be something likepPoint.SpatialReference = aGCSProjection;
When a search shape's (i.e. pPoint) SpatialReference is not defined, MapServer assumes it is in layer's projection. That's the reason your query is not returning any result.
Tanu 
Re: convert point xy coordinate from degree to metres
choilon Feb 23, 2012 12:37 AM (in response to choilon)Thanks for reply. Actually I have tried to create a new geographiccoodinatesystem and sign to point's spatial reference. It still does not work.
SpatialReference inputSpatialReference = new GeographicCoordinateSystem();
inputSpatialReference.WKID = 4326;
inputSpatialReference.WKIDSpecified = true;
pPoint.spatialreference = inputSpatialReference
The basic problem is my input point and map service use same coordinate system, but point's xy coordinate is in degree. Because the map service unit is in metre, it automatically take x,y input as metre rather than degree.
Point.x = X;  X is input in degree.
Is there an interface or function can convert degree to metre in the same coordinate system?
thanks,
choilon 
Re: convert point xy coordinate from degree to metres
ahoqueesristaff Feb 24, 2012 6:33 AM (in response to choilon)
The basic problem is my input point and map service use same coordinate system, but point's xy coordinate is in degree. Because the map service unit is in metre, it automatically take x,y input as metre rather than degree.
Choilon,
I'm afraid I haven't understood it correctly. You are saying your 'search point' and mapservice are in same coordinate system, but 'search point's coordinates are in degree whereas mapservice in meter!!
Can you provide me a sample data/map and your code for me to take a look at?
Thanks.
Tanu 
Re: convert point xy coordinate from degree to metres
vbdeepak Feb 29, 2012 9:15 PM (in response to choilon)Hi Choilon,
Try to use the project method once. Convert the decimal degree to Meters.
You mentioned the GCS as inputspatial reference, provide map spatial reference as Projected Coordinate System. Then Your decimal degree point will convert into meters.
Regards,
Deepak.