PostGIS

postgis使用wkt或wkb创建几何

一笑奈何 提交于 2020-01-29 05:20:09
使用wkt创建 ST_GeomFromText 使用wkb创建 ST_GeomFromWKB 导出为wkt ST_AsText 导出为wkb ST_AsEWKB postgres=# select ST_AsEWKB(ST_GeomFromWKB ('\x0101000020e6100000dfc0e44691145d40e355d636c5fb4340', 4326 )); 警告: OGC WKB expected, EWKB provided - use GeometryFromEWKB() for this st_asewkb ------------------------------------------------------ \x0101000020e6100000dfc0e44691145d40e355d636c5fb4340 (1 行记录) postgres=# select ST_AsText(ST_GeomFromWKB ('\x0101000020e6100000dfc0e44691145d40e355d636c5fb4340', 4326 )); 警告: OGC WKB expected, EWKB provided - use GeometryFromEWKB() for this st_astext -------------------------

ST_HexagonGrid geom vector to find all points

假如想象 提交于 2020-01-25 06:42:08
问题 I was reviewing this function in PostGis https://postgis.net/docs/manual-dev/ST_HexagonGrid.html 1) What I don't understand is what the underlying geom data would be. What's the source to get the USA map as shown? What is the DB schema? I think it could be one record, if I only need the USA boundary, not each state? 2) Is the result a list of points? or geom vectors? 3) If geom vectors, how do you convert them into points of lat and lng? 4) How to do approximate the hexigons to approximate a

PostGIS installed, but unable to select version or add geography columns

浪子不回头ぞ 提交于 2020-01-24 21:26:24
问题 I've got an existing Postgres 9.6 database on Google Cloud that has the PostGIS extension enabled, however whenever I try to create a table with a column with the geography type or select the PostGIS version I get an error. For creating the geography column the error is non-descriptive — just an arrow pointing to the word geography in the following statement create table place(coordinate geography(POINT,4326)); The version error looks as follows: select postgis_full_version(); ERROR: could

[译] 为什么我们需要关注PostGIS? - Part 0

允我心安 提交于 2020-01-24 01:52:57
原文链接: https://medium.com/@tjukanov/why-should-you-care-about-postgis-a-gentle-introduction-to-spatial-databases-9eccd26bc42b 【我的废话几句,可以直接略过】技术文章的翻译是个吃力不讨好的事情,大部分技术人员的英语水平都能够直接吃透原文。况且关于翻译,有句话深得我心:不能翻译的部分,既不是最好的,也不是最坏的。那为什么还要翻译这篇博文呢?这段时间查阅PostGIS的资料,发现资料虽多,但很少有行文流畅而且浅显易懂的。我试图翻译的这篇是我看过的质量最高的科普文,值得推荐。 原文标题:Why should you care about PostGIS? — A gentle introduction to spatial databases 为什么你需要关心PostGIS? —— 空间数据库的简介 数据库?木啥兴趣。 跟GIS或者数据可视化打交道的人可能这么想。我必须承认,数据库不是世界上最性感的玩意(得罪了,DBA们),但是如果你说要(或想要)对(空间)数据正儿八经地做分析或者可视化,你绝对不能忽略数据库。我希望这篇博文能够告诉你有效地使用空间数据库能够给你带来什么好处。 在IT行业,“网红”术语不停地出现然后消失。几年前的一个“网红”叫做“大数据”

How to disable authentication altogether for Django admin

拥有回忆 提交于 2020-01-23 02:46:07
问题 I have a Django server (Using PostGis) and I want to disable everything related to authentication: When entering the admin no authentication will be required In the admin hide the Users/Groups After searching online I tried the combination of this & this It does get me the result I hoped for, until I try to add an object via the admin. Then I get an IntegrityError : insert or update on table "django_admin_log" violates foreign key constraint "django_admin_log_user_id_c564eba6_fk_auth_user_id"

How do I use Doctrine2 to work with GeoSpatial Queries using PostGIS?

走远了吗. 提交于 2020-01-22 12:44:07
问题 I have a public facing app that is based on Postgres and PostGIS. I have tried Googling for hours but have been unable to find any documentation that can show some basic geospatial stuff like getting distance between two points using Doctrine2. Not being able to use an ORM is a big deal for me in terms of determining my database of choice. Can someone show me a basic example of lets say showing all points within a radius of lets say 10 miles using Doctrine? 回答1: I wrote an article on my blog,

How to render OSM tiles

瘦欲@ 提交于 2020-01-16 18:07:10
问题 I would like to setup a tiles server. I found some documentation on the net and followed this tutorial. Now it seems like I have a well configured server with a small map (Guyana) in my database, that's cool ! But now, I still don't understand how to get and configure an interface to display my map... The tutorial suggests and give some links to OpenLayers and Leaflet but it seems to use online maps but I want to render my local files. Also, the tutorial say that "mapnik" is what does the

How to convert FeatureCollection to GeometryCollection or MultiPolygon?

老子叫甜甜 提交于 2020-01-16 08:38:10
问题 I have many polygons that need to be drawn manually and then get geo-coordinates. I need to get the coordinates of the drawn polygons in GeoJSON format. In this format: "{"type":"MultiPolygon","coordinates":[[[[37.4653933,55.3959159]...}" "{"type":"Polygon","coordinates":[[[37.475738525390625,55.41420507450017]...}" Or in this: "{"type":"GeometryCollection","geometries":[{"type":"Polygon","coordinates":[[[-98.0419921875,39.027718840211605]...}]}" I draw polygons at http://geojson.io/. But

PostGIS query failing due to escape string?

和自甴很熟 提交于 2020-01-16 07:19:27
问题 I have this Postgres/PostGIS query: UPDATE raw.geocoding SET the_geom = ST_Transform(ST_GeomFromText('POINT(((E'-96.6864379495382')::float8) ((E'32.792527154088')::float8))', 4326),3081) WHERE id=((10793455)::int4) When I run it, I get this error: ERROR: syntax error at or near "')::float8) ((E'" LINE 2: ...sform(ST_GeomFromText('POINT(((E'-96.6864379495382')::float8... ^ ********** Error ********** ERROR: syntax error at or near "')::float8) ((E'" SQL state: 42601 Character: 94 I'm

PostGIS query failing due to escape string?

北战南征 提交于 2020-01-16 07:19:20
问题 I have this Postgres/PostGIS query: UPDATE raw.geocoding SET the_geom = ST_Transform(ST_GeomFromText('POINT(((E'-96.6864379495382')::float8) ((E'32.792527154088')::float8))', 4326),3081) WHERE id=((10793455)::int4) When I run it, I get this error: ERROR: syntax error at or near "')::float8) ((E'" LINE 2: ...sform(ST_GeomFromText('POINT(((E'-96.6864379495382')::float8... ^ ********** Error ********** ERROR: syntax error at or near "')::float8) ((E'" SQL state: 42601 Character: 94 I'm