Opened 7 years ago

Closed 7 years ago

#3858 closed defect (fixed)

ST_AsMVT doesn't support geometry collections should be noted

Reported by: robe Owned by: robe
Priority: medium Milestone: PostGIS 2.4.0
Component: documentation Version: master
Keywords: Cc:

Description

SELECT ST_AsMVT(foo1, 'monkey')  As result
							FROM ((SELECT ST_Collect(geom)  As the_geom
		FROM (VALUES ( ST_GeomFromEWKT('SRID=4326;MULTIPOLYGON(((-71.0821 42.3036 2,-71.0822 42.3036 2,-71.082 42.3038 2,-71.0819 42.3037 2,-71.0821 42.3036 2)))') ),
	( ST_GeomFromEWKT('SRID=4326;POLYGON((-71.1261 42.2703 1,-71.1257 42.2703 1,-71.1257 42.2701 1,-71.126 42.2701 1,-71.1261 42.2702 1,-71.1261 42.2703 1))') ) ) As g(geom) CROSS JOIN generate_series(1,3) As i GROUP BY i )) As foo1 LIMIT 10;

Yields error:

ERROR:  encode_geometry: 'GeometryCollection' geometry type not supported

Change History (2)

comment:1 by robe, 7 years ago

I'm a bit confused here. Why does ST_AsMVT not work with geometry collections, but ST_AsGeoBuf and ST_AsMVTGeom do?

SELECT encode(ST_AsGeobuf(foo1, 'the_geom'), 'base64')
							FROM ((SELECT ST_Collect(geom)  As the_geom
		FROM (VALUES ( ST_GeomFromEWKT('SRID=4326;MULTIPOLYGON(((-71.0821 42.3036 2,-71.0822 42.3036 2,-71.082 42.3038 2,-71.0819 42.3037 2,-71.0821 42.3036 2)))') ),
	( ST_GeomFromEWKT('SRID=4326;POLYGON((-71.1261 42.2703 1,-71.1257 42.2703 1,-71.1257 42.2701 1,-71.126 42.2701 1,-71.1261 42.2702 1,-71.1261 42.2703 1))') ) ) As g(geom) CROSS JOIN generate_series(1,3) As i GROUP BY i )) As foo1 LIMIT 10;

outputs

EAMi5wEKSwpJCAYiIwgFEgMBAQQaGueB5UPggawogJL0AccBAACQA5ADAMgBxwEAIiAIBBocp7Hq
Q7j5pyiAiXqgBgAAAI8DANcEAADHAcgBAApLCkkIBiIjCAUSAwEBBBoa54HlQ+CBrCiAkvQBxwEA
AJADkAMAyAHHAQAiIAgEGhynsepDuPmnKICJeqAGAAAAjwMA1wQAAMcByAEACksKSQgGIiMIBRID
AQEEGhrngeVD4IGsKICS9AHHAQAAkAOQAwDIAccBACIgCAQaHKex6kO4+acogIl6oAYAAACPAwDX
BAAAxwHIAQA=

comment:2 by robe, 7 years ago

Resolution: fixed
Status: newclosed

In 15794:

Use ansi standard names for arg types for ST_AsMVT and ST_AsMVTGeom to be consistent with rest of docs. Note that ST_AsMVT should not be used with geometry collection directly, but a geometry collection can be converted to suitable form with ST_AsMVTGeom.
More adjustments to support garden testing ST_AsMVT and ST_AsMVTGeom
Closes #3858

Note: See TracTickets for help on using tickets.