New answers tagged

0

I was waiting that the moderators will unhold your question here after the edit but still nothing so here is a possible answer, check the comments I left there for adding the count of overlapping points: Here to add the columns of X and Y : alter table your_Table add column x double precision; alter table your_Table add column y double precision; update ...


3

If I am understanding you right you started out with an NLCD raster and a polygon feature class of your grids. You then converted the raster to polygon within each of your grids cells to yield polygons with the corresponding NLCD land cover class. Spatial Analyst Approach: I would redesign your workflow as follows: Before converting to polygons I recommend ...


0

First, File Geodatabases (limited) and enterprise geodatabases (full) are the only types of geodatabases that support subqueries like you are doing. See here for examples: http://pro.arcgis.com/en/pro-app/help/mapping/navigation/sql-reference-for-elements-used-in-query-expressions.htm You might begin with a more simple query and build up from there. Or try ...


5

An sql where clause can't incorporate sql functionality such as MAX or MIN because your input can only be what proceeds WHERE in an sql. Note how in the Select By Attribute window the first part of the SQL query is already provided: The make feature layer sql where clause behaves in the same fashion. If you want to create a feature layer with a minimum or ...


3

As commented by @MichaelMiles-Stimson: Intersect the layers. Spatial Join would work then you only need to select where VILLAGE <> VILLAGE_1. This will give you the locations.. are you after the specific points? if so use geodatabase feature class (static OID) then both OID (point and polygon) are in the attribute table, join by attributes to ...


0

Could be helpful for future: arcpy.SelectLayerByAttribute_management("pts", "NEW_SELECTION", "\"FID\" = "+ str(i)) In this example, value is int, but expression has to be str, thus just convert it str(i)and append it to expression. In addition, if the value is str i.e. i='0', then I would apply format, i.e. "\"FID\" = \"{}\" ".format(i)


1

Not sure what do you mean with "a house next to it" but here an example of what you can try: SELECT a.id, a.geometry, 'T'::text as type FROM houses a, houses b WHERE ST_Intersects(a.geometry,b.geometry) AND a.id != b.id Could be done with other spatial operator (ST_DWithin could be a better candidate). Better with Gist index on geometry field.


0

Make sure you use the right type of single quotes: '' If you use `` the parser will freak out.


0

Please try ALTER TABLE "schema"."table" ALTER "Location" TYPE geometry(Point) USING ST_Force2D(ST_GeomFromText('POINTZM(' || "Location" || ')')) ST_Force2D is optional but is used to only keep the lon.lat values.


3

Assuming you have two tables "a" and "b". Table "a" is the table to be cut. CREATE TABLE a ( id serial PRIMARY KEY, geom geometry(MultiPolygon,31370) ); Table "a" is of type multipolygon because we don't know yet if some polygons will be separated in multiple parts afther the "cookie cut". CREATE TABLE b ( id serial PRIMARY KEY, geom ...


0

To be clear, it seems that you want to count routes by county. I assume routes is a (MULTI)LINESTRING and counties is a (MULTI)POLYGON. You have also indicated that they are both tables use the same SRID (4269). The ERROR: relation "counties" does not exist is odd, but you say in the comments that SELECT count(*), name FROM public."Counties" group by name; ...


1

This is WKB format wichs is a binary representation of the geometry. To select the geometry in GeoJSON format for example you can use : ST_AsGeoJSON()


1

Read your CSV file and create a vars_list list of tuples to insert. Reading the CSV file is off topic, but it should have a structure something like this: vars_list = [ (lng1, lat1, lng2, lat2), # first record (lng1, lat1, lng2, lat2), # second ... ] Then insert them all at once with executemany, like this: sql = '''\ INSERT INTO ...


0

If you open your CSV up as 'space delimited' in for example LibreOffice Calc, the data is separated nicely... I took your example string and put it in notepad with headers for each of the 4 data points: Then I opened it up in LibreOffice Calc and specified 'space delimited': And it looks fine: So from there, I would export it out again as a 'comma ...


1

The simplest answer is to use a CQL filter in the WMS request to restrict which landuse types are drawn on the map. There is a full tutorial available to get you going. However in your case it would be something like: http://...../geoserver/wms?....&CQL_FILTER=landuse='grass' when you want to filter by grass or more complex options like: ...


1

In the past I've overcome this by replacing the whole where clause with a parameter, and then set the default to 1=1 SELECT * FROM areas WHERE %query& you can then supply the full clause e.g. landuse = 'grass' within the parameter declaration in the URL. I appreciate this is a slightly unsatisfactory, and there would be more elegant solutions ...


2

You can do your own function in PostgreSQL like this (Example taken from the docs) : CREATE TABLE foo (fooid INT, foosubid INT, fooname TEXT); INSERT INTO foo VALUES (1, 2, 'three'); INSERT INTO foo VALUES (4, 5, 'six'); CREATE OR REPLACE FUNCTION get_all_foo() RETURNS SETOF foo AS $BODY$ DECLARE r foo%rowtype; BEGIN FOR r IN SELECT * FROM ...


0

If the area of the ST_Union equals the sum of the areas of each polygon. I think you can conclude there are no overlaps. As I recall if you union two triangles whose corners touch, the result has two rings. If you buffer the union by some small (epsilon) amount and the resulting geometry/geography has only one exterior ring, I think you could conclude ...


0

The answer was quite simple: do additional joins. SELECT EVENT_ID, ROAD_ID, Event_Status_Description, Strategy_Description, Activity_Description FROM ((TEMP_OWNER.ROADS LEFT OUTER JOIN (SELECT EXTRACTVALUE(CodedValues.COLUMN_VALUE, 'CodedValue/Code') AS Event_Status_Code, ...


1

There are two views that you need to check geometry_columns and geography_columns that will provide you with a list like: "ian";"public";"coastline";"geom";2;27700;"MULTILINESTRING" "ian";"public";"motorway";"geom";2;27700;"MULTILINESTRING"


1

I studied your questions, because sometimes I need it.. My suggestion is depends of your format: Case A: Shapefile Create a new shapefile using "Dissolve" Tool Case B: PostGIS: Create a View using "Group by"



Top 50 recent answers are included