Намедни загружал
я шейп-файлы в БД PostgreSQL. По ходу узнал
много нового :)
Например, в
PostGIS есть тип данных Geography, помимо Geometry
The geography type
provides native support for spatial features represented on
"geographic" coordinates (sometimes called "geodetic"
coordinates, or "lat/lon", or "lon/lat").
Geographic coordinates are spherical coordinates expressed in angular
units (degrees).
The basis for the
PostGIS geometry type is a plane. The shortest path between two
points on the plane is a straight line. That means calculations on
geometries (areas, distances, lengths, intersections, etc) can be
calculated using cartesian mathematics and straight line vectors.
The basis for the
PostGIS geographic type is a sphere. The shortest path between two
points on the sphere is a great circle arc. That means that
calculations on geographies (areas, distances, lengths,
intersections, etc) must be calculated on the sphere, using more
complicated mathematics. For more accurate measurements, the
calculations must take the actual spheroidal shape of the world into
account, and the mathematics becomes very complicated indeed.
The conclusion?
If your data is
geographically compact (contained within a state, county or city),
use the geometry type with a cartesian projection that makes sense
with your data. See the http://spatialreference.org site and type in
the name of your region for a selection of possible reference
systems.
If, on the other
hand, you need to measure distance with a dataset that is
geographically dispersed (covering much of the world), use the
geography type. The application complexity you save by working in
geography will offset any performance issues. And, casting to
geometry can offset most functionality limitations.
В двух словах:
для огромных территорий, где кривизна
глобуса начинает значительно влиять
на точность измерений, лучше применять
Geography тип данных, ибо система координат
исходит из сфероида. Для малых территорий,
где погрешность вычислений из-за кривизны
глобуса невелика, можно применять
планарные СК, тип двнных Geometry.
Кроме того,
заявлено, что стандартный тип Geometry
автоматом приводится к типу Geography если
SRID=4326.
Интересно,
когда уже дистанцию начнут считать по
эллипсоиду?
Сниппет — как
загрузить шейпы в БД PostGIS (updated 2013-04-01)
set path=%path%;c:\Program Files\PostgreSQL\9.0\bin pushd c:\t\p chcp 1251 psql -e postgisdb postgres CREATE ROLE giswriter NOSUPERUSER NOCREATEDB NOCREATEROLE; CREATE USER mfs WITH password '12345678' IN ROLE giswriter; CREATE SCHEMA mfsdata AUTHORIZATION mfs; GRANT ALL ON SCHEMA mfsdata TO mfs; ALTER USER mfs SET search_path TO mfsdata,public; revoke mfs from giswriter; grant giswriter to mfs; GRANT SELECT ON geometry_columns TO giswriter; GRANT SELECT ON geography_columns TO giswriter; GRANT SELECT ON spatial_ref_sys TO giswriter; commit; \q shp2pgsql.exe -c -I -G -W cp1251 patching.shp mfsdata.patching > patching.dump.sql psql -f patching.dump.sql -e postgisdb mfs |
И сцылки по
теме
Комментариев нет:
Отправить комментарий