• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 556
  • Last Modified:

PhpMyAdmin Edit record that contains a polygon field

Hi there,
I have a table that one of its fields is a POLYGON

I manage to insert a polygon quite fine like this
INSERT INTO polygons_region VALUES ("test", GeomFromText('POLYGON((4.97141067864157 44.4269927920504,4.9602656138422 44.4171284166614,4.9562222293031 44.4171081193899,4.9524924246148 44.4160004581088,4.97141067864157 44.4269927920504))'));

Then if i go to phpmyadmin to edit this record i get this weird value for the polygon (i guess its an encpoded string) http://o7.no/uBHhxx

And then if i try to edit the name through the interface of phpmyadmin from test to test1 i get this error http://o7.no/vmemRO

Weird, any solutions? Is this something that phpmyadmin should fix? Should i report to them?
0
ioustinos_sarris
Asked:
ioustinos_sarris
  • 3
  • 2
  • 2
3 Solutions
 
honestman31Commented:
can you please post your schema and what you expect to get for field POLYGON,
Thanks
0
 
Dave BaldwinFixer of ProblemsCommented:
You're seeing floating point binary values because that's what you're INSERTING.  Unquoted numbers in an SQL statement are converted to their binary values.  That's not something you can edit by hand.
0
 
ioustinos_sarrisAuthor Commented:
CREATE TABLE IF NOT EXISTS `territories` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `city_id` int(11) NOT NULL,
  `name` varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `status_update` varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `owner_id` int(11) NOT NULL COMMENT '0 for no owner',
  `bounds` polygon NOT NULL,
  `visits_foursquare` int(11) NOT NULL,
  `visits_fb` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=489 ;

I have entered the data in the database in that manner

INSERT INTO territories (`city_id`,`bounds`) VALUES (10,GeomFromText('POLYGON((38.15031715029785 38.140697756155376,23.762438984450498 38.140697756155376,23.762438984450498 23.750227585156292,38.15031715029785 23.750227585156292,38.15031715029785 38.140697756155376))'));
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Dave BaldwinFixer of ProblemsCommented:
The values in the table for a 'polygon' are not in 'human readable' format.  If you want to read them, see here http://www.cs.duke.edu/csl/docs/mysql-refman/spatial-extensions.html#fetching-spatial-data for the AsText() function.
0
 
honestman31Commented:
There is nothing wrong with phpMyAdmin it is just 'polygon' are readable ,

Here is some more information from the official site  
http://dev.mysql.com/doc/refman/4.1/en/polygon-property-functions.html

Here some examples on how to get the readable value form it

http://howto-use-mysql-spatial-ext.blogspot.com/
0
 
ioustinos_sarrisAuthor Commented:
Yeah i know how to get the information in php.
The problem is that i need to be editing some of the entries via phpmyadmin and i cannot.
0
 
Dave BaldwinFixer of ProblemsCommented:
You're right, you can not.  You will have to get the information in PHP, edit it as text, and then update the row.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now