Hot answers tagged

4

In the window where you select your table from your postgisdatabase, you have to doubleclick the layer Then a query-window opens where you can define what features you want to load from your table


4

I like to use the json_build_object function. SELECT row_to_json(fc) FROM ( SELECT 'FeatureCollection' As type, array_to_json(array_agg(f)) As features FROM ( SELECT 'Feature' As type , ST_AsGeoJSON(lg.geometry)::json As geometry , json_build_object( 'attribute1', attribute1, 'attribute2', ...


3

You seem to have a PostGIS installation that was created by loading the postgis.sql file, rather than using the CREATE EXTENSION postgis command. So when you dumped your database, you got not only the data, but also all the function definitions, which includes references to the 2.1 PostGIS library. Install PostGIS 2.1.8 on your new system. Create a blank ...


3

Load your shapefile(s) in as per instructions from http://suite.opengeo.org/docs/latest/dataadmin/pgGettingStarted/shp2pgsql.html Then query using something like SELECT sum(pointA.fieldB) FROM pointA, polygonC WHERE ST_Within(pointA.the_geom, polygonC.the_geom) AND polygonC.id = ?


2

I am not sure I really understand what you are doing. How can a point cluster be a collection of linestrings? , but .. Remember you are using a spatial database, why not use the functionality in PostGIS? from a bunch of points you can collect them and use ST_Centroid on the collection. Or if it really is a collection of linestrings that you want to get ...


1

The function used in UpdateGeometrySRID is st_setsrid instead of st_transform. st_setsrid just sets the srid value without changing the coordinates. Since there is no function for looping tables to transform projection in PostGIS according to updateGeometrySRID function. I suggest you to write a script in python to execute it: Firstly execute to get the ...


1

There are several alternatives using CARTO to solve the points-overlapping problem. First, if you have a timestamp column and the deaths have happened in two different dates, you can use Torque. That is an animated map. Second, the Wizard of the old Editor allow you to aggregate points in clusters, intensity or density maps. But my favorite example is using ...


1

Your syntax is wrong. But in the documentation is exactly the example given you need. Just took an example for streetname from the first basic example in the documentation an put it together to an insert statement. Did not test it. It is also important how your table is structured and that you have the appropriate columns as it is needed for the correct ...


1

Try setting the SRID like this: ALTER TABLE streets_nordeste ALTER COLUMN geom TYPE geometry(linestring,3857) USING ST_SetSRID(ST_GeometryN(geom, 1),3857);


1

Easiest way is to reference the table twice and use different conditions. One condition with the distance and one with the polygonid you want to have calculated. The result you safe as a new table. You get a new geometry with the objects within your search distance(plus the chosen feature) and the distances as a column. CREATE TABLE polygon1 AS SELECT ...


1

It seems that 'shp2pgsql-gui' is now part of the postgis-gui package Try : sudo apt-get install postgis-gui It worked for me.


1

If you want to take advantage of ST_DWithin, you'll need to specify a cutoff radius to limit the expansion of clusters. (It's possible to have a set of inputs where a user's cluster is the entire table). Say we have a user at (-80, 40), and we want to limit the search radius to 15km. That can be done with this modification: SELECT row_number() over () ...


1

If you look at the docs for cursor.fetchall you will see that the return value is a list containing many tuples, each tuple representing a row in the returned query (cursorset). So, in order to test for that a return value [(True,)] is true, you need to use double indexing, [0][0], once to return the first element of the list, and once to select the first ...


1

You might consiider PostGIS FDW (Foreign Data Wrapper) - it will connect to remote files such as Shapefiles or CSV, and they will appear and be queryable just like 'normal' PostGres tables. I think you'd need to use the GDAL/OGR FDW library - it supports shapefile connections. But don't take my word for it: http://postgis.net/2014/12/19/postgis_fdw/



Only top voted, non community-wiki answers of a minimum length are eligible