Tag Info

Hot answers tagged

12

Dont use env.extent you need to get raster extent. import arcpy elevRaster = arcpy.sa.Raster('C:/data/elevation') myExtent = elevRaster.extent print myExtent i hope it helps you...


9

Right-click the feature class in ArcCatalog and go to the Properties. In the Feature Extent tab, click on Recalculate. And voilĂ ! I'm using ArcGIS 10.2.1


9

In ArcMap, normally you have the Data View, and you have a PageLayout View. Additionally, you'll have atleast one DataFrame, out of which only one can be active. This is reflected in the various ArcObjects Interfaces. The IMxDocument.FocusMap refers to the DataFrame which is in Focus. The IMxDocument.PageLayout refers to the PageLayout The ...


8

The ext is an object and not a list so Split won't work. What you can do is: list = [ext.XMin, ext.YMin, ext.XMax, ext.YMax]


8

They probably set it to a fixed extent. If you right click the data frame, go to properties, and under the "Data Frame" tab you can set the extent to "Automatic" which should allow you to move things around.


8

Okay, let's rock these features out of the DragBox! There are three options I have found to extract those features from the extent of the DragBox. Considerations and assumptions: I couldn't extract the layer types (raster or vector) from the map.getLayers() object, so let's assume that we stored the feature layers in individual global variables. The ...


7

Generally to calculate the area of a bbox in a projected coordinate system since it's a (big) rectangle you can use the area formula : area = (sw_longitude - ne_longitude) * (sw_latitude - ne_latitude) Depending now on your spatial location (ie you're in a projected crs) the above formula will give you square mapunits (km^2, m^2 whatever). In case ...


7

The trick is to compute the limits of the data that have values. Perhaps the fastest, most natural, and most general way to obtain these is with zonal summaries: by using all non-NoData cells for the zone, the zonal min and max of grids containing the X and Y coordinates will provide the full extent. ESRI keeps changing the ways in which these calculations ...


7

I think the simplest way to achieve what you are describing is by using Spatial Bookmarks: A spatial bookmark identifies a particular geographic location that you want to save and reference later. For example, you might create a spatial bookmark that identifies a study area. As you pan and zoom around your map, you can easily return to the study ...


6

Here's a version of @whubers method for ArcGIS 10.1+ as a python toolbox (.pyt). import arcpy class Toolbox(object): def __init__(self): """Define the toolbox (the name of the toolbox is the name of the .pyt file).""" self.label = "Raster Toolbox" self.alias = "" # List of tool classes associated with this ...


6

