Tag Info

New answers tagged

1

I would use a Con() statement in Raster Calculator. Something such as: Con("raster2" / "raster1" > 0.1, 1, 0) This will generate a new raster where values of 1 represent areas where raster2 is > 10% of raster1, and values of 0 is <10%


1

SELECT category, ST_Union(geom) geom FROM s.road GROUP BY category; You might want to use ST_Dump() afterwards not to have multilinestrings in the result.


2

I could reproduce thew issue with your shapefile data. I used ogr2ogr for converting the shapefiles into PostGIS tables and your query finds nothing. Select * from state where ST_Contains(geom, (select geom from region where REGION_N='CAPITAL_REGION')); Next I opened your shapefiles with OpenJUMP and made some tests. Both layers have some topology errors ...


1

I was trying to do some changes and this looks like solution since everything works. I deleted old database and again created new one by creating a spatial database directly in pgAdmin: Created new database (name,owner...) Opened the query dialog box and wrote CREATE EXTENSION postgis; and then SELECT postgis_full_version(); This step ...


2

You can do this with two UPDATE statements, one for the distance, and the second for the line ID, with a subquery to get the values from the line table. And use the ORDER BY ST_Distance(...) LIMIT 1 construct to get only the closest line. I have a cities point layer, and a hiways line layer. Each has a primary key column 'pk'. I added to the cities two ...


1

As described in https://www.gaia-gis.it/gaia-sins/spatialite-sql-latest.html the function is used as ST_Line_Interpolate_Point( line Curve , fraction Double precision ) : Point An example that can be tested with SQL command line for example with spatialite-gui. Fraction=0.5 finds the midpoint. SELECT ST_AsText( ST_Line_Interpolate_Point ...


0

A self-join allows you to operate on the relationship between pairs of two features. But I don't think you're interested in pairs: for each feature, you want to operate on the relationship between that feature and all other features in your dataset. You can accomplish this with a subquery expression: CREATE TABLE parcels_trimmed AS SELECT id, ...


0

You can access to the specific coordinates of the bounds this way: console.log(bounds[0][0]); console.log(bounds[0][1]); console.log(bounds[1][0]); console.log(bounds[1][1]); But take into account that in the bounds you'll have two coordinates that form the two corners of the bounding box, so perhaps you ...


0

@jmsmcb answered this on Twitter. https://twitter.com/jmsmcb/status/624231773107564545 SELECT *, ST_Distance(the_geom, (SELECT the_geom FROM polygon_near)) as distance_to_polygon from points_near I think this returned degrees, so asking how to get meters or km. And here it is: SELECT *, ST_Distance(the_geom::geography, (SELECT the_geom FROM ...


0

I'm pretty sure the CartoDB javascript API is the Leaflet API, so have a look at their doco: http://leafletjs.com/reference.html#latlng You can either just pull the values out of there, something like this: var coord = L.latLng(50.5, 30.5); var lng = coord.lng; var lat = coord.lat; Or you could store it as your own object, like this: var lnglat = ...


0

Besides what Jorge says in his answer, you might be interested in creating your own Named Maps with variables so that you're able to map and query your private data. I recommend you to take a look at the documentation here and to this tutorial here.


0

Named Maps are about privacy of datasets, not the map itself. If any of the datasets you are using on your map is set to "private" then your map will be exposed as named. So, in order to be able to use normal setSQL or setCSS functions all your datasets need to be public or with link on the privacy settings.


1

Did you read http://postgis.net/docs/ST_Contains.html? ST_Contains — Returns true if and only if no points of B lie in the exterior of A, and at least one point of the interior of B lies in the interior of A. Creating SQL queries which construct geometry from WKT is a good and controlled way for testing the syntax select ST_Contains( ...


0

You can update the location of the points on the bad shapefile to that of the good doing a join and then using the Field Calculator to update the location: Using ArcToolbox>Add XY to the good shapefile, if not already in attributes. Perform the Join. Now that the bad shapefile has the attributes you need AND the POINT_X AND POINT_Y fields, you can update ...


1

not sure if this is really an answer, but hopefully points you in the right direction. I tried plugging it into CartoDB and got an error: the_geom_webmercator column should be selected I glanced through this, it might help http://docs.cartodb.com/tutorials/projections.html. Changing the_geom to the_gem_webmercator worked for me. I also had to play ...


2

Let arcpy build the correct syntax for you and use .format() so you don't need to juggle extra quotes: def selectzoom(convwkgid): fc = "Convwks" field = arcpy.AddFieldDelimiters(fc, "CONVWGID") selection = "{f} = {v}".format(f=field, v=convwkgid) arcpy.SelectLayerByAttribute_management(fc, "NEW_SELECTION", selection) mxd = ...


3

It's maybe your extra double quotes at the beginning and end of your code: Let's say convwkgid = 10000001 '"[CONVWGID] = ' + str(convwkgid) + '"' doesn't equal "[CONVWGID] = 10000001" '"[CONVWGID] = ' + str(convwkgid) + '"' would actually be '"[CONVWGID] = 10000001"' Try instead: '[CONVWGID] = ' + str(convwkgid)


2

Even if you could stomach writing 565 AND statements, that wouldn't give you what you wanted. What you're actually seeking to do is known as a table join. You want to select the records of one of your tables that have a match in the other table. Once you have your tables loaded in ArcGIS (and you will probably need to load your CSV to something indexed by ...


0

Error 1064 means syntax error. You are putting "AS distance" at wrong place. Try this: SELECT *, (3959 * acos(cos (radians($lat))*cos(radians(lat))*cos(radians(lng) - radians($long))+sin (radians($lat))*sin( radians( lat ) ) ) ) AS distance FROM `table_name` WHERE `column_name` LIKE '%search_term%' HAVING distance < 50 ORDER BY distance LIMIT 0 , 20; ...


0

It is not possible to do this in ArcGiS with SQL statement. If you want to do this with SQL you can only with some DBMS, (ex. Postgres): SELECT DISTINCT column FROM table; In ArcGiS you have to use some tools without SQL, maybe python script.


0

I don't have an answer to your exact requirements, but if you don't mind having one feature that is the result of the 'XY to Line' tool, this could work. You can overwrite the result each time you run the script. It would look something like this: # Import system modules import arcpy from arcpy import env arcpy.env.workspace = "c:/workspace" ...


0

If the sql command: Select uri_placeinst, ST_AsText(coord_placeinst) as coord_place_inst From public."NewInfoGeometric" where uri_contesto = %urlcont% and GeometryType(ST_AsText(coord_placeinst)) = %typegeom% and tipofeature=%typefeat% The expression GeometryType(ST_AsText(coord_placeinst)) returns a string perhaps you need ...


0

So it was as simple as checking the list resulting from the split. I hadn't noticed the empty string at the end of the list. That's my 'non existant SQL statement'. Changed sql_llist = sqlFile.split(";") to sql_llist= sqlFile.rstrip(';').split(';') and voilà! Everyday we learn something new. This is what I learned today: Why are empty strings returned ...


1

I have an example here that uses window.open: You can enable the description column in your infowindows in order to retrieve the data from there and avoid the SQL query. layer.on('featureClick', function(e, pos, latlng, data) { cartodb.log.log(e, pos, latlng, data); window.open(data.url); });



Top 50 recent answers are included