Skip to main content
deleted 53 characters in body
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

Aha, I was confused for a while, but now I'm not.

Generally, I would expect a buffer in UTM to match up pretty well to a geodetic buffer. Close enough you wouldn't be able to see the difference. But, looking at your map, it looks like you're working in a European city, but you're generating your PostGIS buffer in UTM 18, which is valid in the area of New York City.

UTM projections get worse the further east or west you get from their central meridians, and you are very far east indeed of the center of UTM 18.

Try using the ST_DWithin(geography, geography, radius) function instead.

Or, if your work is always in one region, just figure out the right UTM zone for your region (Zone 31 for Hamburg, ESPG:26931) and keep using ST_DWithin(geometry,geometry,radius).

I also don't like your SQL syntax, BTW, try something without subqueries:

SELECT * FROM something 
WHERE 
  ST_DWithin(
    ST_Transform(h.geom, 26931), 
    ST_Transform(ST_GeomFromText($center_buffer, 900913), 26931), 
    $radius_buffer
  )

Unless you have a function reprojected index on the geometry column, this will also get slow as the table gets big, so you'll want to:

CREATE INDEX something_utm_gix ON something USING GIST (ST_Transform(geom, 26931))

Aha, I was confused for a while, but now I'm not.

Generally, I would expect a buffer in UTM to match up pretty well to a geodetic buffer. Close enough you wouldn't be able to see the difference. But, looking at your map, it looks like you're working in a European city, but you're generating your PostGIS buffer in UTM 18, which is valid in the area of New York City.

UTM projections get worse the further east or west you get from their central meridians, and you are very far east indeed of the center of UTM 18.

Try using the ST_DWithin(geography, geography, radius) function instead.

Or, if your work is always in one region, just figure out the right UTM zone for your region (Zone 31 for Hamburg, ESPG:26931) and keep using ST_DWithin(geometry,geometry,radius).

I also don't like your SQL syntax, BTW, try something without subqueries:

SELECT * FROM something 
WHERE 
  ST_DWithin(
    ST_Transform(h.geom, 26931), 
    ST_Transform(ST_GeomFromText($center_buffer, 900913), 26931), 
    $radius_buffer
  )

Unless you have a function reprojected index on the geometry column, this will also get slow as the table gets big, so you'll want to:

CREATE INDEX something_utm_gix ON something USING GIST (ST_Transform(geom, 26931))

Generally, I would expect a buffer in UTM to match up pretty well to a geodetic buffer. Close enough you wouldn't be able to see the difference. But, looking at your map, it looks like you're working in a European city, but you're generating your PostGIS buffer in UTM 18, which is valid in the area of New York City.

UTM projections get worse the further east or west you get from their central meridians, and you are very far east indeed of the center of UTM 18.

Try using the ST_DWithin(geography, geography, radius) function instead.

Or, if your work is always in one region, just figure out the right UTM zone for your region (Zone 31 for Hamburg, ESPG:26931) and keep using ST_DWithin(geometry,geometry,radius).

I also don't like your SQL syntax, BTW, try something without subqueries:

SELECT * FROM something 
WHERE 
  ST_DWithin(
    ST_Transform(h.geom, 26931), 
    ST_Transform(ST_GeomFromText($center_buffer, 900913), 26931), 
    $radius_buffer
  )

Unless you have a function reprojected index on the geometry column, this will also get slow as the table gets big, so you'll want to:

CREATE INDEX something_utm_gix ON something USING GIST (ST_Transform(geom, 26931))
added 13 characters in body
Source Link
Paul Ramsey
  • 20k
  • 2
  • 49
  • 58

Aha, I was confused for a while, but now I'm not.

Generally, I would expect a buffer in UTM to match up pretty well to a geodetic buffer. Close enough you wouldn't be able to see the difference. But, looking at your map, it looks like you're working in a European city, but you're generating your PostGIS buffer in UTM 18, which is valid in the area of New York City.

UTM projections get worse the further east or west you get from their central meridians, and you are very far east indeed of the center of UTM 18.

Try using the ST_DWithin(geography, geography, radius) function instead.

