New answers tagged

1

Yes it's possible to do this in python. Check out the documentation on the Make Query Layer tool http://pro.arcgis.com/en/pro-app/tool-reference/data-management/make-query-layer.htm You can also use the make query table tool (http://pro.arcgis.com/en/pro-app/tool-reference/data-management/make-query-table.htm); if you specify a shape field the query table ...


1

Look at creating a set of valid animal/year values . feed that into the loop. Using arcpy, run frequency analysis on the data, using the two fields as the frequency fields. The resulting rows will be the valid combinations. With a cursor on the table, read the animal/year into your query. Frequency the data Open search cursor on frequency table For row in ...


2

This can be done a bit more simply with json_build_object in PostgreSQL 9.4+, which lets you build up a JSON by supplying alternating key/value arguments. For example: SELECT json_build_object( 'type', 'Feature', 'id', gid, 'geometry', ST_AsGeoJSON(geom), 'properties', json_build_object( 'feat_type' : feat_type, ...


2

Instead of a marker you can generate a buffer, setting each category (metro, tam and bus) to a numeric field (1000, 750 and 500). Then run the following queries: SELECT cartodb_id, ST_Transform( ST_Buffer(the_geom::geography, 1000)::geometry ,3857 ) AS the_geom_webmercator FROM table_name WHERE field_name ilike 'metro'; SELECT ...


2

You need to define how the tables included are related. Also, for this purpose you have st_shortestline, that creates the line for you. The syntax is: Select st_shortestline(a.geom, b.geom) From a, b Then you probably want to put some where clause there or you will get all possible combinations between the tables.


2

So far I could think of computing the bounding box and getting its maximum Y value like in: order by ST_YMax(Box2D(geom)) PS: Actually the conversion to a box is not necessary and to sort from north to south desc works like a charm, hence the final query part is order by ST_YMax(geom) desc


0

The workaround I figured out I still don't think is the ideal way to do it, but for now will work. Instead of using the Migrate Storage process in ArcMap, I simply opened up the catalog, right-clicked on my edited feature class/table in my connected db and selected "export" --> "to geodatabase (single)". In the export window, I was able open the optional ...


1

Try UNION ALL for collecting all the geometries before running ST_COLLECT. SELECT ST_Collect(geometry) FROM (SELECT geometry from tbl1 UNION ALL SELECT geometry from tbl2 UNION ALL SELECT geometry from tbl3 UNION ALL SELECT geometry from tbl4);


1

SQL Server spatial functions implementation is in its current state not able to reproject or transform between different coordinate reference systems. The spatial data types are nothing more than a CLR (Coomon Language Runtime) data type implementation of the OGC Simple Feature Access specification plus some extended functions plus the spatial index. You can ...


1

This would have been my solution: import csv results_csv = r"D:\results.csv" # This is the location of the csv containing your results modified_results_csv = r"D:\modified_results.csv" # This is the location of the csv that will contain the modified results header = ["US_NUMBER","Absolute_Distance_ft","DESCRIPTION","FEATURE_TYPE_ID", "Line ...


1

You need a Layer attribute in your input into ogr2ogr for it to convert into layers in CAD. I wrote a post about this for a straightforward GML to DXF conversion, using an intermediate step of ShapeFile because or geometry issues with the outputs: http://gisforthought.com/gis-to-cad-using-ogr2ogr-part-2-gml-to-dxf-with-os-mastermap/ But it works just as ...


3

A few things... filter is a reserved name in Python (it's a builtin function) so you shouldn't use that as a variable name. your where clause is already a string as you are using GetParameterAsText() to return it as a string, so no need to put it inside quotes. You should try something like this: reference your where clause like this: where = ...


4

Are you talking about the Enable Enterprise Geodatabase tool in ArcToolbox? Please see System tables of a geodatabase in SQL Server which lists all tables created when enabling your Enterprise Geodatabase and explains what they're for. Near the top of that page is a link to this PDF diagram of how all the system tables relate. *Other RDBMS Below The ...


1

You'll want to update from the results of another query. For performance it's best to do within the context of an indexed column, so you end up with some ugliness. WITH sums AS ( SELECT a.cartodb_id AS cartodb_id, Count(*) as count, sum(a.popn) as popn FROM populated_places_esp a JOIN populated_places_esp b ON ST_DWithin( ...


0

Solved, i'm stupid. I mistook longitude and latitude, the correct sentence is insert into dummy_zip values (4,'prueba_directa','2016-04-13 08:08:15.973731','prueba_directa',1,1,100,'2016-04-13 08:08:15.973731',(SELECT ST_Transform(ST_GeomFromText('MULTIPOLYGON(((-1.121951 37.986504,-1.121243 37.986741,-1.120792 37.985794,-1.121479 37.985608,-1.121951 ...


0

Using Spanish cities from populated_places as an example table, the following SQL query count the number of closest (100 Km) neighbors of each city: SELECT p.name, COUNT(*) AS num_neigh FROM populated_places_esp n, populated_places_esp p WHERE ST_DWithin(p.the_geom::geography, n.the_geom::geography, 100000) AND p.cartodb_id != n.cartodb_id GROUP BY ...


1

You can use a common table expression, CTE, to first calculate the values of the centroids, eg, WITH centroids(geom) AS (SELECT ST_Centroid(geom) FROM table1) SELECT t2.*, t3.*, t4.* FROM table2 t2, table3 t3, table3 t4, centroids ct WHERE ST_Contains(t2.geom, ct.geom) AND ST_Contains(t3.geom, ct.geom) ..... In the case of your ...


2

As you know and is clear from the coordinates in your code: 37.986504 -1.121951,37.986741 -1.121243,37.985794 -1.120792,37.985608 -1.121479,37.986504 -1.121951 google maps uses the Geographic Coordinate System WGS 1984 Then what is the coordinate system of the polygon in your code? Does your code apply this coordinate system (wgs1984) on the ...


1

You should be able to do this using the Distance Calculator tool. You can find it under Tools > Tool Manager, just check the 'Loaded' box and it will come up under your Tools menu. If I remember correctly you can search for objects from one table within a certain range of objects from another table. OR You do this using a bit of MapBasic, a simple loop ...


0

Would a circular buffer work? It will not be a perfect circle, but you could set the segment count high, something like 60, then run buffers if they are the same radius for each of the points, and create a buffer for each of the points rather than combining the results. You could also create another field in your data point table calling it radius. It will ...


0

I'm not completely sure, but when reading the ogr2ogr documentation, the -clipdst and -clipdstsql seems to relate to destination data object and therefore might not be relevant to this operation. Is there a reason why you chose those variables? I would suggest using the following syntax (untested): ogr2ogr -f GeoJSON ./test-buildings.geojson ...


1

Something along these lines: Dim nRowID As Integer, sValue As String Fetch First From MY_TABLE Do Until EOT(MY_TABLE) If MY_TABLE.OBSERVATION = "" Then nRowID = MY_TABLE.ROWID Update MY_TABLE Set OBSERVATION = sValue Where ROWID = nRowID Else sValue = MY_TABLE.OBSERVATION End If Fetch Next From MY_TABLE ...


0

I found a solution: ´╗┐SELECT tx_county.name AS "County Name", tx_county.geoid AS "GEOID", puma.pumace10 AS "PUMA", (tx_county.aland <= puma.aland10) AS "Within", (tx_county.density >= 5,000) AS "Urban" FROM tl_2015_48_puma10 as puma, (SELECT * FROM tl_2015_us_county WHERE statefp = '48') AS ...


1

I believe you could solve this with a case statement: CASE WHEN st_within(st_centroid(tx_county.geom), puma.geom) AND tx_county.aland <= puma.aland10 THEN 'TRUE' ELSE 'FALSE' END AS "Within" You would need to revise how the tables join, likely using ST_Intersects(puma.geom, tx_county.geom) that way you don't end up with ...


1

First PACK YOUR TABLE! Then I would add a column to your base table called ID and update that with RowID. Once that's done, select out all records which have a blank value in the Observation column into a query table. Then use a custom function to update this query table with the required values. See example code below (untested): Include "MapBasic.def" ...


6

You are using the wrong operator, It should work with : "Attribute" NOT LIKE 'Poly-Line-%'


3

The error happened because EPSG:5514 is no added in spatal_ref_sys table. So you can add it using the following query. INSERT into spatial_ref_sys (srid, auth_name, auth_srid, proj4text, srtext) values ( 5514, 'EPSG', 5514, '+proj=krovak +lat_0=49.5 +lon_0=24.83333333333333 +alpha=30.28813972222222 +k=0.9999 +x_0=0 +y_0=0 +ellps=bessel ...


1

You need to add the other fields to your INSERT query : INSERT INTO polygonstbl (id, code, year, geometry) ( SELECT id, code, year, ST_Buffer(point, 300, 'quad_segs=8') FROM pointstbl ); Another way is to create directly your table like that : CREATE TABLE polygonstbl AS ( SELECT id, code, year, ST_Buffer(point, 300, 'quad_segs=8') AS ...



Top 50 recent answers are included