Tag Info

Hot answers tagged

8

Instead of using multiple RegExes to parse addresses, just use Esri's out of the box tool that is designed for this task, Standardize Addresses. It's available at all license levels and my experience with it has been positive.


6

First, install the psycopg2 package, a Pythonic interface for PostgreSQL. Then, use ST_MakePoint: >>> import psycopg2 >>> conn = psycopg2.connect(dbname=..., port=..., user=..., password=..., host=...) >>> x, y, z, = 32, 34, 0 >>> cur.execute("SELECT ST_SetSRID(ST_MakePoint(%s, %s, ...


4

You're probably getting some sort of exception being raised. Perhaps use a Queue to pass messages back to the parent process. Tested working code: import os, arcpy, arcgisscripting, time, sys from multiprocessing import Process from multiprocessing.queues import SimpleQueue def ConvertCADtoGDB(msgs,in_dgn,out_gdb): try: gp = ...


2

The real issue lies in the line: for j in newraster: where you are indeed trying to loop (iterate) through a raster object, which is not "loopable". As Erica points out, this won't work and is not necessary. I think you are simply trying to figure out what % of the cells have a value >= 14, correct? Erica has a correct answer - althoiugh populating a new ...


2

I suggest that you do not need to make a second raster to accomplish this. Rather, use Python to sub-set the dictionary to select only the desired values. This should both bypass the problem, and run faster. # original dictionary from raster dct = {row[0]:row[1] for row in arcpy.da.SearchCursor(i, flds)} sumcnt = sum(dct.values()) # new dictionary with ...


2

Try the following workflow: Reclassify your rasters so that Value = 1. Calculate Cell Statistics using a "SUM" statistic. Any value in the resulting raster > 1 is an overlap area. Additionally, the value of the resulting raster indicates how many overlapping rasters there are.


2

You are using the syntax from the question, not the answer. Also, the pre-logic code for Python can't reference field names. You also might want to check out .rpartition(). You shouldn't have to use pre-logic at all: Sector = !FolderPath!.rsplit("/")[0] But if you did want to use pre-logic, here's how to do it: def sect(field): return ...


2

See this prior answer. Each version of ArcGIS uses a specific version and architecture of Python and is hard-linked against it. Forcing an ArcObjects application to use an incompatible Python version will likely lead to a crash.


1

The ETOPO1 dataset merges topography and bathymetry in one elevation model. Quoting the home page: ETOPO1 is a 1 arc-minute global relief model of Earth's surface that integrates land topography and ocean bathymetry. It was built from numerous global and regional data sets, and is available in "Ice Surface" (top of Antarctic and Greenland ice ...


1

In a command window, type set > set.txt to get a list of all environment variables you have set. Your python installation may have set some values that QGIS does not like. The PATH variable is save, because qgis.bat sets its own path variable, but PYTHONPATH or something else may be harmful. Once you found a link to C:\Python27, go to the system ...


1

How about something like this: import arcpy mainTbl = r"C:\test.gdb\main" lutTbl = r"C:\test.gdb\lut" #Note the order of the fields in the search cursor has to coincide with field order in the update cursor #Also assumes the matching fields are of compatibale types (exanple: can't insert string into integer) lutDict = {r[0]:[i for i in r[1:]] for r in ...


1

The easiest solution is to use union, cascaded_unionor unary_union. All the lines are split at the points of intersection: from shapely.geometry import LineString line1 = LineString([(0, 0), (2, 2),(3,1)]) line2 = LineString([(2, 0), (2, 1),(1,2)]) print line1.intersection(line2) POINT (1.5 1.5) for line in line1.union(line2): print line LINESTRING (0 ...


1

There are two different ways that Tiles can be addressed, the TMS standard specifies that tile coordinates start at the bottom left, but in practice most software is using a coordinate system with the Y axis reversed from TMS: it starts at the top left instead of the bottom right. I don't know that there is really an official name for this scheme, some ...


1

You can achieve this in field calculator using python. This may not be the most elegant but it's a start, assuming the simpliest case (ie. your addresses all look the same). I would first create the additional fields needed. Assuming your column with the full address is called "Address". For HOUSENO in the field calculator write: ##Return just numbers ...


1

I modified the redistribute_selection() function above to make ~/.qgis2/python/mytools.py : from qgis.core import (QgsFeature, QgsGeometry, QgsVectorLayer, QgsMapLayerRegistry, QgsField) from PyQt4.QtCore import QVariant from qgis.utils import iface import math import numpy def ...


1

I am confident that an uninstall/reinstall of ArcGIS for Desktop with Python will at least get IDLE working again. Although there may be ways to avoid doing this, employing them successfully will depend on your skillset and experience, and for me, I would find an uninstall/reinstall to be the expedient.


1

Use the arcpy.Describe method on the featureset parameter and get the file property. import arcpy notRequiredFeatureSet = arcpy.GetParameter(0) arcpy.AddMessage('AOI is: ' + arcpy.Describe(notRequiredFeatureSet).file) if a Feature set was added: Executing: Script "C:\Program Files\ArcGIS\Desktop10.2\ArcGlobeData\continent.shp" Start Time: Wed ...


1

So, many thanks to all who commented on this. I will go ahead and answer this based on the discussion from those comments and my personal experience. As mentioned by @blah238 and @Branco, there is a JSON property on a featureSet that can be checked, however, when running the script from within ArcMap and using a featureClass as input, checking for that ...


1

Gdal PYthon binding works with conjuration with gdal. You need to have installed GDAL along with the binding to work. A quick skim over the errors you provided they suggest that while you installed gdal-python you haven't install the gdal by itself: A possible solution chain is: Install GDAL (http://www.gisinternals.com/sdk/) Append the installation ...


1

The Java Topology Suite includes a TopologyPreservingSimplifier. The code does not include a reference for the implementation, beyond stating that it operates in a similar manner to Douglas-Peucker, with additional constraints on altering the topology. This functionality has made it into the Java-to-C++ translation of JTS, libgeos, which is further ...


1

Short answer - No, ArcGIS will always pass parameters as as positional arguments. Longer answer - Sort of, if you use a slightly hacky technique of accepting both positional arguments or options in your script, using the parse_known_args method. Something like: import argparse def main(arg1,arg2,arg3): print arg1,arg2,arg3 parser = ...


1

My lib PyGeoj is specifically meant as a geojson file reader and writer, with a simple API that turns the file contents into objects with attributes, so you don't have to deal with the dictionaries directly. It also has some convenience methods, like calculate and add the bbox for the entire feature collection or just for each feature. So for instance, the ...


1

Try this while connecting: currentIndexChanged function pass 1 argument i.e is changed index and while defining build_Layer_Index_Changed pass two arguments (self, index). QtCore.QObject.connect(dlg2.Sel_Build_Layer, QtCore.SIGNAL("currentIndexChanged(int)"), self.build_Layer_Index_Changed())


1

Test the arcpy.JSONToFeatures_conversion(jsonfile, outputshapefile) function.



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