Question to experienced PostGIS users.
I am using official postgis/postgis:14-master image to run Postgres with PostGIS (gql API with ent&gqlgen in Go).
I am a bit surprised that with fresh db I get 8500 rows in "spatial_ref_sys" table. Seems like a lot (I read why it is needed in Postgis docs https://postgis.net/docs/manual-1.4/ch04.html#spatial_ref_sys)
So please tell me if is it normal or should I start looking into my Schema/edges.
Related
Over the last few months, I've been using the openstreetmap-tile-server on GitHub (link here) to render OSM tiles from a Docker container. The tile server uses a PostgreSQL database to store its data. From doing more research into creating my own OSM tiles and my own tile server, a lot of tutorials mention using a PostgreSQL database.
Why is this? Why not use an SQL database such as MySQL instead? What can be gained / is gained from using PostgreSQL rather than a different SQL database for a dataset such as the openstreetmap data?
EDIT: Edited question, to indicate that I'm comparing Postgres to other SQL databases.
Originally MySQL was actually used for the main internal OSM database that stores actual OSM data and is queried and modified via the OSM API. For tile rendering and other purposes the internal raw format is never used though, instead OSM data exported as compressed XML or in more compact binary PBF format is imported into a database schema more suitable for further processing.
Typically this is done with either the "imposm" or the "osm2pgsql" tool, with the PostgreSQL/PostGIS combination as the RDBMS of choice, as it provides the most powerful GIS feature set, at least in the free & open source world.
The main OSM database is an exception as any queries on it are always retrieving data for a rectangular area only, and so GIS extensions are actually not needed, having the coordinates stored as simple numeric data is sufficient in this case. Eventually it was decided to switch that to PostgreSQL, too, to reduce the number of different components to maintain in the openstreetmap.org site setup.
In theory you could also use other RDBMS with GIS support, too, e.g. the SpatiaLite variant of SQLite, or MariaDB/MySQL, but compared to PostgreSQL/PostGIS setup they have their disadvantages:
E.g. SpatiaLite is only good as long as there's only one thread accessing the data, with concurrent access it doesn't scale well at all.
And MariaDB and MySQL only really implement more or less the bare minimum of the OpenGIS SQL specs, end even that only really materialized over the last years. Feature wise both are still more than a decade behind PostGIS at least.
Disclaimer: even I, although working for MariaDB Corp, and having worked for MySQL AB before, in total for over a decade, have always recommended to use PostGIS over MariaDB or MySQL for GIS applications unless someone was bound to MariaDB or MySQL for other reasons already.
I am assembling a Business Intelligence solution using the Pentaho software as a BI engine. Within this solution, I had to set up a requirements for a PostgreSQL database server.
The current situation is very easy, since no ETL process is being carried out for data extraction, so the PostgreSQL configuration has not changed it much, and it is practically as it is configured as "factory".
I would like to know what Postgres configuration parameters have to be touched and modified to optimize it as a Datawarehouse. I have seen a lot of documentation, but it is not clear to me at all, since one documentation says that such values have to be modified, and other documentation, other completely different values.
I would like to know just that, if there is a clearer and more precise documentation to optimize a postgres 9.6 to be used as a Pentaho DW.
Thank you very much
I have migrated Oracle to Postgresql using Ora2pg tool.
The database size before migration in Oracle is around 2Tb,
The same database after migration into Postgresql,size seems only 600 gb.
NOTE: Records are migrated correctly with equal row counts.
Also i wanted to know how Postgresql handles Bytea data type after migration from Blob in oracle.
You might want to check if all migrated objects are present.
However, this is not surprising, and there are several things that can contribute to that:
You counted the size of the tablespaces in Oracle, but they were partly empty.
Your table and index blocks were fragmented, while they are not in the newly imported PostgreSQL database.
Depending on which options you installed in Oracle, the data dictionary can be quite large (though that alone cannot explain the observed difference).
Any idea how to go about doing that through a tool(preferred). Any alternate ways to do that.
You can check out the migration studio from EnterpriseDB here, although I have no experience with it.
There is no comparison to doing it yourself though - if you're not familiar with Postgres then this will get you familiar, and if you are, then aside from the data entry aspect, this should be old hat.
Use maxdb tools to generate a SQL text export of the database. Then import this file in PostgreSQL, luckily you won't need prior processing of the data dump.
I want to be able to do the following:
Select a Polygon and a point and see if the point lies within the polygon...I thought I could do this with MySQL but after a whole day of research it is simply not possible.
I have seen I need to use postgres and postgis, I have never used postgres before.
I have managed to install postgres and postpgadmin and it looks like I have created a database and got it up and running. Now I apparently need to add postgis to the database in order to use the functions? arent they just part of the postgres library? and why are people saying I need to add tables to the database to use the functions?
How do I add postgis to my database?
Can anyone give me any simple clear examples of a query to see if a point is in a polygon?
For purely geometrical queries you won't need postgis. Postgis is required when you want to mess with geographical data.
For an example of checking if a point is inside a polygon, this query should make it clear to you:
postgres=# select '((0,0), (1,1), (1,0))'::polygon #> '(.5, .5)'::point;
This will print true, meaning that the triangle formed by the points (0,0), (1,1) and (1,0) contains the point (.5, .5).
For more info check: http://www.postgresql.org/docs/9.0/interactive/datatype-geometric.html and http://www.postgresql.org/docs/9.0/interactive/functions-geometry.html
PostGIS is the spatial extension for the PostgreSQL database, and as is the case with many general-purpose databases, spatial functions have to be installed on top of a regular install.
The PostGIS website is informative, with nice documentation so head over there and read everything you need to know about obtaining and installing PostGIS.
Once installed and tested you'll need to spatially enable your database and then you're all set. If you have a dataset, of course.