6

Does anybody know what format is the following element?

01000000804AE9B78F8F0D416258AE25F8E45141

It looks like WKB or PostGIS geometry/geography but I didn't manage to convert it.

It has to be point in the centre of the city of Sofia, Bulgaria. The coordinate system should be EPSG:32635. There are some other attributes of the SRS:

FalseX=-5120900; FalseY=-9998100; XYUnits=450445547.391054; FalseZ-1000; ZUnits=2147483.645; FalseM=-100000; MUnits=10000; IsHighPrecision=1; XYTolerance=0.001; ZTolerance=0.001; MTolerance=0.001

But I don't know if I should create user defined CRS with these elements. The coordinates of this point given in another table are (198; 4733). If I use them with the standard EPSG:32635 the point is located far more South.

6
  • 1
    Where and how did you receive that string?
    – user30184
    Aug 9 '16 at 12:26
  • It is part of a database. It is not created by me, I just want to receive the geometries. Now I see only attribute tables. Aug 9 '16 at 12:31
  • I would like to get information like "It comes from PostGIS by doing SELECT geometry from my_table limit 1".
    – user30184
    Aug 9 '16 at 12:36
  • I don't know how the database is created. It was provided to me in ACCESS format. I'm not even sure if it is PostGIS database, because I tried to import this point in a simple postgis table with one geometry (also with geography) but I received "Wrong WKB format" error. Aug 9 '16 at 13:09
  • 1
    I would ask from the one who sent the Access database for you.
    – user30184
    Aug 9 '16 at 13:14
5

It seems to be an odd number of hex-couplets, so I tried adding an extra "01" (the WKB code for point geometry, I think) at the start and converting with R's wkb package:

> readWKB(list(hex2raw("0101000000804AE9B78F8F0D416258AE25F8E45141")))
SpatialPoints:
          x       y
[1,] 242162 4690913
Coordinate Reference System (CRS) arguments: NA 

Saving that in an object with EPSG:32635 and then converting to 4326 (lat-long) gives me a point which is indeed in Sofia:

> pts = readWKB(list(hex2raw("0101000000804AE9B78F8F0D416258AE25F8E45141")))
> proj4string(pts)=CRS("+init=epsg:32635")
> spTransform(pts, CRS("+init=epsg:4326"))
SpatialPoints:
            x        y
[1,] 23.87071 42.32777
Coordinate Reference System (CRS) arguments: +init=epsg:4326
+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 

So somehow an "01" has been chopped off the start of the hexadecimal WKB representation.

0
3

With the help of Spacedman, you can use the QuickWKT plugin to get the point into QGIS.

Enter 0101000000804AE9B78F8F0D416258AE25F8E45141 in the input box and select Point (WKB) as Data type. The result is near the town of Momin Prohod.

Converting WKT to WKB in Java using PostGIS? gives a few more hints on WKB to WKT conversion.

BTW the coordinates (198; 4733) are Sofia City in UTM 35N, but in kilometers instead of meters.

1
  • Yes, my fault. The hex value is the village of Momin (Prohod) and the coordinates are for Sofia. I had coppied different lines. However, thank you very much for the help. Aug 9 '16 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.