Skip to content

Commit

Permalink
rename coordinateSystem to crsString
Browse files Browse the repository at this point in the history
  • Loading branch information
mmeijerdfki committed Sep 2, 2024
1 parent d94a431 commit 1781263
Show file tree
Hide file tree
Showing 22 changed files with 125 additions and 84 deletions.
2 changes: 1 addition & 1 deletion examples/python/gRPC/images/gRPC_fb_sendImages.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def create_project(grpc_channel: Channel, project_name: str) -> str:
"""
fbb = flatbuffers.Builder()
return createProject(
grpc_channel, fbb, project_name, "map", "WGS84", 0.0, 85.0, 23.0
grpc_channel, fbb, project_name, "map", "EPSG:4326", 0.0, 85.0, 23.0
)


Expand Down
1 change: 1 addition & 0 deletions examples/python/gRPC/images/gRPC_pb_queryImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def query_images(
theQuery.polygon.height = 800

theQuery.inMapFrame = True
theQuery.crsString = "EPSG:4326"

scale = 150
vertices = [
Expand Down
49 changes: 24 additions & 25 deletions examples/python/gRPC/util/fb_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ def getProjectInfo(
{project.GeodeticPosition().Latitude()},\
long: {project.GeodeticPosition().Longitude()},\
alt: {project.GeodeticPosition().Altitude()}",
"coordinate_system": project.GeodeticPosition()
.CoordinateSystem()
"crs_string": project.GeodeticPosition()
.CrsString()
.decode("utf-8"),
}

Expand All @@ -151,7 +151,7 @@ def createProjectRaw(
builder: Builder,
name: str,
frameId: str,
coordSys: str,
crsStr: str,
altitude: float,
latitude: float,
longitude: float,
Expand All @@ -164,15 +164,14 @@ def createProjectRaw(
builder: A flatbuffers Builder
name: The name of the project
frameId: The coordinate frame of the project
coordSys: The coordinate system type as a
[proj ellipsoid](https://proj.org/en/stable/usage/ellipsoids.html#built-in-ellipsoid-definitions)\
code
crsStr: The coordinate system type as a
[crs string](https://spatialreference.org/)
altitude: The altitude of the projects position on the globe
(according to coordSys)
(according to crsStr)
latitude: The latitude of the projects position on the globe
(according to coordSys)
(according to crsStr)
longitude: The longitude of the project positition on the globe
(according to coordSys)
(according to crsStr)
Returns:
A flatbuffers object of type ProjectInfo representing the project
Expand All @@ -183,10 +182,10 @@ def createProjectRaw(
nameBuf = builder.CreateString(name)

# create a geodetic coordinates object
coordSysBuf = builder.CreateString(coordSys)
crsBuf = builder.CreateString(crsStr)

GeodeticCoordinates.Start(builder)
GeodeticCoordinates.AddCoordinateSystem(builder, coordSysBuf)
GeodeticCoordinates.AddCrsString(builder, crsBuf)
GeodeticCoordinates.AddAltitude(builder, altitude)
GeodeticCoordinates.AddLatitude(builder, latitude)
GeodeticCoordinates.AddLongitude(builder, longitude)
Expand All @@ -210,7 +209,7 @@ def createProject(
builder: Builder,
name: str,
frameId: str,
coordSys: str,
crsStr: str,
altitude: float,
latitude: float,
longitude: float,
Expand All @@ -223,14 +222,14 @@ def createProject(
builder: A flatbuffers Builder
name: The name of the project
frameId: The coordinate frame of the project
coordSys: The coordinate system type as a [proj ellipsoid](https://proj.org/en/stable/usage/ellipsoids.html#built-in-ellipsoid-definitions)\
code
crsStr: The coordinate system type as a
[crs string](https://spatialreference.org/)
altitude: The altitude of the projects position on the globe
(according to coordSys)
(according to crsStr)
latitude: The latitude of the projects position on the globe
(according to coordSys)
(according to crsStr)
longitude: The longitude of the project positition on the globe
(according to coordSys)
(according to crsStr)
Returns:
The UUID of the created project
Expand All @@ -242,7 +241,7 @@ def createProject(
builder,
name,
frameId,
coordSys,
crsStr,
altitude,
latitude,
longitude,
Expand All @@ -259,7 +258,7 @@ def getOrCreateProject(
name: str,
create: bool = True,
mapFrameId: str = "map",
coordSys: str = "",
crsStr: str = "",
altitude: float = 0.0,
latitude: float = 0.0,
longitude: float = 0.0,
Expand All @@ -273,14 +272,14 @@ def getOrCreateProject(
name: The name of the project
create: Whether to create the project if it does not exist
mapFrameId: The coordinate frame of the project
coordSys: The coordinate system type as a [proj ellipsoid](https://proj.org/en/stable/usage/ellipsoids.html#built-in-ellipsoid-definitions)\
code
crsStr: The coordinate system type as a
[crs string](https://spatialreference.org/)
altitude: The altitude of the projects position on the globe
(according to coordSys)
(according to )
latitude: The latitude of the project position on the globe
(according to coordSys)
(according to crsStr)
longitude: The longitude of the project position on the globe
(according to coordSys)
(according to crsStr)
Returns:
The UUID of the project
Expand All @@ -294,7 +293,7 @@ def getOrCreateProject(
builder,
name,
mapFrameId,
coordSys,
crsStr,
altitude,
latitude,
longitude,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ class Hdf5CoreGeneral
inline static const std::string PROJECTFRAMEID = "projectframeid";
inline static const std::string VERSION = "version";

inline static const std::string GEODETICLOCATION_COORDINATESYSTEM =
"geoloc_coordinatesystem";
inline static const std::string GEODETICLOCATION_CRSSTRING =
"geoloc_crsstring";
inline static const std::string GEODETICLOCATION_ELLIPSOID =
"geoloc_ellipsoid";
inline static const std::string GEODETICLOCATION_ALTITUDE = "geoloc_altitude";
Expand Down
8 changes: 4 additions & 4 deletions seerep_hdf5/seerep_hdf5_core/src/hdf5_core_general.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,8 @@ Hdf5CoreGeneral::getHdf5Group(const std::string& group_path, bool create)
void Hdf5CoreGeneral::writeGeodeticLocation(
const seerep_core_msgs::GeodeticCoordinates& geo_coordinates)
{
writeAttributeToHdf5<std::string>(*m_file, GEODETICLOCATION_COORDINATESYSTEM,
geo_coordinates.coordinateSystem);
writeAttributeToHdf5<std::string>(*m_file, GEODETICLOCATION_CRSSTRING,
geo_coordinates.crsString);
writeAttributeToHdf5<double>(*m_file, GEODETICLOCATION_ALTITUDE,
geo_coordinates.altitude);
writeAttributeToHdf5<double>(*m_file, GEODETICLOCATION_LATITUDE,
Expand All @@ -365,8 +365,8 @@ Hdf5CoreGeneral::readGeodeticLocation()
seerep_core_msgs::GeodeticCoordinates geocoords;
try
{
geocoords.coordinateSystem = readAttributeFromHdf5<std::string>(
*m_file, GEODETICLOCATION_COORDINATESYSTEM, m_file->getName());
geocoords.crsString = readAttributeFromHdf5<std::string>(
*m_file, GEODETICLOCATION_CRSSTRING, m_file->getName());
geocoords.altitude = readAttributeFromHdf5<double>(
*m_file, GEODETICLOCATION_ALTITUDE, m_file->getName());
geocoords.latitude = readAttributeFromHdf5<double>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Hdf5FileWrapper
void createProject(const std::string& projectName,
const std::string& rootFrameId);

void setProjectGeolocation(const std::string& coordinateSystem,
void setProjectGeolocation(const std::string& crsString,
const std::string& ellipsoid, double latitude,
double longitude, double altitude);

Expand Down Expand Up @@ -129,7 +129,7 @@ class Hdf5PyGeneral : public virtual seerep_hdf5_core::Hdf5CoreGeneral
// Project
// #########

void setProjectGeolocation(const std::string& coordinateSystem,
void setProjectGeolocation(const std::string& crsString,
const std::string& ellipsoid, double latitude,
double longitude, double altitude);

Expand Down
10 changes: 4 additions & 6 deletions seerep_hdf5/seerep_hdf5_py/src/hdf5_py_general.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,29 @@ void Hdf5FileWrapper::createProject(const std::string& projectName,
io.writeProjectFrameId(rootFrameId);
}

void Hdf5FileWrapper::setProjectGeolocation(const std::string& coordinateSystem,
void Hdf5FileWrapper::setProjectGeolocation(const std::string& crsString,
const std::string& ellipsoid,
double latitude, double longitude,
double altitude)
{
Hdf5PyGeneral io(*this);

io.setProjectGeolocation(coordinateSystem, ellipsoid, latitude, longitude,
altitude);
io.setProjectGeolocation(crsString, ellipsoid, latitude, longitude, altitude);
}

Hdf5PyGeneral::Hdf5PyGeneral(Hdf5FileWrapper& hdf5File)
: Hdf5CoreGeneral(hdf5File.getFile(), hdf5File.getMutex())
{
}

void Hdf5PyGeneral::setProjectGeolocation(const std::string& coordinateSystem,
void Hdf5PyGeneral::setProjectGeolocation(const std::string& crsString,
const std::string& ellipsoid,
double latitude, double longitude,
double altitude)
{
const std::scoped_lock lock(*m_write_mtx);

writeAttributeToHdf5(*m_file, GEODETICLOCATION_COORDINATESYSTEM,
coordinateSystem);
writeAttributeToHdf5(*m_file, GEODETICLOCATION_CRSSTRING, crsString);
writeAttributeToHdf5(*m_file, GEODETICLOCATION_ELLIPSOID, ellipsoid);
writeAttributeToHdf5(*m_file, GEODETICLOCATION_LATITUDE, latitude);
writeAttributeToHdf5(*m_file, GEODETICLOCATION_LONGITUDE, longitude);
Expand Down
2 changes: 1 addition & 1 deletion seerep_msgs/core/geodetic_coordinates.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace seerep_core_msgs
{
struct GeodeticCoordinates
{
std::string coordinateSystem;
std::string crsString;

double altitude;
double latitude;
Expand Down
2 changes: 1 addition & 1 deletion seerep_msgs/core/query.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct Query
bool inMapFrame; // if false the query polygon is in geodetic coordinates,
// otherwise in map frame
std::string
coordinateSystem; // the geodetic coordinate system in which the polygon is defined
crsString; // the coordinate reference system in which the polygon is defined
std::optional<Timeinterval> timeinterval; ///< only do temporal query if set
std::optional<std::unordered_map<std::string, std::vector<std::string>>>
label; ///< only do semantic query if set
Expand Down
2 changes: 1 addition & 1 deletion seerep_msgs/fbs/geodeticCoordinates.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace seerep.fb;
// source: https://en.wikipedia.org/wiki/Geodetic_coordinates

table GeodeticCoordinates {
coordinateSystem:string; // e.g EPSG::4326
crsString:string; // e.g EPSG::4326

longitude:double; // longitude measured in radians
latitude:double; // latitude measured in radians
Expand Down
2 changes: 1 addition & 1 deletion seerep_msgs/fbs/query.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ table Query {
polygon:Polygon2D;
polygonSensorPosition:Polygon2D;
fullyEncapsulated:bool;
coordinateSystem:string;
crsString:string;
inMapFrame:bool;
timeinterval:TimeInterval;
label:[LabelCategory];
Expand Down
2 changes: 1 addition & 1 deletion seerep_msgs/protos/geodetic_coordinates.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package seerep;

message GeodeticCoordinates
{
string coordinateSystem = 1;
string crsString = 1;

double altitude = 2;
double latitude = 3;
Expand Down
2 changes: 1 addition & 1 deletion seerep_msgs/protos/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ message Query
bool withoutdata = 10;
uint32 maxNumData = 11;
bool sortByTime = 12;
string coordinateSystem = 13;
string crsString = 13;
}
4 changes: 2 additions & 2 deletions seerep_ros/seerep_ros_comm/src/point_dumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void JsonPointDumper::readAndDumpJsonUos(const std::string& jsonFilePath)
geoCoordinates.latitude = 0.0;
geoCoordinates.longitude = 0.0;
geoCoordinates.altitude = 0.0;
geoCoordinates.coordinateSystem = "EPSG:32632";
geoCoordinates.crsString = "EPSG:32632";
ioCoreGeneral->writeGeodeticLocation(geoCoordinates);

std::ifstream file(jsonFilePath, std::ifstream::binary);
Expand Down Expand Up @@ -122,7 +122,7 @@ void JsonPointDumper::readAndDumpJsonFr(const std::string& jsonFilePath,
geoCoordinates.longitude =
completeJsonData["anchor_lla"]["longitude"].asDouble();
geoCoordinates.altitude = 0.0;
geoCoordinates.coordinateSystem = "EPSG:4326";
geoCoordinates.crsString = "EPSG:4326";
ioCoreGeneral->writeGeodeticLocation(geoCoordinates);

std::unordered_map<int64_t, std::string> classesMapping =
Expand Down
2 changes: 1 addition & 1 deletion seerep_ros/seerep_ros_comm/src/rosbag_dumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void RosbagDumper::getGeoAnchor()
geoCoordinates.latitude = msg->position.latitude;
geoCoordinates.longitude = msg->position.longitude;
geoCoordinates.altitude = msg->position.altitude;
geoCoordinates.coordinateSystem = "EPSG:4326";
geoCoordinates.crsString = "EPSG:4326";
ioCoreGeneral->writeGeodeticLocation(geoCoordinates);
}
}
Expand Down
Loading

0 comments on commit 1781263

Please sign in to comment.