Or, if your work is always in one region, just figure out the right UTM zone for your region (Zone 31 for Hamburg, ESPG:26931) and keep using ST_DWithin(geometry,geometry,radius).

I also don't like your SQL syntax, BTW, try something without subqueries:

SELECT * FROM something 
WHERE 
  ST_DWithin(
    ST_Transform(h.geom, 26931), 
    ST_Transform(ST_GeomFromText($center_buffer, 900913), 26931), 
    $radius_buffer
  )

Unless you have a function reprojected index on the geometry column, this will also get slow as the table gets big, so you'll want to:

CREATE INDEX something_utm_gix ON something USING GIST (ST_Transform(geom, 26931))

Aha, I was confused for a while, but now I'm not.

Generally, I would expect a buffer in UTM to match up pretty well to a geodetic buffer. Close enough you wouldn't be able to see the difference. But, looking at your map, it looks like you're working in a European city, but you're generating your PostGIS buffer in UTM 18, which is valid in the area of New York City.

UTM projections get worse the further east or west you get from their central meridians, and you are very far east indeed of the center of UTM 18.

Try using the ST_DWithin(geography, geography, radius) function instead.

Or, if your work is always in one region, just figure out the right UTM zone for your region (Zone 31 for Hamburg, ESPG:26931) and keep using ST_DWithin(geometry,geometry,radius).

I also don't like your SQL syntax, BTW, try something without subqueries:

SELECT * FROM something 
WHERE 
  ST_DWithin(
    ST_Transform(h.geom, 26931), 
    ST_Transform(ST_GeomFromText($center_buffer, 900913), 26931), 
    $radius_buffer
  )

Unless you have a function reprojected index on the geometry column, this will also get slow as the table gets big, so you'll want to:

CREATE INDEX something_utm_gix USING GIST (ST_Transform(geom, 26931))

Aha, I was confused for a while, but now I'm not.

Generally, I would expect a buffer in UTM to match up pretty well to a geodetic buffer. Close enough you wouldn't be able to see the difference. But, looking at your map, it looks like you're working in a European city, but you're generating your PostGIS buffer in UTM 18, which is valid in the area of New York City.

UTM projections get worse the further east or west you get from their central meridians, and you are very far east indeed of the center of UTM 18.

Try using the ST_DWithin(geography, geography, radius) function instead.

Or, if your work is always in one region, just figure out the right UTM zone for your region (Zone 31 for Hamburg, ESPG:26931) and keep using ST_DWithin(geometry,geometry,radius).

I also don't like your SQL syntax, BTW, try something without subqueries:

SELECT * FROM something 
WHERE 
  ST_DWithin(
    ST_Transform(h.geom, 26931), 
    ST_Transform(ST_GeomFromText($center_buffer, 900913), 26931), 
    $radius_buffer
  )

Unless you have a function reprojected index on the geometry column, this will also get slow as the table gets big, so you'll want to:

CREATE INDEX something_utm_gix ON something USING GIST (ST_Transform(geom, 26931))
Source Link
Paul Ramsey
  • 20k
  • 2
  • 49
  • 58

Aha, I was confused for a while, but now I'm not.

Generally, I would expect a buffer in UTM to match up pretty well to a geodetic buffer. Close enough you wouldn't be able to see the difference. But, looking at your map, it looks like you're working in a European city, but you're generating your PostGIS buffer in UTM 18, which is valid in the area of New York City.

UTM projections get worse the further east or west you get from their central meridians, and you are very far east indeed of the center of UTM 18.

Try using the ST_DWithin(geography, geography, radius) function instead.

Or, if your work is always in one region, just figure out the right UTM zone for your region (Zone 31 for Hamburg, ESPG:26931) and keep using ST_DWithin(geometry,geometry,radius).

I also don't like your SQL syntax, BTW, try something without subqueries:

SELECT * FROM something 
WHERE 
  ST_DWithin(
    ST_Transform(h.geom, 26931), 
    ST_Transform(ST_GeomFromText($center_buffer, 900913), 26931), 
    $radius_buffer
  )

Unless you have a function reprojected index on the geometry column, this will also get slow as the table gets big, so you'll want to:

CREATE INDEX something_utm_gix USING GIST (ST_Transform(geom, 26931))