0

I am trying to insert spatial data in MySQL using the following statement but even though query is executed successfully, the table does not show any data.

Table Name : geo Column name : g type : Geometry

Query:

SET @g = 'POLYGON((72.79230192816932 18.94774395435967,72.79227877224074 18.94774197280634,72.79228473707543 18.94767850389454,72.79230789299416 18.94768048544693,72.79230192816932 18.94774395435967))';

INSERT INTO geom(g)VALUES (GEOMFROMTEXT(@g));

AS you can see polygon is closed, still table does not show anything. I tried even POLYFROMTEXT but even that is giving the same output.

I intend to check whether a point lie inside this polygon or not. But the polygon itself is not getting inserted. Please advise as I am new to Spatial in MySQL. MySQL version : 5.6.21

AngelsandDemons
  • 2,823
  • 13
  • 47
  • 70
  • please check http://stackoverflow.com/questions/6144053/cannot-insert-geomfromtextpoint-in-mysql, may be you are also having the same problem highlighted here. – Anil Dec 08 '14 at 08:31
  • works fine for me using the command line client ... so it would indeed be interesting to know what client you are using – Hartmut Holzgraefe Dec 08 '14 at 09:13
  • There is nothing wrong with your query, though you say your table is called geo and you are inserting into geom. – John Powell Dec 08 '14 at 12:56
  • That was a typo.. Actually seems like there's a bug with SQLYog.. The data is getting inserted into the MySQL properly but SQLYog still shows it blank. I checked data from MYSQL prompt and it was present.. The link provided by akfkmupiwu actually helped. – AngelsandDemons Dec 09 '14 at 10:46

1 Answers1

0

Seems like a bug with SQLYog GUI. The data is getting inserted into the

MYSQL

properly but

SQLYog

does not show the same.

Had to manually check from the mysql command prompt. The data was indeed present in the database.

If the query fired is incorrect, then SQLyog will show NULL in rows.. However when correct query is fired, it will show BLANK.

AngelsandDemons
  • 2,823
  • 13
  • 47
  • 70