postgresql - PostGIS bounding box query returned strange results -
I tried the following SQL commands:
Create tablespace (lat_lng geography Point, 4326), location_name varchar (50)); Make indexes place_lat_lng_idx (lat_lng) at places to be used; Include in the values of places ('digits (-126.4 45.32)', 'food bar 1'); INSERT values at places ('POINT (-126.4 47.32)', 'Food Bar 2'); The value of places in INSERT ('digits (-125.4 47.42)', 'food bar 3'); Select the place place_name, ST_AsText (lat_lng) as the location from the place where places.lat_lng & amp; ST_MakeEnvelope (-130.0, 44.0, -100.0, 46.7, 4326);
The result is:
place_name | Point ------------ + --------------------- Food times 1 | Points (-126.4 45.32) Food Bar 2 | Points (-126.4 47.32) Food Bar 3 | This is not right for me, as is ymax 46.7, but "Food Bar 2" and "Food Bar 3" have ymax values of 47.32 and 47.42. , Where is the problem strongly?
:
With your query points here, this envelope has been subdivided with cartesian space:
SELECT ST_Segmentize (ST_MakeEnvelope (-130.0, 44.0, -100.0, 46.7, 4326) :: Geography, 50000);
That's why you are right Geography must be within the envelope, however you have a & amp; Amp; Amp; & Amp; Amp;
Bounding box operator, which ignores the geometry size, the bounding box for the geography envelope looks like this:
which shows all the points of the boundary
Fix the query with something like this:
SELECT place_name, ST_AsText (lat_lng) as the location from the points where ST_Intersects (ST_MakeEnvelope (-130.0, 44.0) , -100.0, 46.7, 4326), places.lat_lng)
Comments
Post a Comment