Last active
September 27, 2016 02:50
-
-
Save NathanW2/7604d7210c64513d221c92b4e1bed9c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT geometry::STGeomFromText('POINT (635641.32 5815631.39 100)', 28355) geom | |
SELECT CONVERT(varchar(max), geometry::STGeomFromText('POINT (635641.32 5815631.39 100)', 28355).AsBinaryZM(), 2) zmhex | |
SELECT CONVERT(varchar(max), geometry::STGeomFromText('POINT (635641.32 5815631.39 100)', 28355).STAsBinary(), 2) nozmhex | |
geom | |
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
0xC36E0000010D3D0AD7A3F26523418FC2F5D8532F56410000000000005940 | |
zmhex | |
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
01E90300003D0AD7A3F26523418FC2F5D8532F56410000000000005940 | |
nozmhex | |
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
01010000003D0AD7A3F26523418FC2F5D8532F5641 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sqldata = u'01E90300003D0AD7A3F26523418FC2F5D8532F56410000000000005940' | |
print "In SQL Server:", sqldata | |
data = str(bytearray.fromhex(sqldata)) | |
gotback = binascii.hexlify(data).upper() | |
point = ogr.CreateGeometryFromWkb(data) | |
print "ogr wkt:", point.ExportToWkt() | |
wkbfromogr = point.ExportToWkb().encode('hex') | |
print "ogr wkb:", wkbfromogr | |
print sqldata == wkbfromogr, "Matched to sql server in Python" | |
print sqldata == gotback, "Matched to sql server in Python" |
Author
NathanW2
commented
Sep 27, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment