Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a table which contains an field zoneShape of the type Polygon.

When inserting some geometry in this field, in phpmyadmin it says: affected 1 row. The row is added, but the geometry field says it's size is 0B. Which can't be accurate, cause it has multiple points.

This is the Insertion code:

SET @g = 'POLYGON(50.866753 5.686455, 50.859819 5.708942, 50.851475 5.722675, 50.841611 5.720615, 50.834023 5.708427, 50.840744 5.689373, 50.858735 5.673923, 50.866753 5.686455)';
INSERT INTO zone SET zoneShape = PolygonFromText(@g)

As you can see; the first and last point are the same, so the polygon is closed.

Can anyone help me with adding this polygon to the database? Thanx

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

Try changing your Polygon WKT to this (note the extra parens):

POLYGON((50.866753 5.686455, 50.859819 5.708942, 50.851475 5.722675, 50.841611 5.720615, 50.834023 5.708427, 50.840744 5.689373, 50.858735 5.673923, 50.866753 5.686455))

That's off the cuff and I haven't tried it yet, but well-formed WKT for Polygons has to support both the outer and inner rings (aka "islands", aka "holes"). I see your text there isn't supporting convention for inner rings --even though you don't have any. So you may just need to add these extra parens. If that doesn't work, I'll return later and take another look, assuming someone doesn't beat me to it. :)

share|improve this answer
    
Thanks for your sharp look at the ( and )! now I have 145bytes of geometry in the field whoot –  stUrb Apr 22 '12 at 17:25
    
Excellent, I'm glad it worked. And welcome to GIS.SE. /E –  elrobis Apr 22 '12 at 18:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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