After struggling with it for about 6 hours I was able to get it to work. Here is the script I used to solve the problem: lyrstands = new OpenLayers.Layer.Vector("Stands 1stQ 2012", { strategies: [new OpenLayers.Strategy.BBOX()], eventListeners: { 'loadend': function (evt) {//THE LOADEND EVENT LISTENER - WHEN THE LAYER IS DONE ...


6

IF I have understood the question correctly it sounds like you want know the minimum bounding box of the values that are not null.Maybe you could convert the raster to polygons, select the polygons you are interested in and then convert them back to a raster. You can then look at the properties values which should give you the minium bounding box.


6

Main problem is getting the area of the extent. I wrote a quick ogr function to do this def extentArea(extent): #Unpack extent tuple to coordinates minX, minY, maxX, maxY = extent #unpack the tuple #Create empty geometry and add vertices geom = ogr.Geometry(type = ogr.wkbLinearRing) geom.AddPoint_2D(minX,minY) ...


6

I've finally solved this for my purposes so here's the solution I came up with if it helps anyone: Write a python script (mine at end of this) which essentially does this: identify the unique categories in the point layer field of interest for each category, select all matching points and establish the extent of this set for each extent generate a new ...


5

Compacting the Geodatabase will tidy up your spatial index "If you frequently add and delete data, you should compact your file or personal geodatabase on a monthly basis. You should also compact a geodatabase after any large-scale change. Compacting tidies up storage by reordering records and eliminating unused space. After compacting, the data in each ...


5

Here is an ArcCatalog add-in for ArcGIS 10 that adds a command to update the feature class extent, likely using the same method as @Ragi's VBA code: Re-calculate or update extent of feature class


5

Probably the python port of gdalinfo would help you. You can see at the top of the file that all the coordinates are reported using the GDALInfoReportCorner method: #/* -------------------------------------------------------------------- */ #/* Report corners. */ #/* ...


5

The Ogr function GetEnvelope() returns "a tuple (minX, maxX, minY, maxY)" (from here), but what you want (from what I can understand) is a Polygon describing the envelope/bbox? This is actually rather simple, as the tuple (minX, maxX, minY, maxY) is all you need to create a Polygon. Just create a Polygon based these, like so: from osgeo import ogr def ...


5

Michael Miles-Stimson had the same idea as me, but since you aren't familiar with coding, here's another (similar) option. Turns out this is pretty easy to do using Field Calculator. Create a field called something like "Orientation" and make it a text type. Open the field calculator and set the parser to Python. Tick the "Show Codeblock" box and enter ...


4

When working with a map that uses web mercator as its spatial reference, you can use map.geographicExtent to get the map's extent in wgs84 (lat/lon coordinates).


4

Running the following code in the QGIS Python console clips all features in the currently active layer with a polygon that exactly covers the current viewport, and adds the clipped features to a memory layer: viewportPolygon = QgsGeometry().fromWkt(iface.mapCanvas().extent().asWktPolygon()) layer = iface.activeLayer() resultlayer = ...


4

It is easiest with shapely: from shapely.geometry import box extents = [(-180.0, -90.0, 180.0, 83.624), (-124.731, 24.956, -66.97, 49.372), (-122.42, -37.818, 151.207, 52.516)] for i in extents: a = box(i[0],i[1],i[2],i[3]) print i, a.area (-180.0, -90.0, 180.0, 83.623999999999995) 62504.64 (-124.73099999999999, 24.956, -66.969999999999999, ...


4

This will return you the extent of the canvas. extent = iface.mapCanvas().extent() Reference: http://qgis.org/api/classQgsMapCanvas.html#a878f0c387c9475d59c6aac425db01020


4

The Extent object supports a 'disjoint' (i.e. does not intersect) method. Try something like: for mxdname in arcpy.ListFiles('*.mxd'): print mxdname mxd = arcpy.mapping.MapDocument(os.path.join(env.workspace, mxdname)) df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] for lyr in arcpy.mapping.ListLayers(mxd, "" ,df): if ...


4

Download the MS Access database and/or the polygon shapefiles from the EPSG Geodetic Dataset Registry (upper right, "export registry"). You do have to register, but we don't spam or sell the list of registered users. The MS Access database contains the rectangular extent areas of use only. Or you can download the files from the OGP website, same login ...


4

You can download the EPSG data from http://www.epsg.org/DownloadDataset after you register. No cost to register, and no delay between registration and download. There are two formats that might be useful - a set of PostgreSQL scripts (also other databases, but PostgreSQL is the one I checked) that insert data, so you can do a query of the epsg_area table. ...


3

What's the coordinate system aka spatial reference of the map? If it's 3857 / Web Mercator, these lat/lon values are probably being interpreted as xy values in meters. You may need to project the envelope or the points before creating the envelope. First, you might try assigning a geographic coordinate system to the envelope but I don't know if it will work. ...


3

If you need the minimum area bounding circle, then look at this link (Bounding Containers). Make sure you are using projected coordinates. Shapefiles are supported, and it has been tested in ArcMap 10 but should work in 10.1. The fundamental python code for other platforms is included within the zip file.


3

Ok I solved this. I had to specify a bigger extent on the DataFrame in ArcMap before I published the service. Before the extent was set just to the extent of the featuerlayer in the DataFrame.


3

If you want to update extent of feature classess in your mxd document this chunk of code might help you: Dim pLayer As ILayer Dim pEnumLayer As IEnumLayer Dim pFeatureLayer As IFeatureLayer Dim pFeatureClass As IFeatureClass Dim pFeatureClassManage As IFeatureClassManage pEnumLayer = pMap.Layers pLayer = ...



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