Skip to main content
added 90 characters in body
Source Link
geozelot
  • 30.9k
  • 4
  • 34
  • 57

The value you get there is most likely in decimal degrees...and thus quite useless; a degree doesn't represent the same ground distance in different latitudes and getting from there to metric values is tricky and unnecessary.

First off, you should always define a SRID for your geometries. You can, for example, run ogrinfo on the shapefile, the CRS is usually defined in the metadata.
Now, since ST_Distance returned decimal degrees, it's definetely referenced in a geographical CRS. Possibly the direct and most precise way then is to cast your geometries to geography type, i.e.:

... max(ST_Distance(dump.geom::geography, ST_Centroid(t.geom)::geography)) AS distance ...

This should return values in meter, based on an unknown datum, but calculated on a spheroid and possibly still quite precise, despite the missing CRS. Which is no excuse for not having tried harder to find one!

Update for completeness:
Use ... max(...) / 1000 ... to get results in km.

The value you get there is most likely in decimal degrees...and thus quite useless; a degree doesn't represent the same ground distance in different latitudes and getting from there to metric values is tricky and unnecessary.

First off, you should always define a SRID for your geometries. You can, for example, run ogrinfo on the shapefile, the CRS is usually defined in the metadata.
Now, since ST_Distance returned decimal degrees, it's definetely referenced in a geographical CRS. Possibly the direct and most precise way then is to cast your geometries to geography type, i.e.:

... max(ST_Distance(dump.geom::geography, ST_Centroid(t.geom)::geography)) AS distance ...

This should return values in meter, based on an unknown datum, but calculated on a spheroid and possibly still quite precise, despite the missing CRS. Which is no excuse for not having tried harder to find one!

The value you get there is most likely in decimal degrees...and thus quite useless; a degree doesn't represent the same ground distance in different latitudes and getting from there to metric values is tricky and unnecessary.

First off, you should always define a SRID for your geometries. You can, for example, run ogrinfo on the shapefile, the CRS is usually defined in the metadata.
Now, since ST_Distance returned decimal degrees, it's definetely referenced in a geographical CRS. Possibly the direct and most precise way then is to cast your geometries to geography type, i.e.:

... max(ST_Distance(dump.geom::geography, ST_Centroid(t.geom)::geography)) AS distance ...

This should return values in meter, based on an unknown datum, but calculated on a spheroid and possibly still quite precise, despite the missing CRS. Which is no excuse for not having tried harder to find one!

Update for completeness:
Use ... max(...) / 1000 ... to get results in km.

added 60 characters in body
Source Link
geozelot
  • 30.9k
  • 4
  • 34
  • 57

The value you get there is most likely in decimal degrees...and thus quite useless; a degree doesn't represent the same ground distance in different latitudes and getting from there to metric values is tricky and unnecessary.

First off, you should always define a SRID for your geometries. You can, for example, run ogrinfo on the shapefile, the CRS is usually defined in the metadata.
Now, since ST_Distance returned decimal degrees, it's definetely referenced in a geographical CRS. Possibly the direct and most precise way then is to cast your geometries to geography type, i.e.:

... max(ST_Distance(dump.geom::geography, ST_Centroid(t.geom)::geography)) AS distance ...

This should return values in meter, based on an unknown datum, but calculated on a spheroid and possibly still quite precise, despite the missing CRS. Which is no excuse for not having tried harder to find one!

The value you get there is most likely in decimal degrees...and thus quite useless; a degree doesn't represent the same ground distance in different latitudes and getting from there to metric values is tricky and unnecessary.

First off, you should always define a SRID for your geometries. You can, for example, run ogrinfo on the shapefile, the CRS is usually defined in the metadata.
Now, since ST_Distance returned decimal degrees, it's definetely referenced in a geographical CRS. Possibly the direct and most precise way then is to cast your geometries to geography type, i.e.:

... max(ST_Distance(dump.geom::geography, ST_Centroid(t.geom)::geography)) AS distance ...

This should return values in meter, based on an unknown datum, but calculated on a spheroid and possibly still quite precise, despite the missing CRS.

The value you get there is most likely in decimal degrees...and thus quite useless; a degree doesn't represent the same ground distance in different latitudes and getting from there to metric values is tricky and unnecessary.

First off, you should always define a SRID for your geometries. You can, for example, run ogrinfo on the shapefile, the CRS is usually defined in the metadata.
Now, since ST_Distance returned decimal degrees, it's definetely referenced in a geographical CRS. Possibly the direct and most precise way then is to cast your geometries to geography type, i.e.:

... max(ST_Distance(dump.geom::geography, ST_Centroid(t.geom)::geography)) AS distance ...

This should return values in meter, based on an unknown datum, but calculated on a spheroid and possibly still quite precise, despite the missing CRS. Which is no excuse for not having tried harder to find one!

Source Link
geozelot
  • 30.9k
  • 4
  • 34
  • 57

The value you get there is most likely in decimal degrees...and thus quite useless; a degree doesn't represent the same ground distance in different latitudes and getting from there to metric values is tricky and unnecessary.

First off, you should always define a SRID for your geometries. You can, for example, run ogrinfo on the shapefile, the CRS is usually defined in the metadata.
Now, since ST_Distance returned decimal degrees, it's definetely referenced in a geographical CRS. Possibly the direct and most precise way then is to cast your geometries to geography type, i.e.:

... max(ST_Distance(dump.geom::geography, ST_Centroid(t.geom)::geography)) AS distance ...

This should return values in meter, based on an unknown datum, but calculated on a spheroid and possibly still quite precise, despite the missing CRS.