Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # some code (missing parts):
- conn = pymssql.connect(host='localhost', user='sa', password='xx', database='xx')
- conn.autocommit(True)
- cur = conn.cursor()
- # assign some variables like lat and lon
- geog_type = "geography::STGeomFromText('POINT(%s %s)', 4326))" % (lat, lon)
- print geog_type
- print type(geog_type)
- cur.execute("INSERT INTO tweets (x, y, date, geog) VALUES(%s, %s, %s, %s)", \
- (lat, lon, d, geog_type))
- conn.close()
- Get the below exception:
- Error:
- geography::STGeomFromText('POINT(144.92037314 -37.74735705)', 4326))
- <type 'str'>
- Traceback (most recent call last):
- File "C:\Users\sjackson\Dropbox\TwitterWorkings\tweetsucker_SJ_SQLServer.py", line 106, in <module>
- parse_tweet(tweet)
- File "C:\Users\sjackson\Dropbox\TwitterWorkings\tweetsucker_SJ_SQLServer.py", line 66, in parse_tweet
- (clean_text, lat, lon, lan, d, int(swearing), geog_type))
- File "C:\Python27\ArcGIS10.1\lib\site-packages\pymssql.py", line 196, in execute
- raise OperationalError, e[0]
- OperationalError: SQL Server message 6522, severity 16, state 1, line 1:
- A .NET Framework error occurred during execution of user-defined routine or aggregate "geography":
- System.FormatException: 24114: The label geography::STGeomFro in the input well-known text (WKT) is not valid. Valid labels are POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, GEOMETRYCOLLECTION, CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON and FULLGLOBE (geography Data Type only).
- System.FormatException:
- at Microsoft.SqlServer.Types.OpenGisTypes.ParseLabel(String input)
- at Microsoft.SqlServer.Types.WellKnownTextReader.ParseTaggedText(OpenGisType type)
- at Microsoft.SqlServer.Types.WellKnownTextReader.Read(OpenGisType type, Int32 srid)
- at Microsoft.SqlServer.Types.SqlGeography.GeographyFromText(OpenGisType type, SqlChars taggedText, Int32 srid)
- at Microsoft.SqlServer.Types.SqlGeography.Parse(SqlString s)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement