Questions tagged [postgis]

Make sure to utilize the tag specific to PostGIS, a spatial database extension for PostgreSQL. Prior to using this tag, take into account whether your inquiry may be more suited for the Geographic Information Systems Newtab Q&A site (e.g. if it pertains more to configurations or geodetic principles rather than actual programming).

Finding the center of a polygon in geoJSON using Django

Working on developing a REST API for managing geo-related data. The front-end developer is requesting the centroid of polygons in geoJSON format based on zoom level. Here is the structure of my polygon model: ... from django.contrib.gis.db import mode ...

Querying Multipolygons in Ruby on Rails using PostGIS

When querying my PostGIS database for districts, I receive the following output in my LatLon column: SELECT id, ST_AsText(latlon) AS geom FROM district; MULTIPOLYGON(((16.4747103091463 48.2753153528078,16.4744319731163 48.275314069121,16.4743511374383 48 ...

Enabling logging for the Mapnik SQL query while generating the map

Currently, I am utilizing the npm package known as Mapnik in conjunction with PostGIS. My goal is to include logging functionality that captures the SQL query executed by Mapnik, along with the value of the bbox parameter, when executing the render() funct ...

Converting the PHP encoded Postgresql query result into a stringified array

I have a SQL query that transforms the result into JSON format. SELECT 'FeatureCollection' As type, array_to_json(array_agg(f)) As features FROM ( SELECT 'Feature' As type, ST_AsGeoJSON(geom)::json As geometry, row_to_json((name, cat ...