Questions tagged [geography-data-type]

geography data type, stores ellipsoidal (round-earth) data, such as GPS latitude and longitude coordinates.

Filter by
Sorted by
Tagged with
1 vote
0 answers
61 views

Unexpected ST_DWithin result when using geography [closed]

This query: SELECT ST_DWithin( ST_Buffer('SRID=4326;LINESTRING(7.1670005 45.9968257,7.1670216 45.9969537,7.1670216 45.9971326, 7.1670484 45.9972789, 7.1671905 45.9974074, 7.1672844 45.9974801, 7....
user avatar
  • 111
3 votes
0 answers
73 views

Efficient way to "gridify" SQLGeography shape

Read the "Background" below for full details of why I want to achieve this. Given a shape, I would like to process it in such a way that it conforms to a 0.00001 x 0.00001 degree grid. (This ...
user avatar
  • 31
1 vote
1 answer
448 views

SQL Server STIntersects, STDistance and STCointains with Lat Lon points and Geometry Polygons [closed]

I need to create 3 functions in SQL Server (2017) that has to do the following: IsPointInsideTown(Point, TownCode, [SRID]) -> true/false: indicates if the point is inside the town's polygon. ...
user avatar
0 votes
0 answers
177 views

How to store GeoJSON data in Big Query to be able to seamlessly work with Big Query GIS functions

I have this polygon which I have imported as such bq load \ --source_format=NEWLINE_DELIMITED_JSON \ --json_extension=GEOJSON \ --autodetect \ dataset.GeoJson \ sites.json From this I get this ...
user avatar
  • 101
5 votes
1 answer
137 views

ogr2ogr cannot import into table with two geography columns

I am using ogr2ogr to import geojson files into a PostGIS table. The table has two geography columns ("footprint" and "centroid"). The geojson files contain polygon features, and I ...
user avatar
  • 1,214
1 vote
1 answer
73 views

Make geographic squares that follow parallels in SQL Server

I have a list of points (with latitude and longitude) in an SQL Server database, and for each of these points I have to generate a 50 x 50 degrees square (the point being the South West angle of the ...
user avatar
0 votes
0 answers
258 views

SQL Server error when creating Geography data from a Multipolygon Geometry

So, in SQL server, I have a table called Municipios, which contains a column with 2463 entries of geometry type, with their SRID set to 4326. I'm running the following Query to try to convert them to ...
user avatar
1 vote
1 answer
77 views

PostGIS-Geography doesn't show in QGIS after database restore

I recently restored a PostgreSQL database from a SQL dump. It worked well insofar as all my tables and data are restored. However, one of the original tables contained a PostGIS geography column ...
user avatar
  • 1,478
1 vote
1 answer
128 views

Assurance that ST_Envelope works with geography as expected

Using PostGIS, I have a table of data with geographic points defined as last_known_coordinates GEOGRAPHY(POINT,4326). I want to find all of these within a geographic bounding box with given top left ...
user avatar
  • 113
4 votes
1 answer
325 views

Inserting geography data types with GeoPandas

I would like to insert a geodataframe containing point geometries in SRID 4326 to an existing table in PostGIS+PostgreSQL. The issue is that I would like to retain the existing table structure, which ...
user avatar
  • 1,483
3 votes
0 answers
120 views

BRIN Index on PostGIS Geography

I have about 1.5 billion points in a geography column which represent topography. I'll be retrieving all the points that are within a certain distance of a given long/lat. I was able to create a GIST ...
user avatar
1 vote
0 answers
63 views

SQLServer STArea issue with GEOMETRYCOLLECTION resulting in trillion's m2 area

I've come across a weird issue with SQL Server's handling of GEOMETRYCOLLECTION in a Geography data type resulting in an area (square meters) in the trillion's of square meters. (checked on 2014, ...
user avatar
0 votes
0 answers
63 views

PostGIS Geography Data Changed After pg_restore

Two PostGIS databases (PostGIS 3.0, PostgreSQL 13.1) were setup on two separate machines to be as close to each other as possible using a Docker image kartoza/postgis:13.1. A dump of the database was ...
user avatar
  • 1,567
3 votes
1 answer
145 views

Geography in GeoPandas?

Is there a way to make GeoPandas work with geographies? If GeoPandas were used with pygeos, is there a way to force all calculations (ST_Distance, ST_Length, etc.) to be geodesic? How do I tell it ...
user avatar
  • 39
1 vote
1 answer
235 views

How to get most accurate Point-Point distance queries in Europe with Spatialite

I have a GeoDjango app, currently on PostGIS, which I am converting to use Spatialite db instead. I have no specialised knowledge about GIS systems :( The locations table has a Geography column ...
user avatar
8 votes
1 answer
2k views

Is the Geometry(4326) an alias for Geography datatype?

The main reference about Geography datatype seems docs/using_postgis_dbmanagement: Prior to PostGIS 2.2, the geography type only supported WGS 84 long lat (SRID:4326). For PostGIS 2.2 and above, any ...
user avatar
  • 2,084
2 votes
1 answer
64 views

Complexify geography polygons in PostGIS

Is it possible to modify polygons (essentially, make them more complex by inserting additional points) so that their naïve point-linking rendering would be a closer match to their respective geodesic ...
user avatar
  • 263
0 votes
1 answer
196 views

Spatial and DateTime join in SQL BigQuery [closed]

I have 2 tables in BQ; one of them includes a geography column PointWKT (gps POINT) and second table includes a geography column BoundaryWKT (POLYGONS & MULTIPOLYGONS). Both tables also include ...
user avatar
  • 185
4 votes
1 answer
82 views

Storing Central European data, which SRS/which data type?

I am creating a PostGIS 2.X data base to store some 500 or so sites as points in it, which are distributed in the northeastern part of Germany, northern Poland and parts of the southern Baltic coast. ...
user avatar
  • 1,478
6 votes
0 answers
680 views

ST_Covers fails on GEOGRAPHY column with GiST index, PostGIS 3.0 [closed]

I'm trying to upgrade to Postgres 12 with PostGIS 3.0. Unfortunately, I can't get my spatial queries to work. There seems to be an issue using ST_Covers on a geography column with a GiST index. Proof ...
user avatar
2 votes
1 answer
63 views

Why is a "geography" type needed at all in PostGIS? [closed]

Let a and b be two points. ST_Distance(a, b) returns their distance. Instead of having two data types, geometry and geography, that practically overload the meaning of ST_Distance(), we could instead ...
user avatar
4 votes
1 answer
317 views

Finding all circles point lies in using PostGIS

Suppose you have a task to find all points within a certain radius. That's where you use ST_DWithin which is indexable and it will deal with it. My task is the opposite from that: I have a set of ...
user avatar
  • 143
2 votes
1 answer
75 views

How to check for PostGIS Function Support Matrix for new custom EPSG imported from EPSG site

I need a support for CRS that was not available in PostGIS 2.5 so I looked up into the EPSG site they had simple easy straight forward insert query to add EPSG so I did that now how do I check or know ...
user avatar
1 vote
0 answers
359 views

SQL server 2012 convert Multipolygon geometry to geography - GDA94 / MGA zone 55 coordinate reference system

Is there a way to convert geometry column value which has GDA94 / MGA zone 55 coordinate reference system into Geography value in SQL server 2012. The layer is a multipolygon layer We were having the ...
user avatar
  • 11
1 vote
1 answer
676 views

PostGIS view on multiple geometry columns

I have two PostGIS tables, ‘filelinks’ and ‘maricopa_plss_qtrqtrs’. The filelinks table has a geometry type column named ‘geom_p’ and the maricopa_plss_qtrqtrs has a geometry type column named ‘geom’. ...
user avatar
2 votes
0 answers
752 views

SP-GiST for geography type in PostGIS

This CREATE INDEX geography_gdx ON schema.table USING GIST (geog); works, but CREATE INDEX geography_gdx ON schema.table USING SPGIST (geog); gives me [42704] ERROR: data type geography has no ...
user avatar
  • 613
1 vote
1 answer
3k views

Convert datatype in Google Earth Engine from double to integer [closed]

How can I convert a variable to another data type using Google Earth Engine? For example I've created a NDVI image in double number (interval value -1.0 to +1.0). I want to save the image in byte (...
user avatar
  • 21
2 votes
0 answers
1k views

What is geometry(4326), and can you do Cartesian calculations with unprojected ellipsoidal coordinates?

I know Geography(4326) is an unbounded, and unprojected, and covers the entire world with ellipsoidal coordinates. I get that the math on this system is done on a spheroid. I also get that with a ...
user avatar
  • 6,701
0 votes
0 answers
221 views

How to set the extent of a PostGIS geography table?

I have multiple geography tables in PostGIS database. All of them have extents of (-180,-90;180,90), probably in their metadata, which makes editing difficult. I'd like to set the extent to exactly ...
user avatar
1 vote
1 answer
817 views

Pulling Spatial Data in Geography Format From MS SQL Server 2008 Using ogr2ogr

Can the MSSQLSpatial driver support geography fields queried from MS SQL Server 2008 as spatial data? Background I have been using unixODBC on an Ubuntu 16.04 machine with ODBC Driver 17 for SQL ...
user avatar
3 votes
1 answer
2k views

SQL WKT draws well with geometry, but not with geography data type

I have a following piece of code DECLARE @g geometry; DECLARE @borders geography; SET @g = geometry::STGeomFromText('SOME WKT', 0); SET @borders = GEOGRAPHY::STGeomFromText(@g.MakeValid()....
user avatar
  • 131
0 votes
0 answers
646 views

SQL Server - ESPG:4326 data stored in Geometry column

It seems that the Microsoft SQL Server Geography data type is better suited for lat/lon because Geography "stores ellipsoidal (round-earth) data, such as GPS latitude and longitude coordinates." ...
user avatar
4 votes
1 answer
6k views

How to Cast geometry to Geography in SQL script in MS SQL Server?

I have a Table with some spatial Data in MS SQL Server. The datatype of the spatial column is geometry. I'm trying to get the closest data from an input file using the following query: DECLARE @g ...
user avatar
3 votes
1 answer
600 views

Using use_spheroid=false in ST_DWithin of PostGIS

I have created 2 geography columns and indexed them using GIST. I am looking to use ST_DWithin for a larger dataset and to make it faster trying to use the use_spheroid=false. SELECT pois.objectid, ...
user avatar
  • 539
2 votes
0 answers
846 views

SQL Geometry type and Geography type conversions/projections

I am working with a replica database managed in Sql Server Management Studio 2016. My geographic data of points, lines, and polygons are projected in WGS_1984_UTM_Zone_17N Meter and SRID of 32617. Its ...
user avatar
1 vote
1 answer
70 views

Saving borough boundaries as MultiLineStrings or MultiPolygons?

I am creating a database in PostGIS and I have a column that will save the boundaries of boroughs. The app will later query the database, asking what points, lines or polygons are inside those ...
user avatar
  • 1,099
8 votes
2 answers
854 views

Is PostGIS geography type EPSG:4326 only?

I was under the impression that the geography type only uses the lat,long based coordinates EPSG:4326. And I didn't remember having to specify a CRS for a geography column. However, from this ...
user avatar
  • 10.3k
1 vote
2 answers
273 views

Does transforming postGIS geographic data to EPSG:4326 , makes them geographic?

I am reading this about "Clustering on Indices" and in 25.2 says that The geohash algorithm only works on data in geographic (longitude/latitude) coordinates, so we need to transform the ...
user avatar
  • 1,099
2 votes
1 answer
2k views

Add Geography Column to an existing table

I Have an existing table GPSPosition which has a coma seperated LatLong column. I have attempted to add a geography column using the query: alter table GPSPositions add geographyColumn as geography:...
user avatar
2 votes
1 answer
535 views

Fast(est) way to detect if point is in range of another point? (Geographic Coordinates)

I'm looking for a way to detect if 2 points are "near enough" each other for a match, and hopefully, if the range could be specified in metric system (each item may have different ranges, but there ...
user avatar
2 votes
2 answers
2k views

Transforming geographical points to geometry in PostGIS?

I have a PointField(geography=True) field in Django, which is translated into the following Postgres type: geography(Point,4326). I set the geography field to True because I thought it made sense for ...
user avatar
8 votes
1 answer
2k views

Export geography field from SQL for use in GIS

I currently have a table in SQL server management studio (2012) with a geography column. It definitely has valid spatial data, as I can view it in SSMS: What I want is to export the data as a ...
user avatar
1 vote
2 answers
4k views

Get latitude and longitude of a geography column

When doing the query in postgres to one that has a column whose data type is geography(MultiLineString, 4326) throws me the following result: select geom from base.osm_roads_free_1 limit 100; "...
user avatar
1 vote
1 answer
213 views

Strange result with ST_Distance, geography type and equator

I am getting strange results with distance queries in PostGIS using geography types and ST_Distance. According to the docs, ST_Distance should return the distance in metres between two geography ...
user avatar
2 votes
1 answer
470 views

What is ST_Geometry, ST_Curve and ST_Surface on PostGIS?

I dont't have any experience with geographics databases so I hope that you be patiente with me, so I opened this question (PostGis and datatypes WKT) in the past week about the datatypes in the ...
user avatar
3 votes
1 answer
297 views

Adding association for location with city or zip code when using PostGIS to add markers using geography?

On my front end, I am using google maps JS api. I am adding markers, the google maps event gives me the lat/lng for where I add the marker. I'm adding that marker into my postgres database: INSERT ...
user avatar
  • 131
57 votes
3 answers
13k views

What is the purpose of PostGIS on PostgreSQL?

PostgreSQL already supports spatial data types, operators and indexing. What does PostGIS provide exactly that made it necessary to exist as an extension to PostgreSQL? Why don't we all just use ...
user avatar
  • 749
1 vote
0 answers
650 views

How to implement Geography or geometry with spatial index implementation to find entities in the bounding box?

I have entities saved in SQL table with Lat and long values. I added another column to store Geometry values. Code for updating Geometry column UPDATE [dbo].[table] SET [GeoLocation] = geography::...
user avatar
  • 11
3 votes
2 answers
12k views

Inserting lat/long data into geography column of SQL Server 2012?

is it possible to insert lat/long data into geography column just by typing the coordinates lat/long as a double or string: INSERT INTO LOT_EXPLOITATION_LOT VALUES (3621,'oui','Forêt Boréale',560000,'...
user avatar
2 votes
1 answer
356 views

How to set my ESPG to geography POINT in PostGIS?

I'm trying to create a table into my PostGIS 2.3 CREATE TABLE destinations ( id serial PRIMARY KEY, sector integer REFERENCES sectors(id)...
user avatar