[mapguide-commits] r9225 - in sandbox/jng/geoprocessing: Common/PlatformBase/Services UnitTest/WebTier/MapAgent/MapAgentForms Web/src/HttpHandler
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Sun Jun 25 06:45:50 PDT 2017
Author: jng
Date: 2017-06-25 06:45:50 -0700 (Sun, 25 Jun 2017)
New Revision: 9225
Modified:
sandbox/jng/geoprocessing/Common/PlatformBase/Services/GeoJsonWriter.cpp
sandbox/jng/geoprocessing/Common/PlatformBase/Services/GeoJsonWriter.h
sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/binaryoperationform.html
sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/boundaryform.html
sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/bufferform.html
sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/convexhullform.html
sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/selectaggregatesform.html
sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/selectfeaturesform.html
sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/simplifyform.html
sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/tessellateform.html
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBinaryOperation.cpp
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBinaryOperation.h
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBoundary.cpp
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBoundary.h
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBuffer.cpp
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBuffer.h
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoConvexHull.cpp
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoConvexHull.h
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoSimplify.cpp
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoSimplify.h
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoTessellate.cpp
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoTessellate.h
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpResourceStrings.cpp
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpResourceStrings.h
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpSelectFeatures.cpp
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpSelectFeatures.h
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpSelectFeaturesSpatially.cpp
sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpSelectFeaturesSpatially.h
sandbox/jng/geoprocessing/Web/src/HttpHandler/ReaderByteSourceImpl.cpp
sandbox/jng/geoprocessing/Web/src/HttpHandler/ReaderByteSourceImpl.h
Log:
Add support for configurable coordinate precision for all mapagent operations that output GeoJSON. By default, this is 7 which is generally a good enough level of precision as any extra decimals beyond this amount is superfluous and adds to the response payload size.
The MgGeoJsonWriter class also supports configurable coordinate precision via a new SetPrecision() API.
Modified: sandbox/jng/geoprocessing/Common/PlatformBase/Services/GeoJsonWriter.cpp
===================================================================
--- sandbox/jng/geoprocessing/Common/PlatformBase/Services/GeoJsonWriter.cpp 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/Common/PlatformBase/Services/GeoJsonWriter.cpp 2017-06-25 13:45:50 UTC (rev 9225)
@@ -6,8 +6,13 @@
MgGeoJsonWriter::MgGeoJsonWriter()
{
m_agfRw = new MgAgfReaderWriter();
+ m_precision = 7;
}
+INT32 MgGeoJsonWriter::GetPrecision() { return m_precision; }
+
+void MgGeoJsonWriter::SetPrecision(INT32 precision) { m_precision = precision; }
+
STRING MgGeoJsonWriter::FeatureToGeoJson(MgFeatureReader* featureReader, MgTransform* transform)
{
Ptr<MgClassDefinition> clsDef = featureReader->GetClassDefinition();
@@ -216,6 +221,7 @@
case MgPropertyType::Double:
{
double val = reader->GetDouble(index);
+ //NOTE: Not applying precision here as that is for coordinate output
MgUtil::DoubleToString(val, str);
}
break;
@@ -384,9 +390,9 @@
{
str = L"[";
STRING sx;
- MgUtil::DoubleToString(coord->GetX(), sx);
+ MgUtil::DoubleToString(coord->GetX(), sx, m_precision);
STRING sy;
- MgUtil::DoubleToString(coord->GetY(), sy);
+ MgUtil::DoubleToString(coord->GetY(), sy, m_precision);
str += sx;
str += L", ";
str += sy;
@@ -406,9 +412,9 @@
str += L"[";
STRING sx;
- MgUtil::DoubleToString(coord->GetX(), sx);
+ MgUtil::DoubleToString(coord->GetX(), sx, m_precision);
STRING sy;
- MgUtil::DoubleToString(coord->GetY(), sy);
+ MgUtil::DoubleToString(coord->GetY(), sy, m_precision);
str += sx;
str += L", ";
str += sy;
Modified: sandbox/jng/geoprocessing/Common/PlatformBase/Services/GeoJsonWriter.h
===================================================================
--- sandbox/jng/geoprocessing/Common/PlatformBase/Services/GeoJsonWriter.h 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/Common/PlatformBase/Services/GeoJsonWriter.h 2017-06-25 13:45:50 UTC (rev 9225)
@@ -108,6 +108,49 @@
///
STRING FeatureToGeoJson(MgReader* reader, MgTransform* transform, CREFSTRING idPropertyName, CREFSTRING geomPropName);
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Converts the current feature in the given feature reader to GeoJSON
+ ///
+ /// <!-- Syntax in .Net, Java, and PHP -->
+ /// \htmlinclude DotNetSyntaxTop.html
+ /// void SetPrecision(int precision);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude JavaSyntaxTop.html
+ /// void SetPrecision(int precision);
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude PHPSyntaxTop.html
+ /// void SetPrecision(int precision);
+ /// \htmlinclude SyntaxBottom.html
+ ///
+ /// \param precision (int)
+ /// The decimal precision to write out coordinates
+ ///
+ /// \return
+ /// Returns the GeoJSON output as a string.
+ ///
+ void SetPrecision(INT32 precision);
+
+ //////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Converts the current feature in the given feature reader to GeoJSON
+ ///
+ /// <!-- Syntax in .Net, Java, and PHP -->
+ /// \htmlinclude DotNetSyntaxTop.html
+ /// int GetPrecision();
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude JavaSyntaxTop.html
+ /// int GetPrecision();
+ /// \htmlinclude SyntaxBottom.html
+ /// \htmlinclude PHPSyntaxTop.html
+ /// int GetPrecision();
+ /// \htmlinclude SyntaxBottom.html
+ ///
+ /// \return
+ /// Returns the current precision
+ ///
+ INT32 GetPrecision();
+
INTERNAL_API:
STRING GeometryToGeoJson(MgGeometry* geom);
@@ -126,6 +169,7 @@
void MultiPolygonToGeoJson(MgMultiPolygon* multi, REFSTRING str);
Ptr<MgAgfReaderWriter> m_agfRw;
+ INT32 m_precision;
};
/// \}
Modified: sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/binaryoperationform.html
===================================================================
--- sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/binaryoperationform.html 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/binaryoperationform.html 2017-06-25 13:45:50 UTC (rev 9225)
@@ -34,6 +34,8 @@
<input type="text" name="COORDINATESYSTEM" value="" size="10">
<p> Output Coordinate System (CS-Map Code):
<input type="text" name="TRANSFORMTO" value="" size="10">
+<p> Coordinate Precision (if requesting GeoJSON):
+<input type="text" name="PRECISION" value="7" size="10">
<p>
<input type="submit" value="Submit" onclick="SetActionTarget()"> <input type="reset">
</form>
Modified: sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/boundaryform.html
===================================================================
--- sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/boundaryform.html 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/boundaryform.html 2017-06-25 13:45:50 UTC (rev 9225)
@@ -25,6 +25,8 @@
<input type="text" name="COORDINATESYSTEM" value="" size="10">
<p> Output Coordinate System (CS-Map Code):
<input type="text" name="TRANSFORMTO" value="" size="10">
+<p> Coordinate Precision (if requesting GeoJSON):
+<input type="text" name="PRECISION" value="7" size="10">
<p>
<input type="submit" value="Submit" onclick="SetActionTarget()"> <input type="reset">
</form>
Modified: sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/bufferform.html
===================================================================
--- sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/bufferform.html 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/bufferform.html 2017-06-25 13:45:50 UTC (rev 9225)
@@ -34,6 +34,8 @@
<input type="text" name="COORDINATESYSTEM" value="" size="10">
<p> Output Coordinate System (CS-Map Code):
<input type="text" name="TRANSFORMTO" value="" size="10">
+<p> Coordinate Precision (if requesting GeoJSON):
+<input type="text" name="PRECISION" value="7" size="10">
<p>
<input type="submit" value="Submit" onclick="SetActionTarget()"> <input type="reset">
</form>
Modified: sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/convexhullform.html
===================================================================
--- sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/convexhullform.html 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/convexhullform.html 2017-06-25 13:45:50 UTC (rev 9225)
@@ -25,6 +25,8 @@
<input type="text" name="COORDINATESYSTEM" value="" size="10">
<p> Output Coordinate System (CS-Map Code):
<input type="text" name="TRANSFORMTO" value="" size="10">
+<p> Coordinate Precision (if requesting GeoJSON):
+<input type="text" name="PRECISION" value="7" size="10">
<p>
<input type="submit" value="Submit" onclick="SetActionTarget()"> <input type="reset">
</form>
Modified: sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/selectaggregatesform.html
===================================================================
--- sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/selectaggregatesform.html 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/selectaggregatesform.html 2017-06-25 13:45:50 UTC (rev 9225)
@@ -37,6 +37,8 @@
</select>
<p>
Clean JSON: <input type="text" name="CLEAN" value="0" ID="TextClean">
+ <p> Coordinate Precision (if requesting clean JSON):
+ <input type="text" name="PRECISION" value="7" size="10">
<p>
<input type="submit" value="Submit" onclick="SetActionTarget()"> <input type="reset">
</form>
Modified: sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/selectfeaturesform.html
===================================================================
--- sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/selectfeaturesform.html 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/selectfeaturesform.html 2017-06-25 13:45:50 UTC (rev 9225)
@@ -37,6 +37,8 @@
</select>
<p>
Clean JSON: <input type="text" name="CLEAN" value="0" ID="TextClean">
+ <p> Coordinate Precision (if requesting clean JSON):
+ <input type="text" name="PRECISION" value="7" size="10">
<p>
<input type="submit" value="Submit" onclick="SetActionTarget()"> <input type="reset">
</form>
Modified: sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/simplifyform.html
===================================================================
--- sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/simplifyform.html 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/simplifyform.html 2017-06-25 13:45:50 UTC (rev 9225)
@@ -32,6 +32,8 @@
<input type="text" name="COORDINATESYSTEM" value="" size="10">
<p> Output Coordinate System (CS-Map Code):
<input type="text" name="TRANSFORMTO" value="" size="10">
+<p> Coordinate Precision (if requesting GeoJSON):
+<input type="text" name="PRECISION" value="7" size="10">
<p>
<input type="submit" value="Submit" onclick="SetActionTarget()"> <input type="reset">
</form>
Modified: sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/tessellateform.html
===================================================================
--- sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/tessellateform.html 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/UnitTest/WebTier/MapAgent/MapAgentForms/tessellateform.html 2017-06-25 13:45:50 UTC (rev 9225)
@@ -25,6 +25,8 @@
<input type="text" name="COORDINATESYSTEM" value="" size="10">
<p> Output Coordinate System (CS-Map Code):
<input type="text" name="TRANSFORMTO" value="" size="10">
+<p> Coordinate Precision (if requesting GeoJSON):
+<input type="text" name="PRECISION" value="7" size="10">
<p>
<input type="submit" value="Submit" onclick="SetActionTarget()"> <input type="reset">
</form>
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBinaryOperation.cpp
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBinaryOperation.cpp 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBinaryOperation.cpp 2017-06-25 13:45:50 UTC (rev 9225)
@@ -31,6 +31,10 @@
m_format = params->GetParameterValue(MgHttpResourceStrings::reqGeoFormat);
m_coordinateSystem = params->GetParameterValue(MgHttpResourceStrings::reqGeoCoordinateSystem);
m_transformTo = params->GetParameterValue(MgHttpResourceStrings::reqGeoTransformTo);
+ m_precision = 7;
+ STRING sPrecision = params->GetParameterValue(MgHttpResourceStrings::reqGeoPrecision);
+ if (!sPrecision.empty())
+ m_precision = MgUtil::StringToInt32(sPrecision);
}
void MgHttpGeoBinaryOperation::Execute(MgHttpResponse & hResponse)
@@ -86,6 +90,7 @@
else if (m_format == L"GEOJSON")
{
MgGeoJsonWriter gw;
+ gw.SetPrecision(m_precision);
STRING geoJson = gw.GeometryToGeoJson(result);
std::string mbGeoJson;
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBinaryOperation.h
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBinaryOperation.h 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBinaryOperation.h 2017-06-25 13:45:50 UTC (rev 9225)
@@ -59,6 +59,7 @@
STRING m_format;
STRING m_coordinateSystem;
STRING m_transformTo;
+ INT32 m_precision;
};
#endif
\ No newline at end of file
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBoundary.cpp
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBoundary.cpp 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBoundary.cpp 2017-06-25 13:45:50 UTC (rev 9225)
@@ -28,6 +28,10 @@
m_format = params->GetParameterValue(MgHttpResourceStrings::reqGeoFormat);
m_coordinateSystem = params->GetParameterValue(MgHttpResourceStrings::reqGeoCoordinateSystem);
m_transformTo = params->GetParameterValue(MgHttpResourceStrings::reqGeoTransformTo);
+ m_precision = 7;
+ STRING sPrecision = params->GetParameterValue(MgHttpResourceStrings::reqGeoPrecision);
+ if (!sPrecision.empty())
+ m_precision = MgUtil::StringToInt32(sPrecision);
}
void MgHttpGeoBoundary::Execute(MgHttpResponse & hResponse)
@@ -36,8 +40,8 @@
MG_HTTP_HANDLER_TRY()
- // Check common parameters
- ValidateCommonParameters();
+ // Check common parameters
+ ValidateCommonParameters();
if (m_geomWKT.empty())
{
@@ -73,6 +77,7 @@
else if (m_format == L"GEOJSON")
{
MgGeoJsonWriter gw;
+ gw.SetPrecision(m_precision);
STRING geoJson = gw.GeometryToGeoJson(result);
std::string mbGeoJson;
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBoundary.h
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBoundary.h 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBoundary.h 2017-06-25 13:45:50 UTC (rev 9225)
@@ -58,6 +58,7 @@
STRING m_format;
STRING m_coordinateSystem;
STRING m_transformTo;
+ INT32 m_precision;
};
#endif
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBuffer.cpp
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBuffer.cpp 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBuffer.cpp 2017-06-25 13:45:50 UTC (rev 9225)
@@ -31,6 +31,10 @@
m_format = params->GetParameterValue(MgHttpResourceStrings::reqGeoFormat);
m_coordinateSystem = params->GetParameterValue(MgHttpResourceStrings::reqGeoCoordinateSystem);
m_transformTo = params->GetParameterValue(MgHttpResourceStrings::reqGeoTransformTo);
+ m_precision = 7;
+ STRING sPrecision = params->GetParameterValue(MgHttpResourceStrings::reqGeoPrecision);
+ if (!sPrecision.empty())
+ m_precision = MgUtil::StringToInt32(sPrecision);
}
void MgHttpGeoBuffer::Execute(MgHttpResponse & hResponse)
@@ -108,6 +112,7 @@
else if (m_format == L"GEOJSON")
{
MgGeoJsonWriter gw;
+ gw.SetPrecision(m_precision);
STRING geoJson = gw.GeometryToGeoJson(result);
std::string mbGeoJson;
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBuffer.h
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBuffer.h 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoBuffer.h 2017-06-25 13:45:50 UTC (rev 9225)
@@ -60,6 +60,7 @@
STRING m_format;
STRING m_coordinateSystem;
STRING m_transformTo;
+ INT32 m_precision;
};
#endif
\ No newline at end of file
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoConvexHull.cpp
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoConvexHull.cpp 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoConvexHull.cpp 2017-06-25 13:45:50 UTC (rev 9225)
@@ -28,6 +28,10 @@
m_format = params->GetParameterValue(MgHttpResourceStrings::reqGeoFormat);
m_coordinateSystem = params->GetParameterValue(MgHttpResourceStrings::reqGeoCoordinateSystem);
m_transformTo = params->GetParameterValue(MgHttpResourceStrings::reqGeoTransformTo);
+ m_precision = 7;
+ STRING sPrecision = params->GetParameterValue(MgHttpResourceStrings::reqGeoPrecision);
+ if (!sPrecision.empty())
+ m_precision = MgUtil::StringToInt32(sPrecision);
}
void MgHttpGeoConvexHull::Execute(MgHttpResponse & hResponse)
@@ -73,6 +77,7 @@
else if (m_format == L"GEOJSON")
{
MgGeoJsonWriter gw;
+ gw.SetPrecision(m_precision);
STRING geoJson = gw.GeometryToGeoJson(result);
std::string mbGeoJson;
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoConvexHull.h
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoConvexHull.h 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoConvexHull.h 2017-06-25 13:45:50 UTC (rev 9225)
@@ -58,6 +58,7 @@
STRING m_format;
STRING m_coordinateSystem;
STRING m_transformTo;
+ INT32 m_precision;
};
#endif
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoSimplify.cpp
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoSimplify.cpp 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoSimplify.cpp 2017-06-25 13:45:50 UTC (rev 9225)
@@ -30,6 +30,10 @@
m_format = params->GetParameterValue(MgHttpResourceStrings::reqGeoFormat);
m_coordinateSystem = params->GetParameterValue(MgHttpResourceStrings::reqGeoCoordinateSystem);
m_transformTo = params->GetParameterValue(MgHttpResourceStrings::reqGeoTransformTo);
+ m_precision = 7;
+ STRING sPrecision = params->GetParameterValue(MgHttpResourceStrings::reqGeoPrecision);
+ if (!sPrecision.empty())
+ m_precision = MgUtil::StringToInt32(sPrecision);
}
void MgHttpGeoSimplify::Execute(MgHttpResponse & hResponse)
@@ -90,6 +94,7 @@
else if (m_format == L"GEOJSON")
{
MgGeoJsonWriter gw;
+ gw.SetPrecision(m_precision);
STRING geoJson = gw.GeometryToGeoJson(result);
std::string mbGeoJson;
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoSimplify.h
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoSimplify.h 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoSimplify.h 2017-06-25 13:45:50 UTC (rev 9225)
@@ -60,6 +60,7 @@
STRING m_format;
STRING m_coordinateSystem;
STRING m_transformTo;
+ INT32 m_precision;
};
#endif
\ No newline at end of file
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoTessellate.cpp
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoTessellate.cpp 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoTessellate.cpp 2017-06-25 13:45:50 UTC (rev 9225)
@@ -28,6 +28,10 @@
m_format = params->GetParameterValue(MgHttpResourceStrings::reqGeoFormat);
m_coordinateSystem = params->GetParameterValue(MgHttpResourceStrings::reqGeoCoordinateSystem);
m_transformTo = params->GetParameterValue(MgHttpResourceStrings::reqGeoTransformTo);
+ m_precision = 7;
+ STRING sPrecision = params->GetParameterValue(MgHttpResourceStrings::reqGeoPrecision);
+ if (!sPrecision.empty())
+ m_precision = MgUtil::StringToInt32(sPrecision);
}
void MgHttpGeoTessellate::Execute(MgHttpResponse & hResponse)
@@ -73,6 +77,7 @@
else if (m_format == L"GEOJSON")
{
MgGeoJsonWriter gw;
+ gw.SetPrecision(m_precision);
STRING geoJson = gw.GeometryToGeoJson(result);
std::string mbGeoJson;
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoTessellate.h
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoTessellate.h 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpGeoTessellate.h 2017-06-25 13:45:50 UTC (rev 9225)
@@ -58,6 +58,7 @@
STRING m_format;
STRING m_coordinateSystem;
STRING m_transformTo;
+ INT32 m_precision;
};
#endif
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpResourceStrings.cpp
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpResourceStrings.cpp 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpResourceStrings.cpp 2017-06-25 13:45:50 UTC (rev 9225)
@@ -385,6 +385,7 @@
const STRING MgHttpResourceStrings::reqGeoTransformTo = L"TRANSFORMTO";
const STRING MgHttpResourceStrings::reqGeoAlgorithm = L"ALGORITHM";
const STRING MgHttpResourceStrings::reqGeoTolerance = L"TOLERANCE";
+const STRING MgHttpResourceStrings::reqGeoPrecision = L"PRECISION";
// Coordinate System Request Parameters
const STRING MgHttpResourceStrings::reqCsWkt = L"CSWKT";
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpResourceStrings.h
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpResourceStrings.h 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpResourceStrings.h 2017-06-25 13:45:50 UTC (rev 9225)
@@ -389,6 +389,7 @@
static const STRING reqGeoTransformTo;
static const STRING reqGeoAlgorithm;
static const STRING reqGeoTolerance;
+ static const STRING reqGeoPrecision;
// Coordinate System Request Parameters
static const STRING reqCsWkt;
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpSelectFeatures.cpp
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpSelectFeatures.cpp 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpSelectFeatures.cpp 2017-06-25 13:45:50 UTC (rev 9225)
@@ -42,6 +42,11 @@
//Default to xml if not specified
if (m_responseFormat.empty())
m_responseFormat = MgMimeType::Xml;
+
+ m_precision = 7;
+ STRING sPrecision = params->GetParameterValue(MgHttpResourceStrings::reqGeoPrecision);
+ if (!sPrecision.empty())
+ m_precision = MgUtil::StringToInt32(sPrecision);
}
/// <summary>
@@ -110,7 +115,7 @@
Ptr<MgFeatureReader> featureReader = service->SelectFeatures(&resId, m_className, qryOptions);
//MgByteSource owns this and will clean it up when done
- ByteSourceImpl* bsImpl = new MgReaderByteSourceImpl(featureReader, m_responseFormat, m_bCleanJson);
+ ByteSourceImpl* bsImpl = new MgReaderByteSourceImpl(featureReader, m_responseFormat, m_bCleanJson, m_precision);
Ptr<MgByteSource> byteSource = new MgByteSource(bsImpl);
byteSource->SetMimeType(m_responseFormat);
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpSelectFeatures.h
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpSelectFeatures.h 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpSelectFeatures.h 2017-06-25 13:45:50 UTC (rev 9225)
@@ -46,6 +46,7 @@
private:
STRING m_resId;
STRING m_className;
+ INT32 m_precision;
};
#endif // _FS_SELECT_FEATURES_H
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpSelectFeaturesSpatially.cpp
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpSelectFeaturesSpatially.cpp 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpSelectFeaturesSpatially.cpp 2017-06-25 13:45:50 UTC (rev 9225)
@@ -52,6 +52,11 @@
//Default to xml if not specified
if (m_responseFormat.empty())
m_responseFormat = MgMimeType::Xml;
+
+ m_precision = 7;
+ STRING sPrecision = params->GetParameterValue(MgHttpResourceStrings::reqGeoPrecision);
+ if (!sPrecision.empty())
+ m_precision = MgUtil::StringToInt32(sPrecision);
}
/// <summary>
@@ -120,7 +125,7 @@
Ptr<MgDataReader> dataReader = service->SelectAggregate(&resId, m_className, qryOptions);
//MgByteSource owns this and will clean it up when done
- ByteSourceImpl* bsImpl = new MgReaderByteSourceImpl(dataReader, m_responseFormat, m_bCleanJson);
+ ByteSourceImpl* bsImpl = new MgReaderByteSourceImpl(dataReader, m_responseFormat, m_bCleanJson, m_precision);
Ptr<MgByteSource> byteSource = new MgByteSource(bsImpl);
byteSource->SetMimeType(m_responseFormat);
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpSelectFeaturesSpatially.h
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpSelectFeaturesSpatially.h 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/HttpSelectFeaturesSpatially.h 2017-06-25 13:45:50 UTC (rev 9225)
@@ -49,6 +49,7 @@
STRING m_geometry;
STRING m_geometryClass;
INT32 m_operation;
+ INT32 m_precision;
};
#endif // _FS_SELECT_FEATURES_SPATIALLY_H
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/ReaderByteSourceImpl.cpp
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/ReaderByteSourceImpl.cpp 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/ReaderByteSourceImpl.cpp 2017-06-25 13:45:50 UTC (rev 9225)
@@ -17,7 +17,7 @@
#include "ReaderByteSourceImpl.h"
#include "PlatformBase.h"
-MgReaderByteSourceImpl::MgReaderByteSourceImpl(MgReader* reader, CREFSTRING format, bool bCleanJson)
+MgReaderByteSourceImpl::MgReaderByteSourceImpl(MgReader* reader, CREFSTRING format, bool bCleanJson, INT32 precision)
{
m_reader = SAFE_ADDREF(reader);
m_format = format;
@@ -27,6 +27,7 @@
m_bInternalReaderHasMore = true;
m_bFirstRecord = true;
m_bCleanJson = bCleanJson;
+ m_precision = precision;
}
MgReaderByteSourceImpl::~MgReaderByteSourceImpl()
@@ -167,6 +168,7 @@
if (m_bCleanJson)
{
MgGeoJsonWriter geoJsonWriter;
+ geoJsonWriter.SetPrecision(m_precision);
STRING sGeoJson;
if (m_reader->GetReaderType() == MgReaderType::FeatureReader)
{
Modified: sandbox/jng/geoprocessing/Web/src/HttpHandler/ReaderByteSourceImpl.h
===================================================================
--- sandbox/jng/geoprocessing/Web/src/HttpHandler/ReaderByteSourceImpl.h 2017-06-25 12:37:28 UTC (rev 9224)
+++ sandbox/jng/geoprocessing/Web/src/HttpHandler/ReaderByteSourceImpl.h 2017-06-25 13:45:50 UTC (rev 9225)
@@ -29,7 +29,7 @@
DECLARE_CLASSNAME(MgReaderByteSourceImpl)
public:
- MgReaderByteSourceImpl(MgReader* reader, CREFSTRING format, bool bCleanJson);
+ MgReaderByteSourceImpl(MgReader* reader, CREFSTRING format, bool bCleanJson, INT32 precision);
virtual ~MgReaderByteSourceImpl();
///////////////////////////////////////////////////////////////////////////
@@ -92,6 +92,7 @@
std::string m_buf;
INT32 m_bufOffset;
+ INT32 m_precision;
};
#endif
\ No newline at end of file
More information about the mapguide-commits
mailing list