Tag Info

Hot answers tagged

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


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


4

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

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


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

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

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

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

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


2

The issue is of two differing spatial referenceses. When you create an extent with: var beginExt = new esri.geometry.Extent(-159.6716766, 19.520, -67.843, 64.8348, new esri.SpatialReference({wkid:4326})); The extent is is WGS 84, with units in Lat-long. Most Probably your map is in Web mercator. Hence you are projecting from gcs wgs84 to webmercator with ...


2

The CRS for bio_1 is clearly wrong, You have resolution : 0.08333333, 0.08333333 (x, y) extent : -125, -88, 18.5, 45.5 (xmin, xmax, ymin, ymax) That is, longitude/latitude coordinates for most of the USA, but you are using coord. ref. : +proj=utm +zone=48 +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 Probably because you changed the projection ...


2

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


2

In my experience, in ArcGIS, Extent doesn't mean what you would expect it to mean. The Extent is not the minimum Bounding Box of all features. It is the maximum possible extent of all features according to ArcGIS. Why that would be useful, is beyond me. However, there are a few things to correct the extent. Most of them are via ArcObjects, but this Addin ...


2

There are two approaches that could be used. The first one is more like what you are trying to achieve. Option 1: Layer max extent You can set the maxExtent property for the layer along with the displayOutsideMaxExtent property to prevent OpenLayers from requesting tiles that would fall outside the maximum extent. If you don't specify a maximum extent for ...


2

If only the longitude of center parameter is changed, the visible extents of the world are the same. I must assume that the blue background shape is a graphic shape rather than a geographic one. I have seen the data frame re-center when changing the longitude of center, which it shouldn't. If the graphic shape is defined relative to the data frame, that ...


2

If the data should cover whole of Spain, I see no problem with the negative coordinate. You will get more distorsions at the edges, but the map should work, until you don't have points on the backside of the globe. This should be the map extent, together with the UTM zones: The extent covers UTM zones 29 to 31, so UTM zone 30 is a good choice for a ...


2

I don't understand why you don't encode in a normal polygon and then when you need to use fitBounds you can use L.latLngBounds( latlngs ). Something like this: var bounds = L.latLngBounds([[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0],[100.0, 0.0]]); map.fitBounds(bounds);


2

One idea would be to hide the WMSLayer entirely if the map's extent is outside the layers "valid" extent. Based on this answer, one could listen to the map's extent-change event and check if the map's current extent is acceptable: map.on("extent-change", function () { // Check if map.extent is acceptable, otherwise hide the WMSLayer. if ...


1

As you have found out, the GeoJSON spec is completely silent on BOX type Geometries. So whatever you do will be non standard. That isn't something you should worry about. But if you still want to make sure that it should be valid GeoJSON, I'll suggest that you send an empty FeatureCollection with a bbox attribute like this { "type": "FeatureCollection", ...


1

here is another approach, with some test in the loop to help you identify if something goes wrong : import arcpy fcs = arcpy.ListFeatureClasses("C:\\folder\\Shapefile_root*") #shapefile_root is the start of the name of your shapefile for fc in fcs: print fc #just checking that you are looping on the good shp arcpy.env.extent = fc print ...


1

Yes. As per the the extent help, set arcpy.env.extent = 'path to shapefile' (assuming ArcGIS 10+ as you didn't specify). Don't forget to set the Snap Raster environment so your output raster isn't shifted.


1

per kenbuja's method... add this line. IDocument d = ArcMap.Document as IDocument; IUID ud = new UIDClass(); ud.Value = "esriArcMapUI.ZoomToSelectedCommand"; ICommandItem ci = d.CommandBars.Find(ud); ci.Execute(); A list of ArcMap ids are here (the ones I've been using still works in 10 and 10.1). ...


1

You could use the build-in command to Zoom to Selected features. This is from the Find Command and Execute Snippet public void FindCommandAndExecute(ESRI.ArcGIS.Framework.IApplication application, System.String commandName) { ESRI.ArcGIS.Framework.ICommandBars commandBars = application.Document.CommandBars; ESRI.ArcGIS.esriSystem.UID uid = new ...


1

Since you are already touching each feature that will be added to the selection set you can union each geometry to a new envelope and then set the active view to this new envelope. Prior to the loop: IEnvelope selectionFootprint = new EnvelopeClass(); Inside the loop: selectionFootprint.Union(pFeature.ShapeCopy.Envelope); After the loop: ...


1

MapServer Scale computation only works with GetMap request (WMS or CGI), that's why it doesn't work for feature request like WFS. You should put the scale intelligence on the OpenLayers side like this: var wfs = new OpenLayers.Layer.Vector("Airports", { styleMap: new OpenLayers.StyleMap({ externalGraphic: "red_pin.png", ...


1

I just generated 3 rasters that did not have the same extent and was able to add them. These are the steps I followed - fairly similar to yours, but no "normalizing". I did this the same as you (default processing extent used here) Set the processing extent to cover the whole area - I did this manually - but this is when it needs to be set - you can set ...


1

You mentioned that you looked at that from the ESRI link you posted. That link only focuses on the Extent portion of that dialog tab. Do you get what you want if you... Zoom to the extent you want Open the Data Frame Properties (View-->Data Fram Properties) and select the Data Frame tab In the middle of the dialog box is the 'Extent Used By Full Extent ...



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