gp_Cylinder location is not calculated from cylinder, it is how cylinder was defined in the first place.
Whether they match or not will depend on how cylinders were modeled, hence you'll need to take various considerations depending on what you are trying to do with this information.
For instance, the following script defines two cylinders in Draw Harness:
pload MODELING VISUALIZATION
plane p1 0 0 -100 0 0 1
plane p2 0 0 100 0 0 -1
pcylinder c1 p1 50 200
pcylinder c2 p2 50 200
axo
donly c1 c2
fit
explode c1 F
explode c2 F
dumpjson c1_1
dumpjson c2_1
These cylinders geometrically match to each other, but have different definition. You may see from the dump:
"Surface": {
"className": "Geom_CylindricalSurface",
"className": "Geom_ElementarySurface",
"className": "Geom_Surface",
"className": "Geom_Geometry",
"pos": {
"Location": [0, 0, -100],
"Direction": [0, 0, 1],
"XDirection": [1, 0, -0],
"YDirection": [-0, 1, 0]
},
"radius": 50
},
and for another cylinder:
"Surface": {
"className": "Geom_CylindricalSurface",
"className": "Geom_ElementarySurface",
"className": "Geom_Surface",
"className": "Geom_Geometry",
"pos": {
"Location": [0, 0, 100],
"Direction": [0, 0, -1],
"XDirection": [-1, 0, -0],
"YDirection": [0, 1, 0]
},
"radius": 50
},
This is only one of the ways to define the same cylinder differently in B-Rep.