Tag Info

Hot answers tagged

11

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

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]


7

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.


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

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

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


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


5

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


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. */ #/* ...


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

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


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


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


3

The GeoDatabase Extent always expands out - never shortens automatically. Compacting and Compressing only optimizes storage and fragmentation, but not the Extent itself. I would try recreating the spatial index first and see if that does the trick. Update: Since the spatial index rebuilding doesn't do the trick, I am sure the following VBA code will: ...


3

I use a code similar to this. Try using the following code (its modified from what I use and this is untested). # Import arcpy modules import arcpy from arcpy import env def extents(fc): extent = arcpy.Describe(fc).extent west = extent.XMin south = extent.YMin east = extent.XMax north = extent.YMax width = extent.width height = ...


3

There is an internal method on Extents, _normalize, that will do this for you. For instance, when you've wrapped the map around a couple of times, and you have a point: var p = new Point(-100, 40); This will return false: map.extent.intersects(p); // false While this will work: map.extent._normalize().intersects(p); // true


3

If you want the current visible view you should be using activeView.Extent. This will return an Envelope which can be used as an input into the Clip tool. The Extent property holds the visible area of the view. The Extent is automatically captured whenever the view's transformation changes. For example, when the active view is a Map, the Extent is ...


3

If you want to do this "right" (taking into account the fact that latitude and longitude are angular units, and using an ellipsoid as a model of the earth's shape), you can try using the geographiclib library, which is a Python version of Charles Karney's Algorithms for geodesics. See also the Wikipedia page Geodesics on an ellipsoid for a look into some of ...


3

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


3

Well, if you really don't have a join field then you'll have to do a spatial join. You can join features on the extent layer with features on the original layer using the within filter (that is, features in the original layer should be inside features on the extents layer). That works unless one geometry in the original layer completely contains another ...


3

I'm guessing you have a Grass Mapset open? If so, it's the GRASS 'region' being shown. EDIT: Note that you can toggle it on/off from the Grass toolbar "Display Current Grass Region" button and edit it with the "Edit Current Grass Region" button.


3

The ST_Envelope() function operates on single geometries, therefore you are right, you need aggregate your MULTILINESTRINGs before you pass them by St_Envelope(). St_Collect() is a good aggregation function for that job. SELECT ST_Envelope(st_Collects(foo.geom)) FROM line_table as foo WHERE foo.type='a'; If you want to retrieve the bounding box for each ...


2

I don't know exactly what causes it in File Geodatabases, but I am indeed able to replicate it and it is something I've faced before. The only way I was able to find out how to bypass it is to Compress the file geodatabase. That will fix the extent issue. You will need to Decompress it when you're done, because you can't edit a Compressed file geodatabase. ...



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