Hot answers tagged

3

As it's not working, take it back a step and print yourlayer2QRY to see what is being passed to your arcpy.MakeFeatureLayer_management() - you'll see it's currently trying to query literally on "ID IN " + ZoneTuple + " AND " + "Labelr="+"'ZoneB'" whereas you want it to query on ID IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) AND Labelr = 'ZoneB' Once you get ...


2

The following query translates your question into a PostGIS query which sets the default state speed to all roads with NULL speed completely within a state. UPDATE roads SET speed = states.speed FROM states WHERE ST_Within(roads.geom, states.geom) AND roads.speed IS NULL


2

To prepare your script for receiving a parameter from the user, assign value to arcpy.getParameterAsText(0). The zero in the assignment identifies this as the first parameter you will set in the script tool. Next, modify your script to work with the parameter. Add an IF/ELSE statement to handle the option to clear the query: value = arcpy....


2

You've got some weird quoting going on. I find it helpful to print out the query being used in cases like this. In your case, the value of layer2QRY is literally: ' "ID IN " + ZoneTuple + " AND " + "Labelr="+"\'ZoneB\'" ' You've used triple quotes, which means everything between them is a string literal. Your first attempt may have been closer to ...


2

You can install PostgreSQL (opensource) and the PostGIS and TIGER extensions to load the TIGER data. This post has a lot of good info that I used to load the census data. Then you can run SQL queries to get at the data. I loaded all US Data into PostgreSQL on a Win 7 (64 bit) with 8 GB ram and a 230 GB hard-drive (with other apps installed).... I am just ...


1

FROM should contain table names, not column names (and 100 is missing here in the table name) The ON part should connect columns from both tables, but you have specified the same table on both sides. I suggest to put the whole sql statement in quotation marks, single ones for Linux and double for Windows. The roles of dst_datasource_name and ...


1

If you want to interact with this data using SQL expressions without loading into a database server (PostgreSQL/PostGIS or SQL Server), try loading the shapefiles into QGIS and use the DB manager plugin. There is a node called "Virtual Layers" > "QGIS Layers" then you will see the shapefiles in your map. You can hit the "SQL Window" button and start writing ...


1

To find the points distance (buffer) of another point there are two methods that could work: (note my data is stored in Colorado State Plane (feet) EPSG:2877 so I can use 5280 as the buffer distance) Use STIntersects: select points2.* from points1 as p1 , points2 as p2 where p2.shape.STIntersects(p1.shape.STBuffer(5280)) = 1 or STWithin: select ...


1

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 ...


1

Strickly looking for a SQL answer, you could try something like this (this is PostGreSQL syntax): SELECT t1.facilityid, t2.zonetype, t1.maxzonedistance FROM (SELECT MAX(zonedistance) maxzonedistance, facilityid FROM __yourtablename__ GROUP BY facilityid) AS t1 JOIN __yourtablename__ t2 ON (t2.facilityid = t1.facilityid and t2....


1

Assuming your FacilityID-ChemicalID-ZoneDistance combinations are unique, you can create a field in both your original table and dissolved table that you can use to match the ZoneType back up to your dissolve records. Like this:


1

You may want to use the Summary Statistics tool for this instead, it works like Dissolve but doesn't handle geometry, which you don't seem to need for this anyway. In either case, the problem is the same: if you want to know the maximum ZoneDistance for each FacilityID, you should only be basing your dissolve on FacilityID. Adding ZoneType as a dissolve ...


1

You need to use ST_GeomFromText to specify your point geometry, note that the coordinates are separated by a blank space and not a comma. Try the following (changed one of your point coordinates so that it isn't the same as the other): INSERT INTO myTable(id, name, geom) VALUES('1','test', ST_SetSRID(ST_MakeLine(ST_GeomFromText('POINT(528115 181037)'),...



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