[postgis-users] Geography Data Type vs. Geometry Data Type w/ SRID of 4326?
Richard Gomes
rgomes1997 at yahoo.co.uk
Tue Apr 5 08:23:29 PDT 2011
I run into this difficulty too.. or kind of similar issue.
In a nutshell, I'm using EclipseLink and it does not recognized
Geography data type because there's no Geography class in postgis-jdbc
package.
Actually, in my specific situation, I realized that I don't need
Geography data type and I don't need even Geometry data type at all on
the client side. At the moment, I've created column names such as
longitude, latitude, northing, easting, geography and geometry that
allows me perform any query I need on the database side. I've also
created indexes on geography and geometry columns at the moment.
If I need to do something like opening Google maps, for example, all I
need to do is transfer longitude and latitude to the client side. So,
again, this is highly unlikely that I need to transfer geography or even
geometry fields to the client side.
Actually, at the moment, I'm only using Geometry data type (only Points)
and a Box2D which is intended to limit the domain of Points which should
be considered in a given query. See more on this:
http://postgis.refractions.net/docs/ch04.html#id2638955
This is an example of a native query I perform on the database side:
select a.postcode from postcode a, location b
where
b.fips = 'UK' and b.location like 'British Museum, %'
and a.geometry && st_expand(b.geometry, 1000)
and st_distance(a.geometry, b.geometry) <= 200;
There are ~1.7 million postcodes and ~250,000 locations in the database.
This query executes in about 40ms, which is pretty decent.
Regarding SRID, it depends on your application, accuracy you need, etc.
In my specific case, I only perform local queries, up to 50 miles. So, I
decided by storing Points matching the official SRID for a given
country. In the case of UK, I'm using this:
http://spatialreference.org/ref/epsg/7405/
I had to first do this: http://spatialreference.org/ref/epsg/7405/postgis/
I hope it helps
Richard Gomes
On 05/04/11 15:42, maw269 wrote:
> I noticed that GeoServer 2.0.3 does not recognize (yet) Geography Data Types.
> What would happen if you stored a lat/lon pair in a Geometry Data Type and
> gave it an SRID of EPSG:4326? Is that even possible? Would that break the ST
> functions available for Geometries?
> Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110405/2b0f734f/attachment.html>
More information about the postgis-users
mailing list