English 中文(简体)
找出所有相互交织的地貌
原标题:Find all geometry that intersects a point

我试图找到一种办法,找到所有与卡托比.com的邮政局交织在一起的地貌。

我最接近的人能够照搬:

SELECT * FROM sf_blocks WHERE ST_Contains(the_geom, ST_GeomFromText( POINT(-122.44107 37.750066) ));

不幸的是,这种错误与欧洲复兴开发银行:混合的SRID地貌相作业。

What is the correct syntax to select geometry from a table that intersects with a point? My table, sf_blocks are all polygons.

最佳回答

The function ST_GeomFromText takes a second argument - the SRID. So if your sf_blocks layer is in Lon/Lat, WGS84 then the EPSG code is 4326. In this case

SELECT * 
FROM sf_blocks 
WHERE ST_Contains(
    the_geom, 
    ST_GeomFromText( POINT(-122.44107 37.750066) , 4326)
); 

should do it. If the sf_blocks layer is in some other Coordinate System, (and the point coordinate seems to be Lon/Lat) then you ll want to use ST_Transform around the GeomFromText part.

问题回答

st_transform will allow you to transform to other SRID, give it a look up on the web. 4326 is most common..sorry, lacking time to fully write an answer, will edit in a bit.

edit.just to establish the_geom in You example is a polygon or multipolygon?





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

难以执行 REGEXP_SUBSTR

I m 查询Oracle 10g。 我有两张表格(样本数据见下文)。 i m 试图提取一些领域

SQL Query Shortcuts

What are some cool SQL shorthands that you know of? For example, something I learned today is you can specify to group by an index: SELECT col1, col2 FROM table GROUP BY 2 This will group by col2

PHP array callback functions for cleaning output

I have an array of output from a database. I am wondering what the cleanest way to filter the values is example array Array ( [0] => Array ( [title] => title 1 ...

OracleParameter and DBNull.Value

we have a table in an Oracle Database which contains a column with the type Char(3 Byte). Now we use a parameterized sql to select some rows with a DBNull.Value and it doesn t work: OracleCommand ...

Running numbers in SQL

I have a SQL-statement like this: SELECT name FROM users WHERE deleted = 0; How can i create a result set with a running number in the first row? So the result would look like this: 1 Name_1 2 ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签