{"action":"closed","issue":{"url":"https://api.github.com/repos/geoalchemy/geoalchemy2/issues/90","labels_url":"https://api.github.com/repos/geoalchemy/geoalchemy2/issues/90/labels{/name}","comments_url":"https://api.github.com/repos/geoalchemy/geoalchemy2/issues/90/comments","events_url":"https://api.github.com/repos/geoalchemy/geoalchemy2/issues/90/events","html_url":"https://github.com/geoalchemy/geoalchemy2/issues/90","id":55630300,"number":90,"title":"ST_Contains not working with Geography multipolygon+point","user":{"login":"jonathansick","id":349384,"avatar_url":"https://avatars.githubusercontent.com/u/349384?v=3","gravatar_id":"","url":"https://api.github.com/users/jonathansick","html_url":"https://github.com/jonathansick","followers_url":"https://api.github.com/users/jonathansick/followers","following_url":"https://api.github.com/users/jonathansick/following{/other_user}","gists_url":"https://api.github.com/users/jonathansick/gists{/gist_id}","starred_url":"https://api.github.com/users/jonathansick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonathansick/subscriptions","organizations_url":"https://api.github.com/users/jonathansick/orgs","repos_url":"https://api.github.com/users/jonathansick/repos","events_url":"https://api.github.com/users/jonathansick/events{/privacy}","received_events_url":"https://api.github.com/users/jonathansick/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-27T15:16:52Z","updated_at":"2015-01-27T17:48:32Z","closed_at":"2015-01-27T17:48:32Z","body":"I'm finding that `ST_contains` is only working if I cast to geometry types from geography.\r\n\r\nFor background, I've created a [table `Catalog` with a column `footprint`]( https://github.com/jonathansick/starplex/blob/866718a74a799d4deca9a7db870269ae7bb2b326/starplex/database/observation.py#L35) that is defined as\r\n\r\n```\r\nfootprint = Column(Geography(geometry_type='MULTIPOLYGON', srid=4326))\r\n```\r\n\r\nIf I define a point, e.g., `point = 'POINT(9.3889166667 40.0101944444)'` and want to query for all footprint polygons that cover the point:\r\n\r\n``` \r\nq = s.query(Catalog)\\\r\n    .filter(func.ST_Contains(Catalog.footprint,\r\n                             func.ST_GeographyFromText(point)))\r\n```\r\n\r\nI get an error:\r\n\r\n```\r\n\r\nERROR: ProgrammingError: (ProgrammingError) function st_contains(geography, geography) does not exist\r\nLINE 3: WHERE ST_Contains(catalog.footprint, ST_GeographyFromText('P...\r\n              ^\r\nHINT:  No function matches the given name and argument types. You might need to add explicit type casts.\r\n 'SELECT catalog.id AS catalog_id, catalog.name AS catalog_name, catalog.instrument AS catalog_instrument, ST_AsBinary(catalog.footprint) AS catalog_footprint, catalog.meta AS catalog_meta, catalog.created_at AS catalog_created_at, catalog.updated_at AS catalog_updated_at \\nFROM catalog \\nWHERE ST_Contains(catalog.footprint, ST_GeographyFromText(%(ST_GeographyFromText_1)s))' {'ST_GeographyFromText_1': 'POINT(9.3889166667 40.0101944444)'} [sqlalchemy.engine.default]\r\nERROR:astropy:ProgrammingError: (ProgrammingError) function st_contains(geography, geography) does not exist\r\nLINE 3: WHERE ST_Contains(catalog.footprint, ST_GeographyFromText('P...\r\n              ^\r\nHINT:  No function matches the given name and argument types. You might need to add explicit type casts.\r\n 'SELECT catalog.id AS catalog_id, catalog.name AS catalog_name, catalog.instrument AS catalog_instrument, ST_AsBinary(catalog.footprint) AS catalog_footprint, catalog.meta AS catalog_meta, catalog.created_at AS catalog_created_at, catalog.updated_at AS catalog_updated_at \\nFROM catalog \\nWHERE ST_Contains(catalog.footprint, ST_GeographyFromText(%(ST_GeographyFromText_1)s))' {'ST_GeographyFromText_1': 'POINT(9.3889166667 40.0101944444)'}\r\n```\r\n\r\n**However if I cast everything to geometry types, it works:**\r\n\r\n``` \r\nq = session.query(Catalog)\\\r\n    .filter(func.ST_Contains(func.Geometry(Catalog.footprint),\r\n                             func.Geometry(func.ST_GeographyFromText(point))))\r\n```\r\n\r\nIs this something wrong with my naïve understanding of PostGIS/SQL, or is there a gap in geoalchemy2's support for geography types here?"}}