ArcGis Python Script, Calculate Field

Sorry for my English. I am trying to write a Python Script for ArcGis 10.2.               #import system modules      import arcpy      import math      from arcpy import env           #Set environment options      env.workspace="C:/Users/el/ac/script1"           # Set local variables      inFeatures = "line2.shp"      fieldName = "angle1"      expression = "GetAzimuthPolyline(!Shape!)"      codeblock = """import math      def GetAzimuthPolyline(shape):          radian = math.atan((shape.lastpoint.x - shape.firstpoint.x)/(shape.lastpoint.y - shape.firstpoint.y))          degrees = radian * 180 / math.pi          return degrees"""                # Execute AddField      arcpy.AddField_management(inFeatures, fieldName, "SHORT")      #print "Field has been added."           # Execute CalculateField      arcpy.CalculateField_management(inFeatures, fieldName, "GetAzimuthPolyline(!Shape!)", "PYTHON", codeblock)      Field was added, but the result is not calculated and is not write into the field. But, if I write the code block in Calculate field in ArcMap, field calculates correctly. Why? i'm sorry. Code was amended. But if i run the script:               Traceback (most recent call last):       File "C:\Users\el\ac\script1\scr1.py", line 35, in <module>     arcpy.CalculateField_management(inFeatures, fieldName, "GetAzimuthPolyline(!Shape!)", "PYTHON", codeblock)       File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\management.py", line 3354, in CalculateField         raise e     ExecuteError: ERROR 000539: Error running expression: GetAzimuthPolyline(GPVARIANTOBJECT0)      Traceback (most recent call last):       File "<expression>", line 1, in <module>       File "<string>", line 3, in GetAzimuthPolyline     AttributeError: 'str' object has no attribute 'x'


How to transform a PostGIS bounding box?

I need to query the bounding box of a table (in WGS 84, srid 4326), and transform it to Web Mercator to be consumed by an OpenLayers map. Currently, I am using this to retrieve the bounding box:               SELECT ST_Extent(geom) FROM mytable      Which returns the string `"BOX(2067507.49369776 650368.674310103,2095742.80207396 691604.021270793)"`. I have tried a variety of ways to transform this, but none have worked. Transforming the geometry before getting the extent doesn't work:               SELECT ST_Extent(ST_Transform(geom, 3857)) FROM mytable      It returns:               ERROR:  transform: couldn't project point (2.0841e+06 678457 0): latitude or longitude exceeded limits (-14)      Does anyone know what would be causing this error?


MapServer Templates: Javascript function won't recognize [LONG] or [LAT]

Tested this in js console with a 'normal' variable and working fine: js function in map_header.html               var toFixed = function(val, n) {         var result = val.toFixed(n);         if (result == val)           return val.toString();           return result;     }      issue in map_body.html, just trying it on [LONG] for now as you can see.               [LAT], toFixed([LONG], 2)      In the browser this will literally come up as               toFixed(the longitude number here, 2)      So the [LONG] is getting recognized, no problem there, no problem previously. The thing I don't understand is I have other js functions set up in map_header.html and call them in map_body.html and work fine. Why does this not work? Really, I don't even need a toFixed function, as that is built into js. But I tried that also, and no go. Any input is appreciated.


Converting custom grid to OS grid

I have two sets of data, one is in OS coords, no problem there, but the other was set out in about 50 off 10x10 metre grids aligned to a 'feature' on the ground. I do have the OS coordinates of their datum, but that's it. I'd appreciate some help on how to try and convert these grid data points to OS grid coords. I am using QGIS 1.8, but have access to a CAD system if that is easier. The four reference OS coords are: * 552369 265951 * 552363 266159 * 552470 266068 * 552625 265929 and the grid for the data are in the form, where x and y are in metres from the datum line * X Y No. * 600 20 2 * 600 30 6 * 600 40 0 * 610 10 4 * 610 20 4


Joining Data in ArcMap Errors

Has anybody encountered issues with ArcMap when joining data? Specifically, my rows join, however, depending on how ArcMap is feeling, I might or might not receive my data in the form of quantities. I have adjusted my formatting in excel a number of times, general to text, text to number, number to general, etc, you get it...this is pretty trivial, however, if anybody has encountered similar issues, especially when quantities only appear as categories or not at all. Any workflow suggestion would be much appreciated too when joining data. Especially for the rows that have been supplied and NOT created by the user.


How to automate creating box (rectangular) polygons in ArcGIS for Desktop?

Can anyone suggest a way to automate creating rectangle shaped polygons in ArcMap? If I had many 30m x 60m rectangles to digitize and I just want to click a starting corner coordinate on screen, then a second click for orientation. Is this more suited towards Python, or ArcObjects, etc..


Python - GDAL : Polygon to point shape file

I want to read all the points in a polygon shape-file and use their coordinates to make a new point shape file. then find the min and max of the X coordinates. So here is the code I wrote for the first part (polygon to point) and it makes the point shape file but the attribute table is just has the ID field.               from osgeo import gdal     from osgeo import ogr     from osgeo import gdal_array     from osgeo import gdalconst     from osgeo.gdalconst import *     import os     os.chdir('C:\Fcounty')     driver = ogr.GetDriverByName("ESRI Shapefile")     fname = 'PolygonFC.shp'     vector = driver.Open(fname, 0)     layer = vector.GetLayer(0)     ofname = 'PointFC.shp'     if os.path.exists(ofname):              driver.DeleteDataSource(ofname)          ovector = driver.CreateDataSource(ofname)     olayer = ovector.CreateLayer('points', geom_type=ogr.wkbPoint)     fieldDefn = ogr.FieldDefn('id', ogr.OFTInteger)     olayer.CreateField(fieldDefn)     featureDefn = olayer.GetLayerDefn()     point = ogr.Geometry(ogr.wkbPoint)     k = 0     f = layer.GetNextFeature()     while f:         geom = f.GetGeometryRef()         ring = geom.GetGeometryRef(0)         np = ring.GetPointCount()         for j in range(np):             p = ring.GetPoint(j)             ofeature = ogr.Feature(featureDefn)             point.AddPoint(p[0], p[1])             ofeature.SetGeometry(point)             ofeature.SetField('id', k)             olayer.CreateFeature(ofeature)             ofeature.Destroy()             k += 1        f.Destroy()        f = layer.GetNextFeature()     vector.Destroy()     ovector.Destroy()      as I mentioned this part is not giving me any error (I know it does not mean it works). So my questions are: 1- is this the right code? why there is no other fields beside 'ID' in attribute table? 2- How can i do the second part of it? (the coordinates for lowest and highest X) I want to get it from the point shape file, not the polygon.


Why is arcpy.mapping.ExportToPDF losing layer symbology?

When exporting a map it does not export the symbology within the data frame. I am using the code snippet below.               >>> myMap = arcpy.mapping.MapDocument("C:/USERS/NISUSER/DESKTOP/mxd_map.mxd")     >>> arcpy.mapping.ExportToPDF(myMap, "C:/AgTech/agtech.pdf")      The first image is what is located in the data frame: ![Data Frame](http://i.stack.imgur.com/qAA1B.jpg) ![Resultant PDF](http://i.stack.imgur.com/JrMa5.jpg) I am expecting the 2nd image to be identical to the 1st, but as a PDF. The symbology changes in the process somehow.


Why does arcpy.ImportToolbox() not work in ArcGIS 10 (SP5) when calling custom model for topology?

I have an arcpy/python script using ArcGIS10 and using a custom toolbox and model. The toolbox has an alias of `defaultTopo` and my model within the toolbox is called `AddRuleToTopologyModel`. This model was created because there is a known bug when calling the `AddRuleToTopology_management` tool for the **Must Be Covered by Feature Class of (Area-Area)** rule from python and the work around is to use this model. I'm simply updating my script from 9.3 to 10.0. The code goes like this:               # Defining location of toolbox which is in the same location as the script     toolboxLocation = sys.argv[0][:sys.argv[0].rfind('\\')]          # Importing custom toolbox     arcpy.ImportToolbox(toolboxLocation+"\ApplyDefaultTopology.tbx")          # Calling custom model for polygon feature class - not all the variables are posted here     arcpy.AddRuleToTopologyModel_defaultTopo(featureDataset+"\\"+topologyName,'Must Be Covered By Feature Class Of (Area-Area)',featureClass,featureDataset+"\\"+boundaryFC)      Now if i run the script from Eclipse it does not pick up my `featureDataset` location I use as argv1 in the script throwing the error I have in place. If I try and run the script from ArcCatalog I get the following error:               <type 'exceptions.AttributeError'>: 'module' object has no attribute 'exists'      Eclipse also tells me that `arcpy.AddRuleToTopologyModel_defaultTopo()` is an undefined variable when trying to only use arcpy. The strange thing is if i use `gp.arcgisscripting(9.3)` with `gp.AddToolbox()` to replace `arcpy.ImportToolbox()` the script runs fine from Eclipse and ArcCatalog because arcpy still supports the 9.3 geoprocessing object. I've been asked to remove all references to the `arcgisscripting` module and make the new script pure `arcpy` to function on our new servers. Thoughts? Thanks in advance.


Annotation features containing both GraphicElement and TextElement objects not drawing in ArcGIS Server map service?

I am building annotation features with Python/comtypes/ArcObjects. The annotation works great in ArcMap (10.1), but it is does not draw when published to a map service in ArcGIS Server. Each piece of annotation consists of one or more graphic shapes (GraphicElement), usually rectangles, and one or more graphic text objects (TextElement) on top of those graphics, all grouped together in a GroupElement. The GroupElement is what is stored in the annotation. The image below shows three pieces of annotation, two with graphic rectangle backgrounds and one containing only a TextElement. We thought the problem was with the custom font that contains the arrow characters, but that seems to be fine. The screen shot is from ArcMap. When the annotation you see here is published to a map service, only the plain annotation feature without the colored background draws in the service. The more complex annotation does not, so the problem would appear to be with the presence of both GraphicElement and TextElement objects in the same annotation feature or with the fact that the element stored is a GroupElement. (As far as I know, an annotation feature can only store a single element, hence the grouping of all the components first.) ![enter image description here](http://i.stack.imgur.com/OTyjB.jpg) **Might anyone have some insights as to why the complex annotation is not drawing?** When I started, many moons ago, to build the scripts to make the annotation this way, there was no intention, at least on my part, to deploy any of this on a map service. In fact, I know little about map services and their particular idiosyncrasies. I was writing strictly for data production in ArcMap to fill a need for building and storage of specialized graphical information in a geodatabase. The annotation solution worked so well that the powers that be have now run with it and are trying to use the annotation in map services and web apps. I am way outside of my comfort zone here, as my scripts have been converted to .NET and deployed in web apps, and I haven't had much to do with any of that. What I know is that the annotation works wonderfully in ArcMap but doesn't in a map service. Any ideas here would be much appreciated. **UPDATE:** I don't have access to the map service in question here, and my boss is doing the testing here and there between flights. My information is rather second hand; however, I might have another clue. (What it means, I'm not sure). There are other annotations that **do** render OK. One type is "graphic-only" built from multiple graphic shapes that are grouped together and stored in the annotation. The other is stop signs. These signs are built from one graphic shape and one text box containing the word "STOP." The difference between the stop sign and the other complex annotation features already discussed (which do not render) is that the text box uses only one font, Arial to be exact. The non-rendering complex annotations access both Arial (for the letters) and our custom font (for the arrows and other symbols). So, the annotations that are not rendering are the ones (1) built from both graphics and text boxes and (2) where the text boxes access multiple fonts. Both these conditions are necessary apparently to cause non-rendering. The plain annotation in the screenshot - which does render correctly - accesses both fonts but does not have a graphic. (Unfortunately, most of our annotation meets the above two non-rendering criteria.) Also, I have seen one maybe solution that involves moving the annotation layer to its own service using ArcGISDynamicMapServiceLayer. Does this make any sense to anyone? **UPDATE 2:** After much testing and some expert help from ESRI through the forums, a cause for the map service misbehavior was found. It appears that an ESRI optimized map service cannot handle _nested_ groups, i.e. groups within groups. The ESRI programmer who helped me is of the opinion that this shortcoming is a bug and is going to try to register it as such. I will next try to build our annotation without grouping any graphics until finally grouping all of them together after all parts are constructed. That way there is only the one overall GroupElement for the whole sign that is required for storage in the annotation. I'll update again with my results.


Can I prevent OpenLayers from losing my WFS-T feature edits?

Using openlayers (2.12) and drawing some vector features against a WFS-T interface (offered by geoserver). Problem is, when I draw some geometries and pan a little bit too much, openlayers sends "wfs:GetFeature" message to WFS-T interface, and while doing this it resets all features I have drawn so far. You can try this even using the public openlayers examples: http://openlayers.org/dev/examples/wfs-protocol-transactions.html   1. draw some features   2. pan / zoom around enough / too much before saving    3. the features you drew disappear Any way to prevent this?


Assign global variable to field in related table

I'm able to get ESRI's ArcPad Login Form to assign a global variable to a field in the EDITFORM for Page1, but I actually want it to assign to a field in a related table (TABLEFORM), using an onload event. The code below works to access the EDITFORM: > Dim pForm Set pForm = ThisEvent.Object > > pForm.Pages("Page1").Controls("txtUser").Value = > Application.UserProperties("LoggedInEmployee") But I can't seem to find any documentation on how to access a related table using the same method. This forum touches on my issue, but doesn't answer it. Any help/advice would be great.


Help exporting CSVs using MapBasic

I'm a beginner to MapBasic and I'm currently working on a tool, I want to export a table as a .csv either using Run Command or Export. I want to export it to a specific directory, for example C:/Network_checks/Tablename/duplicates. (the table name has been defined as sLayer). This is what I have tried so far Export Duplicate_Sections Into "C:/Network_Checks/" & sLayer & "/duplicate_sect.csv" Type "CSV" Charset "WindowsLatin2" Delimiter "," Titles I've also tried Run Command "Export ""_6450_HULL_DVI_AllGroups"" Into ""C:/Network_checks/" & sLayer & "/duplicates.csv"" Type ""ASCII"" Overwrite Delimiter "","" CharSet ""WindowsLatin1"" Titles" But this crashes MapInfo! I'm pretty sure it's just my " placements! Thanks, Alan


ArcMap add in constructor called not called on start up

I am converting some old tools to the new Add-In format and have noticed that the constructor is no longer being called during startup, instead it is being called when the tool is clicked for the first time (second and subsequent call OnActivate only). This particular tool is in a toolbar add-in and is of type ESRI.ArcGIS.Desktop.AddIns.Tool and should only be enabled if ArcMap is currently editing. Previously the constructor was called and set the tool.enabled = false arbitrarily (as you can't be editing on startup) and added an event handler for IEditEvents_OnStartEditingEventHandler which set the too.enabled = true (and stop editing too, enabled = false). Now that the tool is made into an add in I discovered by step-debugging that the constructor for the tool isn't called until the tool is clicked. After clicking the tool behaves in the intended manner as the events are wired. Is there a way to call the constructors during ArcMap startup, soon after or does anybody know of any other workaround?


How to improve performance of Oracle Spatial function sdo_aggr_mbr

I experienced bad performance when using the sdo_aggr_mbr function on a data set of more than 1 million rows, I had to terminate the operation after several minutes. The statement was:               select sdo_aggr_mbr(MY_GEOMETRY) from MY_TABLE      When I execute a similar operation, to create the bounding box in a manual way, the performance is very good:               select min(t.MY_GEOMETRY.sdo_point.x),      max( t.MY_GEOMETRY.sdo_point.x),      min(t.MY_GEOMETRY.sdo_point.x),     max(t.MY_GEOMETRY.sdo_point.y)       from MY_TABLE t;      That indicates that the database and the spatial index of the geometry column is configured in a correct way. Why is the aggregation function of oracle is so slow and what can be done to improve the performance?


How to close all layers in Mapinfo?

I want to close all layers in Mapinfo except one and again add one layer. How to do so in Mapinfo using Mapbasic or without?


mapquest batch geocoding truncate response

when I use the batch geocoding service I get sometimes a right answer an sometimes an error using the same arguments. I inspect the headers using curl... when the answer is right the headers are:               > User-Agent: curl/7.35.0     > Host: www.mapquestapi.com     > Accept: */*     >      < HTTP/1.1 200 OK     * Server Apache-Coyote/1.1 is not blacklisted     < Server: Apache-Coyote/1.1     < Set-Cookie: JSESSIONID=D76103E6D445BBCBF91B16094ABDCE2A; Path=/; HttpOnly     < Expires: Mon, 20 Dec 1998 01:00:00 GMT     < Last-Modified: Wed, 20 Aug 2014 18:26:28 GMT     < Cache-Control: no-cache, must-revalidate     < Pragma: no-cache     < Access-Control-Allow-Origin: *     < Access-Control-Allow-Methods: OPTIONS,GET,POST     < Content-Type: application/json;charset=UTF-8     < Transfer-Encoding: chunked     < Date: Wed, 20 Aug 2014 18:26:27 GMT     <     {.... correct message ...}      but when the answer is wrong the headers are the following, note that content- length is setted and the message is truncate resulting into an invalid json.               > User-Agent: curl/7.35.0      > Host: www.mapquestapi.com     > Accept: */*      >      < HTTP/1.1 200 OK     * Server Apache-Coyote/1.1 is not blacklisted     < Server: Apache-Coyote/1.1     < Set-Cookie: JSESSIONID=A7DC145B948D28B4D23E914379DCD012; Path=/; HttpOnly     < Expires: Mon, 20 Dec 1998 01:00:00 GMT     < Last-Modified: Wed, 20 Aug 2014 22:44:06 GMT     < Cache-Control: no-cache, must-revalidate     < Pragma: no-cache     < Access-Control-Allow-Origin: *     < Access-Control-Allow-Methods: OPTIONS,GET,POST     < Content-Type: application/json;charset=UTF-8     < Content-Length: 253     < Date: Wed, 20 Aug 2014 22:44:05 GMT     <      * Connection #0 to host www.mapquestapi.com left intact     {"info":{"statuscode":0,"copyright":{"text":"\u00A9 2014 MapQuest,     Inc.","imageUrl":"https://api.mqcdn.com/res/mqlogo.gif","imageAltText":"\u00A9 2014 MapQuest, Inc."},"messages":[]},"options":{"maxResults":1,"thumbMaps":false,"ignoreLatLngInput":false}      This is the query:               https://www.mapquestapi.com/geocoding/v1/batch?key=Fmjtd%7Cluur2q6b2h%2Can%3Do5-9a2xhu&json={"locations": [{"street": ", Regi\u00f3n Metropolitana, Chile"}, {"street": "Camino Ochagavia 12301, San Bernardo, Regi\u00f3n Metropolitana, Chile"}, {"street": "Los Yacimientos 1301, Maipu, Regi\u00f3n Metropolitana, Chile"}, {"street": "Las Nieves 331, Vitacura, Regi\u00f3n Metropolitana, Chile"}, {"street": "Camino Lo Sierra 04330, San Bernardo, Regi\u00f3n Metropolitana, Chile"}, {"street": "Avenida Pedro de Valdivia 3128, \u00d1u\u00f1oa, Regi\u00f3n Metropolitana, Chile"}, {"street": "Merced 838, Santiago, Regi\u00f3n Metropolitana, Chile"}, {"street": "Canal Concepcion Sur 2310, Maipu, Regi\u00f3n Metropolitana, Chile"}, {"street": "Avenida Luis Pasteur 6156, Vitacura, Regi\u00f3n Metropolitana, Chile"}, {"street": "San Francisco 9128, San Ramon, Regi\u00f3n Metropolitana, Chile"}, {"street": "Avenida 4\u00b0 CENTENARIO 196, Las Condes, Regi\u00f3n Metropolitana, Chile"}, {"street": "Avenida Condell 1213, Providencia, Regi\u00f3n Metropolitana, Chile"}, {"street": "San Sebastian 2812 , Las Condes, Regi\u00f3n Metropolitana, Chile"}, {"street": "Avenida Isabel la Catolica 4448, Las Condes, Regi\u00f3n Metropolitana, Chile"}, {"street": "Del Inca 4446, Las Condes, Regi\u00f3n Metropolitana, Chile"}, {"street": "Avenida 10 de Julio Huamachuco 542, Santiago, Regi\u00f3n Metropolitana, Chile"}, {"street": "Enrique Mac-Iver 180, Santiago, Regi\u00f3n Metropolitana, Chile"}, {"street": "Santa Corina 0473, La Cisterna, Regi\u00f3n Metropolitana, Chile"}, {"street": "Avenida Departamental 7480, Pe\u00f1alolen, Regi\u00f3n Metropolitana, Chile"}, {"street": "Libertad 720, Santiago, Regi\u00f3n Metropolitana, Chile"}, {"street": "Avenida La Florida 10139, La Florida, Regi\u00f3n Metropolitana, Chile"}, {"street": "Avenida Concha y Toro 2990, Puente Alto, Regi\u00f3n Metropolitana, Chile"}, {"street": "Manuel Antonio Tocornal 2359, San Joaquin, Regi\u00f3n Metropolitana, Chile"}, {"street": "Avenida Antillanca Sur 611, Pudahuel, Regi\u00f3n Metropolitana, Chile"}, {"street": "Avenida Andres Bello 2777, Las Condes, Regi\u00f3n Metropolitana, Chile"}, {"street": "Santo Domingo 445, Puente Alto, Regi\u00f3n Metropolitana, Chile"}, {"street": "Avenida Apoquindo 6415, Las Condes, Regi\u00f3n Metropolitana, Chile"}, {"street": "Puerto Santiago 153, Pudahuel, Regi\u00f3n Metropolitana, Chile"}, {"street": "Mariano Sanchez Fontecila 9150, La Florida, Regi\u00f3n Metropolitana, Chile"}, {"street": "Avenida 5 de Abril 5817, Estacion Central, Regi\u00f3n Metropolitana, Chile"}, {"street": "Chacabuco 79, Maipu, Regi\u00f3n Metropolitana, Chile"}, {"street": "Santa Josefina 12502, San Bernardo, Regi\u00f3n Metropolitana, Chile"}, {"street": "Siglo XV 10623, La Pintana, Regi\u00f3n Metropolitana, Chile"}, {"street": "Carmen Mena 545, San Miguel, Regi\u00f3n Metropolitana, Chile"}, {"street": "Los Pinos 761, Cerrillos, Regi\u00f3n Metropolitana, Chile"}, {"street": "Pasaje 5 Norte 0595, La Granja, Regi\u00f3n Metropolitana, Chile"}, {"street": "Divino Maestro 7282, Cerrillos, Regi\u00f3n Metropolitana, Chile"}, {"street": "Lo Gallo 1893, Vitacura, Regi\u00f3n Metropolitana, Chile"}, {"street": "General Del Canto 230, Providencia, Regi\u00f3n Metropolitana, Chile"}, {"street": "\u00d1uble 350, Santiago, Regi\u00f3n Metropolitana, Chile"}, {"street": "Avenida Providencia 2315, Providencia, Regi\u00f3n Metropolitana, Chile"}, {"street": "Constantino 590, Quinta Normal, Regi\u00f3n Metropolitana, Chile"}, {"street": "Avenida San Francisco 9075, Cerro Navia, Regi\u00f3n Metropolitana, Chile"}, {"street": "Avenida Providencia 395, Providencia, Regi\u00f3n Metropolitana, Chile"}, {"street": "Joaquin Diaz Garces 8833, La Cisterna, Regi\u00f3n Metropolitana, Chile"}, {"street": "San Pedro 312, La Florida, Regi\u00f3n Metropolitana, Chile"}, {"street": "San Antonio 418, Santiago, Regi\u00f3n Metropolitana, Chile"}, {"street": "Pasaje Ignacio Zuazagoitia 3189, Santiago, Regi\u00f3n Metropolitana, Chile"}, {"street": "Avenida Ossa 1771, San Ramon, Regi\u00f3n Metropolitana, Chile"}, {"street": "Libertador Bernardo OHiggins 3287, Santiago, Regi\u00f3n Metropolitana, Chile"}, {"street": "Augusto Biaut 0726, La Cisterna, Regi\u00f3n Metropolitana, Chile"}, {"street": "Zurich Norte 087, La Cisterna, Regi\u00f3n Metropolitana, Chile"}, {"street": "Rosas 1869, Santiago, Regi\u00f3n Metropolitana, Chile"}, {"street": "Doctor Amador Neghme Ro 03639, La Pintana, Regi\u00f3n Metropolitana, Chile"}, {"street": "Avenida Manuel Antonio Matta 1222, Santiago, Regi\u00f3n Metropolitana, Chile"}, {"street": "3, Quinta Normal, Regi\u00f3n Metropolitana, Chile"}, {"street": "Pasaje Doctor Sotero del Rio 508, Santiago, Regi\u00f3n Metropolitana, Chile"}, {"street": "Toesca 2698, Santiago, Regi\u00f3n Metropolitana, Chile"}, {"street": "Avenida Apoquindo 6415, Las Condes, Regi\u00f3n Metropolitana, Chile"}, {"street": "Aeropuerto 9970, Cerrillos, Regi\u00f3n Metropolitana, Chile"}, {"street": "Avenida Padre Hurtado 13376, El Bosque, Regi\u00f3n Metropolitana, Chile"}, {"street": "Cam del Marques 2281, Lo Barnechea, Regi\u00f3n Metropolitana, Chile"}, {"street": "Avenida Alcalde Carlos Valdovinos 2898, Pedro Aguirre Cerda, Regi\u00f3n Metropolitana, Chile"}], "options": {"thumbMaps": "false", "maxResults": "1"}}      I don't think is a problem with my connection because the headers answered would be the same. is there something missing in my request?


I don't find the mistake in my RandomForest-classification

I am trying to make a RF-classification of aerial-imagery to specify tree- species. I extracted 3 bands and made a .csv file with columns:               band1  band2  band3  x  y  class      The `band` columns include the pixel-value of the point which I marked in ArcGIS and copied to the attribute-table. `x/y` include the coordinates of the points. `class` includes the class, such as forest, juniper... The RF reads the .csv and classifies the bands it sees in the rasterstack. The classifier gives back an image with the classes. So I mark my code and run it: A classifier-window shows up, and freezes. 5 Seconds later the console shows an error:                Error in eval(expr, envir, enclos) : object 'band1' not found      * * * The problem is unclear. The code is right, but the compiler reacts as if there was a typo when I run the code. But as far as I can see, there is no typo. `band1`, like `band2` and `band3` are in the pointdata_sw_aug1.csv. It is the 1st column and has no space before or after it (" band1"). Therefore I uploaded the images. Since my rasters are in tif-format, I recently changed the code because at first is was written by Aaron for img-files:               rlist=list.files(getwd(), pattern="img$", full.names=TRUE)       to               rlist=list.files(getwd(), pattern="tif$", full.names=TRUE)      The RandomForest-Package then opens a little "predict" window where it says that 31 steps are left. It takes 5 seconds till it stops with an error- message: > Error in eval(expr, envir, enclos) : object 'band1' not found It doesn't go on. * * * This should work, but gives me an error:               require(sp)     require(rgdal)     require(raster)     require(randomForest)      **# Set the working directory**               setwd("D:/BA-Workspace/DOP_10/orthophotos_abcd/R/test_run_R")      **# Create list of rasters**               rlist=list.files(getwd(), pattern="tif$", full.names=TRUE)       **# Create raster-stack**               rasters = stack(rlist)      **# Read Raster Training-Table *.csv**               intable = read.csv("D:/BA-Workspace/DOP_10/orthophotos_abcd/R/test_run_R/pointdata_sw_aug1.csv")      **# Assign Training-points from Columns**               myrf = randomForest(factor(class) ~ band1 + band2 + band3 , data = intable, ntree = 2500)      **# Run RandomForest classifier**               predict(rasters, myrf, filename="outFileName.img", type="response",         index=1, na.rm=TRUE, progress="window", overwrite=TRUE)       my .csv: ![enter image description here](http://i.stack.imgur.com/LMtMK.jpg) ![enter image description here](http://i.stack.imgur.com/uzD1v.jpg) As far as I can see there are no mistakes. Whats wrong here? Error-message is this (copied from console):               require(sp)     require(rgdal)     require(raster)     require(randomForest)                >setwd("D:/BA-Workspace/DOP_10/orthophotos_abcd/R/test_run_R")               > rlist=list.files(getwd(), pattern="tif$", full.names=TRUE)      >           > rasters = stack(rlist)     >      > intable = read.csv("D:/BA-Workspace/DOP_10/orthophotos_abcd/R/pointdata_sw_aug1.csv")     >      > myrf = randomForest(factor(class) ~ band1 + band2 + band3 , data = intable, ntree =     2500)     >      > predict(rasters, myrf, filename="outFileName.img", type="response",     +         index=1, na.rm=TRUE, progress="window", overwrite=TRUE)     **Error in eval(expr, envir, enclos) : object 'band1' not found**


cut square from geotiff

i want to make a 3d modell out of the mount everest and some other mountains. what i need therefore is a 14km² square around the peak from the mountain. so basically i use qgis to extract the area from the dowlnoaded SRTM geoTIFF (which i downloaded here http://srtm.csi.cgiar.org/SELECTION/inputCoord.asp). qgis only needs the left upper and the right bottom corner of the areal, which i calculate with this site http://www.gpsvisualizer.com/calculators. So far, so good... now qgis cuts a rectangle!! but if i use microDEM to convert to a greyscale BMP i get a square shaped picture again!?! the dem information of the bmp are the following: Size: 13.92x13.95 km-------------> square (but not 14km²) DEM size: 171x152----------------> no square Screen Pixels: 517 x 518----------> almost square Screen pixel size: 26.94 m z range: 5040 to 8806 m does anyone know what the heck is going on? i am really baffled and really dont know how to deal with this situation...


Rasterizing Contours - How to remove 0 values

I want to convert vector contours to a DEM. From other posts, I wanted to utilise the Grass r.surf.contours tool. Initially I converted the vector contour layer to a rasterized contours using the "rasterize (vector to raster)" tool. The contours rasterized well but there was 0 values between them. I have tried the Grass plugin but it isnt giving me good results. I suspect it is because of the 0 values. I would appreciate guidance on how to strip these out.


Convert WKT (or geojson) geometry to numpy array of coordinates

I am looking for the fastest way to convert WKT or geojson geometry from string to numpy array of coordinates. Is it possible to do it strictly in Python and without creating geometry object such Shapely shape, OGRGeometry or GEOSGeometry?


QGIS plugin 'sextante' not loading after upgrading to Mac OS X 10.8

Any known issue with sexante and Mac OS X 10.8? After updating from 10.7 and even after reinstalling GDAL sexante is still not working...


How to display nebulous boundaries between regions with indistinct edges?

I'm trying to map the boundaries between regions which don't necessarily have a hard edge. For example, areas where languages predominate don't have a distinct edge, but instead have a degree of overlap - people don't suddenly stop speaking a language at a country border. How would you convey this in a map? Here is an example I found showing tourist regions - I like how they've conveyed that you don't suddenly reach the boundary of a region, but that they are more nominal: ![enter image description here](http://i.stack.imgur.com/XIfra.png) (I suspect that they used something like Adobe Illustrator to create this?) **How can I achieve a similar effect in ArcMap?** For bonus points, I'd like a solution which will transfer to ArcGIS Server's JS API. My starting point is a polygon layer which does contain hard edges - something like this: ![enter image description here](http://i.stack.imgur.com/DzDvk.png)


Convert SpatialGridDataFrame in to polygon shapefile in R

I have a SpatialGridDataFrame in R and want to plot just one of its attributes as as polygons in a GIS. There seems to be no simple way to do this. The situation is complicated by the fact that the variable I want to export is not numeric so I can't just convert it to a raster and export it. It seems like I have to have the grid file converted to polygons in R and then export the polygons into a GIS format. I've tried Grid2Polygons package but I don't seem to be able to carry across the attributes. Any suggestions appreciated.


How does Quantum Gis work with Arcgis .xml files?

I'm not familiar to quantum gis, so can anyone explain if it is possible to import/export xml files in quantum gis? If it is possible, how can I do that? I exported some . xml recordset and workspace files from ArcGis and I'm curios if I can open those files in quantum gis. Thank you I use Arcgis 10.1 and Quantum GIS 1.8.0


Creating a spatial PostGIS table as a result of a PostGIS query

When I want to store the results of a spatial query as another PostGIS table, what should I do? I am interested in identifying all residential buildings that fall within a set of parcels:               CREATE TABLE residentialBuildings AS     SELECT buildings.the_geom     FROM parcels as p     JOIN buildings as b     ON ST_Contains(p.the_geom, b.the_geom)     WHERE p.residentialarea > 0;      This seems to work, but it does not return a spatial result - instead the table has the binary representation of the geometry. I'm not sure what I should be doing to create a table as a result. Do I need to first make a table, and then convert the result into a geometry? (I have read the documentation, but I feel like I'm missing the right search terms as I feel this must be a fairly obvious thing to do). I realize that there are many commands to make a geometry               ST_GeogFromText      ST_GeographyFromText      ST_GeogFromWKB      ST_GeomCollFromText      ST_GeomFromEWKB      ST_GeomFromEWKT      ST_GeometryFromText      ST_GeomFromGML      ST_GeomFromKML      ST_GMLToSQL      ST_GeomFromText      ST_GeomFromWKB       but I don't know which option to choose from, or if this is the correct approach.


Finding the common borders between polygons in the same shapefile

The question is essentially the same as here, except that I want to do it in qgis. Thus, is there a qgis function equivalent to the ArcMap _intersect_ function that will take a polygon layer and output the line segments corresponding to the intersections (common boundaries) of two polygons. (I realize that since polygons are independent objects in shapefiles, satisfying the intent of the query is more challenging than in a topolically modeled division of the surface.)


How do you programmatically determine if a layer supports the query capability via the ArcGIS Server 9.3.1 REST API?

I am using ArcGIS Server 9.3.1 SP 1. I want to be able to determine the capabilities of each published layer, specifically I am looking for all layers with query capabilities. Being familiar with ArcGIS Server 10 I thought I could programmatically inspect the capabilities list on the layer response page. For example, Average US Household Size has MAP, QUERY, and DATA capabilities. However it appears that ArcGIS Server 9.3.1 does not publish layer capabilities through the REST API. I think that I could get this information by scraping the HTML for the layer resource and looking for the list of supported operations in the HTML.               Query      But this seems like brittle code. How would you programmatically determine if a layer supports the query capability via the ArcGIS Server 9.3.1 REST API?


How to clip a vector feature to the extent of an existing raster dataset using arcpy

I have a clipped raster dataset with polylines (from the contour tool) overlayed (see attached). I am trying to clip the polylines to the extent of the raster dataset, which seems simple enough, but I've tried multiple things and can't seem to get it to work. I will eventually need to code this using arcpy but I think for now, just a nudge in the right direction as to which tool will accomplish this will help me for now. Thanks. P.S. I am using ArcInfo 10.0 ![clipPolylinesToRasterExtent](http://i.stack.imgur.com/rBfWw.png)


How to switch to a GDB created in the middle of a script

EDIT: Here's my full script and hopefully a better way of explaining what I need done:               #Import          import arcpy, sys, os          # Set environment settings          arcpy.env.workspace = sys.argv[1]       inFiles = sys.argv[2]       outWorkspace = sys.argv[3]       projectGDB = sys.argv[4]+".gdb"       coordinate = sys.argv[5]       clipBoundary = sys.argv[6]       scratchGDB = sys.argv[7]+".gdb"            # CREATE A GEODATABASE          arcpy.CreateFileGDB_management(outWorkspace, projectGDB) # Here I create the database     # for the projected files to go into       arcpy.CreateFileGDB_management(outWorkspace, scratchGDB)            # CHANGE THE PROJECTION          arcpy.BatchProject_management(inFiles, outWorkspace+"\\"+gdbName, coordinate)          # CLIP FEATURES TO STUDY AREA BUFFER          fcs = arcpy.ListFeatureClasses() # Here I need it to somehow read from the GDB with      # my projected files in it that was created above..however it reads from the workspace      # and because the workspace is set before running the script I can not choose the GDB      # because it is not created yet          for fc in fcs:           arcpy.Clip_analysis(fc, clipBoundary, outWorkspace+"\\"+scratchGDB+"\\"+fc+"__clipped")      I am wondering if there is a way to change the workspace as you move through the python script without having to do something like wrap tkinter around it. For example:   I have set up my inital workspace through the parameters (sys.argv) so that I can create a gdb to store my files - this is a general "Project" folder as my workspace   Next I have a batch project in which the files that the user wants to be projected are chosen, the output of these projected files is to the geodatabse that was created NEXT (and here's where my issue comes in) I need to clip my projected features to a boundary of the study area, so I have a batch clip written out:               fcs = arcpy.ListFeatureClasses()     for fc in fcs:          arcpy.Clip_analysis(fc, clipBoundary, outWorkspace+"\\"+gdbName+"\\"+fc+"__clipped")      However to select the fc from fcs I need it to be looking into the projected files GDB to read all the feature classes...however if I just run the script from the beginning to this point the workspace is still sitting in my main project folder and therefore there are no feature classes that will be read into the script........


OpenLayers Selectfeature get mouse position

I'm have been searching for several hours and do not find a way to get mouse coordinates after a SelectFeature, which returns the feature by itself. I saw that this has been asked several times earlier, so I try again ! Thanks very much, Olivier


Free AutoCAD blocks

I'm looking to tap into the AutoCAD knowledge base on this site. I conducted a quick Goolgle search for free AutoCAD blocks, and it returned 762,000 hits. Certainly, I can find several viable options, but I'm hoping some CAD users can post some " **good** " sites for me to visit, instead of having to waste valuable time researching numerous sites. Just because a link is at the top of a Google search does not make it a good site, it might just mean it's well coded. Someone who knows what they're doing can put almost anything near the top of Google searches. I'm hoping for a few "all-in-one" suggestions. I'm looking for some variety (ie - different types of trees, fire hydrants, doorways, closet doors, industrial symbols/signage, etc, etc, etc). Basically, I am for looking many different genres of block types - greyscale & colour, recreational/cartoon style blocks (ie - mens/ladies washrooms, snowmobile trails, etc), industrial and professional design style blocks, and so on. Lastly, I would really like to have the capacity to preview and select individual blocks as opposed to having to download entire packages or bundles. Any suggestions are greatly appreciated.


How can I export ArcScene animation to .mov quicktime file?

ArcGIS 10 documentation says that **an animation can be exported to either .avi or .mov (quicktime)**. I only see the .avi option in my drop-down list? What am I missing. ![enter image description here](http://i.stack.imgur.com/0drQA.jpg) **EDIT: Quicktime is installed on my computer**


Reconcile and post versions through C#?

I want to know if we can post the versions based on events through coding. How we do batch reconcile and post through c# code? Is it possible for automatic replication also?


TIFF, Grid, FGDB Grid, etc. - what performs better in ArcScene animation?

I am creating a flyover animation in ArcScene and I would like my surface raster to be rendered in full resolution (an exported function raster dataset - a blend of shaded relief and high resolution imagery) I've tried to export several clips with the function raster dataset itself but the uncompressed AVI output was quite jerky. I then converted the function raster dataset into TIFF and the output video did not improve. Will Converting to FGDB Grid or any other grid make a difference in the final animation rendering. It plays smoothly in ArcScene itself; it's only the exported uncompressed video that seems to be quite jerky. Any other recommendations? EDIT: What I meant by the above statement "I would like my surface raster to be rendered in full resolution" was not a question but a statement; this raster is set and must remain set to preserve detail to HIGH (Quality Enhancement for Raster Images: HIGH) After reading the first question (thanks @GIS-Jonathan) I realized that I might want to include my machine specs:   * Intel Core i7-980X Extreme Edition 3.33Ghz CPU   * OCZ DDR3 PC3-6GB RAM (12GB total)   * Asus P6X58D Premium Motherboard   * WD VelociRaptor 450 GB, SATA 6 Gb/s, 32 MB Cache, 10,000 RPM Hard Drive   * NVIDIA Quadro 4000 w/2.0GB, Dual Link DVI Video Card   * Windows 7 Professional 64bit


Calculating a Unique ID on a Subgroup of Polygons

I would like to assign a unique ID to polygons in a dataset. The catch to my issue is that I would like polygons that fall within a polygon to have the same unique ID. My example is related to buildings. I have many buildings in a dataset. Each building should have a unique ID, however, buildings that are comprised of multiple polygons (see graphic) should have the same unique ID. I know of a way to do this through a series of dissolves, and spatial joins, but I would like to do this in a calculation. My preference is to do this in ArcMap, but QGIS would also be acceptable. Any thoughts or help would be appreciated. Thanks... ![enter image description here](http://i.stack.imgur.com/nIMB1.jpg) EDIT: Here is a graphic of what I am hoping to resolve. All touching polygons have the same ID. This is unique in the entire dataset, not with the building that is shown. ![enter image description here](http://i.stack.imgur.com/tCICl.png)


Define projection at the record level

Hopefully this isn't too dumb a question, but is it possible to define projection at the record level, instead of a whole layer or table? I want to create a "project" database for all the work my company has done, and currently have a table of lat longs. It'd be nice to somehow create a dataset of actual site boundaries (usually in UTM NAD83 projection, various zones), without having to convert everything over to lat long. Ideas?


Where to get school zone shapefiles?

Census.gov usually makes available the shapefiles containing school zone boundaries. Due to the US government shutdown, census.gov is down. Does anyone know where to download a recently archived copy?


How to open a "Raster Dataset" in QGIS

I want to open a "Raster Dataset" in QGIS. In ArcMAP I can just add it like shown in the Screenshot (only the raster shows up). ![Screenshot 1](http://i.stack.imgur.com/8vV4V.jpg) If I am trying to do this in QGIS. However there I don't see the raster files itself. I find three files (`.ovr`, `.aux`, and `.ovr.aux.xml`) and a folder (with `.adf` files inside it). How can I open the raster? ![enter image description here](http://i.stack.imgur.com/TPrLJ.png) A similar question was already asked here and here, but never really answered.


How to create a KML that supports animated ground overlays?

I have 12 images that represent weather conditions at day 1 through day 12. I am using gdal2tiles to produce map tiles from each of these images. gdal2tiles also produces a KML file that can be used in Google Earth to display the tiles. However, I want to create an animated layer out of all 12 images. Google Earth seems to support animation in KML files (see https://developers.google.com/kml/documentation/time#example2). Are there any tools to create an animated ground overlay KML file such as this? Is gdal2tiles capable of it? Thanks a lot. - Mike


How to have a layer with many images that scale?

I know that in `OpenLayers` you can add Features to a Vector Layer which each have image but then they will not scale (i.e. their size stays the same independent of the current zoom) or at least I do not know how to make them scale. For example:                           var vectorLayer = new OpenLayers.Layer.Vector("Overlay");                 var feature = new OpenLayers.Feature.Vector(                 new OpenLayers.Geometry.Point(0,0)                 .transform(projWGS84, map.getProjectionObject()),                  {some:'data'},                 {externalGraphic: 'http://www.gatesms.eu/img/loga/java.png', graphicHeight: 30,graphicWidth: 30});                 var feature2 = new OpenLayers.Feature.Vector(                 new OpenLayers.Geometry.Point(1,1)                 .transform(projWGS84, map.getProjectionObject()),                  {some:'data'},                 {externalGraphic: 'http://blog.tiger.com.pl/wp-content/uploads/2012/02/Duke256.png', graphicHeight: 30,graphicWidth: 30});                 vectorLayer.addFeatures([feature,feature2]);                 map.addLayer(vectorLayer);      On the other hand the scaling of image works fine if you set an image for an Image Layer but then you can have only a single image in a layer.                           var options = {                        opacity: 1.0,                      isBaseLayer: false,                     numZoomLevels: 20,                     transparent: 'true'                 };                 var extent = new OpenLayers.Bounds(WEST,SOUTH,EAST,NORTH)                     .transform(projWGS84, map.getProjectionObject());                                     var gO = new OpenLayers.Layer.Image('Image',                     'http://www.gatesms.eu/img/loga/java.png',                     extent,                     new OpenLayers.Size(1,1),                     options);                   map.addLayer(gO);      My question is: **How to have, in`OpenLayers`, many images on a single layer that will scale as in the above case?**


Importing data with empty cells without GIS replacing the empty cell with 0

I am importing data from excel into ArcGIS 10. The data are columns of GPS data, associated date and time, and a unique point identifier. For some of the rows the GPS data is missing and so the Lat and Long columns are empty but the other columns retain dates and times etc. When I import this data into ArcGIS 10 a 0 is placed in these cells and so Arc plots the points as 0,0. Previously I have just removed the empty rows from the imported data table to get around this problem. However, I now need to import the full data table including the empty rows. How can I do this without Arc entering the empty cells as 0?


ArcObjects - Select record from table

I´ve a project in VBA but I hit a wall that I can't pass. What I want to do: I´ve a table (of parcels) with the fields: ID, Name, Area, Scale. For each Parcel there is a different scale! I input, in a text box, the name of a parcel. I want to "get" the corresponding scale. Does anybody know how I can do that?


ArcGIS (9.3) toolbars are missing. Where did they go?

I was going to georeference some images this morning. Turned on my "Georeferencing" toolbar and it was nowhere to be found. At first I thought I hadn't had enough coffee and it really was right in front of me. But it wasn't. I've looked underneath other toolbars. I've changed the screen resolution to make sure that I didn't have it moved out off screen. I restarted my machine. I tried resetting the toolbar (custom-->toolbars-->reset). I deleted my normal.mxt, I created new mxds, I tried other mxd's. I deleted my whole ESRI user profile. I also have found that no toolbars, other than the defaults, show up when I click on them. I've had other people look over my shoulder just to make sure I haven't gone crazy, that they really don't show up. Has anyone else experienced this? What the heck is going on?


Remove "lost" Popup

sometimes Popup bubbles dont disappear or cannot be closed with the x button in the corner, because something went wrong either with the code or the handling of the script or probably both. Is there any way of referencing to those "lost" popups or a method how i can get my hands on those folks and make them dissappear ?? Thanks.


Different behavior of ArcObjects for different languages

I have the same code in C++ and C# for ArcMap. This code loads a document from disk and trying to get a picture for `PictureSimbol` object. But in case of C++ error occurs(`HRESULT = E_UNEXPECTED` 0x8000ffff). C# code works without any problem. Why such a difference may occur? (`mxd_file_name` the same in both cases) C++ code               esriCarto::IMapDocumentPtr map_doc(esriCarto::CLSID_MapDocument);     map_doc->Open(mxd_file_name, L"");     esriCarto::IMapPtr mp = map_doc->Map[0];     esriCarto::IFeatureLayerPtr layer = mp->Layer[0];     esriCarto::ILegendInfoPtr inf = layer;     esriCarto::ILegendGroupPtr gr = inf->GetLegendGroup(0);     esriCarto::ILegendClassPtr cl = gr->Class[0];     esriDisplay::ISymbolPtr s = cl->Symbol;     esriDisplay::IMultiLayerFillSymbolPtr mls = s;     esriDisplay::IFillSymbolPtr fs = mls->Layer[0];     esriDisplay::IPictureFillSymbolPtr pfs = fs;          IPictureDisp * pic = 0;     HRESULT hr = pfs->get_Picture(&pic); // hr = E_UNEXPECTED 0x8000ffff catastrophic failure     map_doc->Close();      C#               ESRI.ArcGIS.Carto.IMapDocument map_doc = new ESRI.ArcGIS.Carto.MapDocument();     map_doc.Open(mxd_file_name);     ESRI.ArcGIS.Carto.IMap mp = map_doc.Map[0];     ESRI.ArcGIS.Carto.IFeatureLayer layer = mp.Layer[0] as ESRI.ArcGIS.Carto.IFeatureLayer;     ESRI.ArcGIS.Carto.ILegendInfo inf = layer as ESRI.ArcGIS.Carto.ILegendInfo;     ESRI.ArcGIS.Carto.ILegendGroup gr = inf.LegendGroup[0];     ESRI.ArcGIS.Carto.ILegendClass cl = gr.Class[0];     ESRI.ArcGIS.Display.ISymbol s = cl.Symbol;     ESRI.ArcGIS.Display.IMultiLayerFillSymbol mls = s as ESRI.ArcGIS.Display.IMultiLayerFillSymbol;     ESRI.ArcGIS.Display.IFillSymbol fs = mls.Layer[0];     ESRI.ArcGIS.Display.IPictureFillSymbol pfs = fs as ESRI.ArcGIS.Display.IPictureFillSymbol;     stdole.IPictureDisp pic = pfs.Picture; // works fine     map_doc.Close();      * * * **Update:** There is no problem with `IPictureDisp * pic = 0;` Actually I just paste code for `IPictureDispPtr pic = pfs->GetPicture()` because I do not want an exception instead of error `HRESULT`. Bellow is an autogenerated code for `GetPicture` function               inline IPictureDisp * IPictureFillSymbol::GetPicture ( ) {         IPictureDisp * _result = 0;         HRESULT _hr = get_Picture(&_result);         if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));         return _result;     }      C++ code works, if the map is not taken from hard drive but obtained from the same document that loaded in ArcMap. Here's the code:               esriArcMapUI::IMxDocumentPtr document(application_->Document); // application_ is the ArcMap application     esriCarto::IMapPtr mp = document->Maps->Item[0];     // the rest code is unchanged     esriCarto::IFeatureLayerPtr layer = mp->Layer[0];     esriCarto::ILegendInfoPtr inf = layer;     esriCarto::ILegendGroupPtr gr = inf->GetLegendGroup(0);     esriCarto::ILegendClassPtr cl = gr->Class[0];     esriDisplay::ISymbolPtr s = cl->Symbol;     esriDisplay::IMultiLayerFillSymbolPtr mls = s;     esriDisplay::IFillSymbolPtr fs = mls->Layer[0];     esriDisplay::IPictureFillSymbolPtr pfs = fs;          IPictureDisp * pic = 0;     HRESULT hr = pfs->get_Picture(&pic); // same code works fine     map_doc->Close();


copy/paste style to multiple layers in qgis 2.2

I have many shapefiles in QGIS. How can I paste the style of one layer to **all** the other ones? So a "batch" copy and paste solution. If I make a multiple selection the the paste style option is not available anymore. Thank you!


Capture MouseLeftButtonUp on cluster?

I'm working on an esri silverlight project, where I have a HUGE amount of points (100k +) I'm plotting these points on a graphics layer, where I have a MouseLeftButtonUp event assigned. On the individual points, when zoomed in, it works beauitfully, but when clicking on the cluster icon, it does not fire the graphics layer's MouseLeftButtonUp event. How do i capture this event on the cluster Icon? Thanks!


Where is mapserver's document root?

I am trying to work through the mapserver tutorialhttp://mapserver.org/tutorial/index.html . I am working on a Mac (with 10.9) and I have installed mapserver from http://www.kyngchaos.com/software/mapserver. I have apache running and I have copied the tutorial document into apache's document root ("/Library/WebServer/Documents"). All the files are world readable so apache should be able to read them. I have also verified the permissions in httpd.conf. When I try and access the first tutorial at `http://localhost/cgi- bin/mapserv?map=/ms4w/apps/tutorial/htdocs/example1-1.map&layer=states&mode=map` I get `msLoadMap(): Unable to access file. (/ms4w/apps/tutorial/htdocs/example1-1.map)`. Is there a separate mapserver config file that I have missed? And where is mapserver looking for the files?


Display coordinate references in Geotools

I'm using this library to finish my final project and i have to say I'm no familiar with the maps worlds. My question is if geotools has a method to show automatically the coordinates references in the map, and how use it? That would be really helpful because I spend a lot of time trying to find it without success. One example of what Iam looking for are the blue lines in the next map: http://www.lexas.net/worldfactbook/resources/reference_maps/jpg/southeast_asia.jpg Thanks, and sorry for my english!


Transform Data with Microsoft Spatial SQL

Is there a way to transform geographic data in SQL Server 2008 R2? Specifically, I want to take Lat/Long data and convert it to a State Plane coordinate system.


Error trying to create mssql layer in geoserver

with mssql 2008 and the latest geoserver with the mssql store plugin, I can create a dbo connection with a mssql database and list the tables. When I try to create a layer with one of the tables which has a "GEOM" field in the format POINT (3550951.71343219 5889701.66379654) I always get the same error when saving the layer... Caused by: java.io.IOException: Error occured calculating bounds for PUZZLE_LAYERVIEW_2 at org.geotools.jdbc.JDBCDataStore.getBounds(JDBCDataStore.java:1258) What is the problem with the bounds? I have entered the correct EPSG code = EPSG:31467. Is the problem really with the bounds or with mssql geometries? An sql query layer works ok in ArcGIS.


Executing tool comes back with an error arcpy.JoinField_management

I have this script snippet, written by Aaron.               import arcpy     import os          #set workspace     arcpy.env.workspace = "C:\\Users\\Documents\\Wetland\\New_Folder" #in the folder "New_Folder" is a geodatabase which contains all the shapefiles     ws = arcpy.env.workspace          #create a list of features     fcl = arcpy.ListFeatureClasses()          #loop through the list     for fc in fcl:         basename = fcl.split("_")[0] #split name of features and only take the first word as a basename                   in_data = os.path.join(ws, basename + "_clip_diss.shp") #The table or feature class to which the join table will be joined.         in_field = "WLType" #The field in the input table on which the join will be based.         join_table = os.path.join(ws, basename + "_clip_full.shp") #The table to be joined to the input table.         join_field = "WLType" #The field in the join table that contains the values on which the join will be based.         fieldList = ["area_ha"]               arcpy.JoinField_management(in_data , in_field , join_table , join_field, fieldList)      #JoinField_management (in_data, in_field, join_table, join_field, {fields})          It does not come back with an error message, but it does not do the join neither. It runs but there is no result. No join.


Filter by quantity / query in ArcGIS

I have some data stored in a CSV file containing name and date ranges. For example:               ID | Name | Start | End   |  X  |  Y     -------------------------------     1  | Test | 2014  | 2015` | ... | ... |     2  | Test | 2014  | 2016` | ... | ... |     3  | Test | 2020  | 2025` | ... | ... |      I join this data based on the ID column with shape files and thus get the information coupled with the shape data. I can assign different colours and write definition queries to make the data stand out and filter the date range but I would like to split the data over multiple layers in order to show shape data for year 2014,2015,... etc. in ArcReader. I have a programming background but no prior experience of using ArcGIS so I'd much appreciate advice on how to do this or a point me in the right direction.


Does somebody has a Python script for a Multiple Flow Algorithm?

I´m looking for for a python script for a multiple flow algorithm assigning flow to all lower cells from one central cell. This algorithm is part of the r.terraflow and would need it to start at a given input point and flood a certain area also given as a input parameter. Does somebody has implemented such a tool with a python script?


How can I get a list of tables in my CartoDB account by size?

The CartoDB dashboard only sorts tables by date modified or created. I would like a list of tables sorted by size.


FeatureClassToFeatureClass_conversion in ArcGis 10.1

I have many > 60 .dwg files I want to convert just the polyline parts of these and have put together a list of python commands using excel to get something like this: ![image](http://i.stack.imgur.com/3gpmd.png) However when I try running this in the python window or from a saved script I keep getting input features and output location do not exist. What am I doing wrong?


Is it acceptable to store OSGB36 data as geometry in SQL Server?

I've set myself a project of getting some geo data into SQL Server but before I get started doing any of the big jobs I wanted to see if I was on the right track. All of my data is for the UK and is therefore based on Easting & Northing coordinates (OSGB36), not Latitude & Longitude (WGS84). My understanding is that I cannot create a geography field based on Eastings & Northings in SQL Server without first re-projecting in a GIS package (I have QGIS). I can however convert Easting & Northings based data into a geometry field with no problems. I have managed to re-project some point data to WGS84 in QGIS and create a geography field from this, however when I use the QGIS MSSQL link to bring the resulting point data into QGIS, it really doesn't seem to be able to marry it with layers in OSGB36 (despite having on-the-fly re-projection activated). So my question is: Following the path of least resistance (and maximising compatibility with other UK datasets), is it acceptable to store OSGB36 data as geometry in SQL Server, despite actually being geography?


What is the relationship between SDSFIE and C/JMTK?

C/JMTK = Commercial Joint Mapping Toolkit = http://www.cjmtk.com/ SDSFIE = Spatial Data Standard for Facilities, Infrastructure & Environment = http://www.sdsfie.org I've been working on a project using the C/JMTK, so I'm pretty familiar with it. It is basically a repacked version of ESRI's ArcGIS and ArcObjects technologies. Recently I was asked if our databases meet the SDSFIE standard, or could we work with SDSFIE-standard databases. My question is what is the relationship between SDSFIE and C/JMTK? It seems to me after some preliminary reading that SDSFIE is a description of how the database schema is developed. Is that correct? Is it just schema or are there other requirements that restrict the underlying technology choices (e.g. geodatabase format or sql database vendor). Can the C/JMTK (e.g. ESRI ArcGIS & ArcObjects technologies) support the SDSFIE standard? Thanks! P.S. Tried to tag this with C/JMTK and SDSFIE but I don't have enough reputation points.


AddLayer method does not add all bands of .tif image (3 bands total)

I am currently having trouble getting 3-band raster's to display correctly when I call the arcpy.mapping.AddLayer() method. It should be said that I am using a pre-existing mxd template to automate the mapping process and output jpg's as the final product. here is a snippet to demonstrate how I am adding the layers;                   import arcpy              mxd = arcpy.mapping.MapDocument("path_to_mxd")              data_frames = arcpy.mapping.ListDataFrames(mxd)              df = data_frames[0]              layer = arcpy.mapping.Layer("path_to_layer")              arcpy.mapping.AddLayer(df, layer, "TOP")      this code adds the layer object but it does not include all bands of the image so what I am left with looks like a negative copy of the original image. I have tried to work around this by including a layer with correct symbology and then using the ApplySymbologyFromLayer_management() method but it does not work and when tried with the python command line in ArcMap, the image(s) display a lock in the bottom right corner of their description in the table of contents. I only want the images to display with RGB composite symbology. Any help would be greatly appreciated and I will check often if more info is needed. Also I did read the post titled: "Is there a way to programatically force RGB (3 bands)" etc... the rasters I am adding already contain 3 bands and arcpy is only adding one in a stretched format so please consider this when answering, Thanks


URL for my Protocol.HTTP never called by OpenLayers?

I have an OpenStreetMap (OSM) map with a vector layer fetching data from a Node.js server setup on my local machine on port 9000. The data is in GeoJSON format. Here is the whole code:                       var fromProjection = new OpenLayers.Projection("EPSG:4326");             var toProjection = new OpenLayers.Projection("EPSG:3857");                  var map = new OpenLayers.Map("map");                  var vectorFormat = new OpenLayers.Format.GeoJSON();             var vectorProtocol = new OpenLayers.Protocol.HTTP({                 url: "http://localhost:9000/getcoords",                 format: vectorFormat,                 params: {                     "city":"PARIS",                     "city_code":3                 }             });             var refresh = new OpenLayers.Strategy.Refresh({ force: true, active: true });             var vectorStrategies = [new OpenLayers.Strategy.Fixed(), refresh];                  var osm = new OpenLayers.Layer.OSM();                  var vectors = new OpenLayers.Layer.Vector({                 protocol: vectorProtocol,                 strategies: vectorStrategies,                 format: vectorFormat             });                  map.addLayers([osm, vectors]);             map.setCenter(new OpenLayers.LonLat(2.3983034, 47.078038).transform(fromProjection, toProjection), 6);      My problem is that my map is displayed, but the url defined in my protocol is never called. In firebug, I can't see any access to this url, so I can't see my vector layer. What am I doing wrong?


Adding some background information to a layer

I have 2 Python Qgis plugins. The first plugin is creating a QgsVectorLayer via the ogr dataprovider. The second plugin is offering some services on the features in the layer. I need to pass some additional information (a single string) which is not in the file that ogr reads to the second plugin. What's the best /easiest way to attach it to the layer so the second plugin can easily extract it?


Is it possible to edit geographic data over the web in QGIS cloud or QGIS server?

I'm looking for something similar to the ArcGis Server example but based on QGIS. Could anybody tell me where I can get more information about functionalities like this?


Short list of .prj options in .pyt

I'm tasked with creating a .pyt to distribute across our office and field computers (state geological survey) for converting .gpx to features but constraining the choice of projections/datums to seven (the point being that such functionality will be more efficient). The tool must be able to write locally to a specified gdb. I'm not sure what best practices would be: create a file in the specified .gdb with the .prj files and point to that or make the .prj variables global. Have not had success with portability either way (new to .pyt, I can fashion a script tool that works fine but is more trouble for the user than its worth). Insight or sample code appreciated! Or is there a better way?


area values determined with field calculator become null when saving

using field calculator in Qgis 1.8.0 to get the area, it shows just right at first but when I save it, the values become Null. help please


ERROR 000728: Field Code does not exist in ModelBulider using iteration

The first join in the model is working, but after this the names of the fields are changing in the name of the Shape and a number . Therefore get the ERROR 000728. ![enter image description here](http://i.stack.imgur.com/CdEYm.png) So I like to ask you if there is a way to work with this chanced field names by knowing which field need to be the join field. I like to make this question clearer with the following table. ![enter image description here](http://i.stack.imgur.com/dCBYK.png) So I know my Input field at the second join has to be the field “de021l_g_2”. I think the 2 is always there perhaps I can work with this, but how? What can I do to make clear which field is the join field in the model which has to get a scripttool? Do you have an idea? By the way is the “Feature Classes Iterator” the right one to loop through a folder with shapes? Is it generally possible to do this join with the Modelbulider? I really can not find a solution for the problem. It just couldn’t find the field from the input table but it is there and it is the same fieldtype than the join field. I think I need to write this model with python to get a scripttool out of it. Is this the way I have to go? Or are there opportunities with the ModelBulider? The first steps of the model, why is the raster attribute table empty??? ![enter image description here](http://i.stack.imgur.com/bBjUj.png) It is working with this code now:               import arcpy     import os     from arcpy import env          env.overwriteOutput = True     env.workspace = r"C:\Ju\Pr\urban_atlas_cities"     env.qualifiedFieldNames = False     #make a list with input cities as shapefiles.          fcList = arcpy.ListFeatureClasses()          for shpFile in fcList:         shpFileName= os.path.splitext (shpFile) [0]         print shpFileName # works         # Process: Make Feature Layer         arcpy.MakeFeatureLayer_management(env.workspace + "\\" + shpFile, "shpFile_ly")         # join the city with the reclasstable         jointable = r"C:\Ju\Pr\reclass.dbf"         arcpy.AddJoin_management("shpFile_ly", "CODE", jointable, "joinCODE", "KEEP_ALL")         # Process: Copy Features         outFeatureClass = shpFileName + "_join.shp"         arcpy.CopyFeatures_management("shpFile_ly", outFeatureClass)         # Process: Polygon to Raster         outraster = shpFileName + "_join.img"         cellSize = 200         arcpy.PolygonToRaster_conversion(outFeatureClass, "CODE", outraster, "CELL_CENTER", "NONE", cellSize)         # Process: Make Raster Layer         arcpy.MakeRasterLayer_management(outraster, "outraster_ly")#works         # Process: Add Join          arcpy.AddJoin_management("outraster_ly", "Value", jointable, "code", "KEEP_ALL")     # Process: Copy Raster         outraster2 = shpFileName + "_join2.img"         arcpy.CopyRaster_management("outraster_ly",outraster2) #works     # Process: Raster to Polygon         outPolygons = shpFileName + "reclass.shp"         arcpy.RasterToPolygon_conversion(outraster2, outPolygons, "NO_SIMPLIFY", "Value")#works


Is OpenLayers compatible with OGC WKT SRS definitions?

I'm trying to use WKT in OpenLayers. Proj4js seems to have no problem with this but the OGC definition describes the units as "US survey foot" whereas OpenLayers has an INCHES_PER_UNIT definition of "us-ft". Should this be addressed by registering "US survey foot":               OpenLayers.INCHES_PER_UNIT["US survey foot"] = OpenLayers.INCHES_PER_UNIT["us-ft"];      Or is there an openlayers/wkt incompatibility? This is the wkt in question. Normally I would use a WKID but this is a WKT test.


Printing a map with GPS points

This should be simple but I haven't figured it out. I have been able to download points from my gps unit and get the points to show up in the right location. But I don't know how to print the image. How do I do this? Can I put the image on a PDF to print it?


GeoPortal - "Not an XML response received from the host " when adding a resource using URL protocol

I have a local directory I want to connect to. It has been configured in IIS to list the contents. If I visit it in my browser, it displays the contents. When adding it as a resource, it passes the connection test fine. However I get a red text error saying "Not an XML response received from the host" when I use the URL protocol (Which is the correct one I take it?) I tried using the WAF protocol, it adds the folder as a resource, however it shows up as a single entry, and the metadata looks like it was generated on it's own. See screenshot: ![enter image description here](http://i.stack.imgur.com/qhNI5.png) The metadata it shows:               <rdf:RDF><rdf:Description rdf:about="http://localhost/MUNICIPAL/">     <dc:identifier>http://localhost/MUNICIPAL/</dc:identifier><dc:title>MUNICIPAL</dc:title>     <dct:references>http://localhost/MUNICIPAL/</dct:references></rdf:Description></rdf:RDF>      **My question:** How can I add a folder full of XML files to GeoPortal? I am approving it after I add it. EDIT: When I click preview, it shows this: ![enter image description here](http://i.stack.imgur.com/5meiy.png) **EDIT** : Checked the gpt.xml log file. Seen an interesting error with web harvester:               Sep 8, 2014 2:53:45 PM com.esri.gpt.framework.context.ApplicationConfigurationLoader loadHarvesterConfiguration     INFO: [SYNCHRONIZER] Missing "webharvester.autoSelectFrequency" parameter. Default 3,600,000 will be used instead.     Sep 8, 2014 2:53:45 PM com.esri.gpt.framework.context.ApplicationConfigurationLoader loadHarvesterConfiguration     INFO: [SYNCHRONIZER] Missing "webharvester.watchDogFrequency" parameter. Default 60,000 will be used instead.     Sep 8, 2014 2:53:45 PM com.esri.gpt.framework.context.ApplicationConfigurationLoader loadHarvesterConfiguration     INFO: [SYNCHRONIZER] Missing "webharvester.baseContextPath" parameter. Harvest notification messages will be sent without information about harvest report.     Sep 8, 2014 2:53:45 PM com.esri.gpt.framework.context.ApplicationConfigurationLoader loadHarvesterConfiguration     INFO: [SYNCHRONIZER] Missing "webharvester.resource.autoApprove" parameter. Default false will be used instead.


MapServer - Not Rendering All Features With Complex DATA statement

I have run into a little problem when using MapServer to render complex data statements. To keep this post short and simple, I think the output of shp2img is the best place to start. When I use shp2img with a simple DATA statement (ex: GEOMETRY FROM FOO_TABLE USING SRID 4326) AND the -all_debug 5 flag set - an msOracleSpatialLayerNextShape line is written to the console for every single row. When I use a more complex DATA statement (see below) - shp2img writes out about a dozen of the msOracleSpatialLayerNextShape line - **AND THEN** the last line is "Fetched 1234 more rows".... It does not loop through every row like above. When I run the sql that shp2img uses to retrieve the data - it is right on the money. Both shp2img and SQLDeveloper report the same # results. Is there some reason why shp2img doesn't loop all the results? Also, this only seems to be an issue with LINE geometry type. The same type of data statements work as expected with POINT. **Complex Data Statement:**               DATA "GEOMETRY FROM (SELECT CASE WHEN F.ch_v_avg_a_min IS NULL THEN 0 WHEN F.ch_v_avg_a_min > 242 THEN 1 WHEN F.ch_v_avg_a_min < 242 THEN 2 ELSE 0 END as THRESHOLDCLASS, N.SHAPE AS GEOMETRY FROM CHN_DIS_NODE_MONTH_FACT F INNER JOIN GIS_NETWORK_FEATURE N ON N.OBJECTGUID = F.NODE_FEATUREID WHERE N.NETWORKELEMENTID = 2 and F.MONTHID = TO_DATE('2014-05-01', 'YYYY-MM-DD') AND N.SHAPE IS NOT NULL) USING NONE"


How to check if points are within a circular sector using PostGIS?

I want to get the stars within the black region as shown above. To find this I have the centre of circle (lat, long), radius and the angle of region (45 degree). I am new to postgres. I worked on code to check if points exist within the circle of a given radius. How I can find points within this black region? ![enter image description here](http://i.stack.imgur.com/bLlow.png)


Out of memory when calculating loop in ArcGIS 10.2 with Python 2.7

I am quite new to scripting for ArcGIS, so don't mind the styling and layout. I am trying to calculate 600.000 routes by looping a network analyst route analysis. The script extracts two pointID's from a database, selects their spatial component from a feature dataset based on this pointID, calculates the route and writes it to a layer file by using an append. When I run the file (in ArcGIS Python Window), I get an out of memory error after 400+ files. When I examine the memory-use of the process, I can see a definite build-up until 2.5GB usage until the error. This is my code:               # step 1: centroids geographical area     arcpy.AddMessage("Performing Feature to Point")     arcpy.FeatureToPoint_management(geographicalArea, outGeographicalAreaCentroids)     arcpy.MakeFeatureLayer_management(outGeographicalAreaCentroids, outGeographicalAreaCentroidsLyr)          # step 2: create new empty feature class to append routes into     arcpy.CreateFeatureclass_management(outLocation, routesFC, "POLYLINE", templateRoute)          # step 3: go through table and perform routing for each row     cursor = arcpy.SearchCursor(dbf)          for row in cursor:         outRouteLayer = arcpy.na.MakeRouteLayer(networkDataset, outRouteLayerName, "Minutes", hierarchy = "USE_HIERARCHY")         outRouteLayer = outRouteLayer.getOutput(0)         subLayerNames = arcpy.na.GetNAClassNames(outRouteLayer)         stopsLayerName = subLayerNames["Stops"]         herkomst = row.getValue("Herkomstzo")         expression1 = "\"Z\" = %d" % herkomst         arcpy.SelectLayerByAttribute_management(outGeographicalAreaCentroidsLyr, "NEW_SELECTION", expression1)         bestemming = row.getValue("Bestemming")         expression2 = "\"Z\" = %d" % bestemming         arcpy.SelectLayerByAttribute_management(outGeographicalAreaCentroidsLyr, "ADD_TO_SELECTION", expression2)         arcpy.CopyFeatures_management(outGeographicalAreaCentroidsLyr, outGeographicalAreaCentroidsSelection)         arcpy.MakeFeatureLayer_management(outGeographicalAreaCentroidsSelection, outGeographicalAreaCentroidsSelectionLyr)         arcpy.na.AddLocations(outRouteLayer, stopsLayerName, outGeographicalAreaCentroidsSelectionLyr)         if herkomst == bestemming:             arcpy.AddMessage("Origin zone is equal to the destination zone")         else:             arcpy.na.Solve(outRouteLayer)             outputRoute = "C:\Users\Koos\Documents\Werk\Onderzoek\Data\WORKSPACE\Routes\outRouteRoutes"             arcpy.MakeFeatureLayer_management(r"route\Routes", outputRoute)             arcpy.AddField_management(outputRoute, "Orig", "DOUBLE")             arcpy.CalculateField_management(outputRoute, "Orig", herkomst)             arcpy.AddField_management(outputRoute, "Dest", "DOUBLE")             arcpy.CalculateField_management(outputRoute, "Dest", bestemming)             arcpy.Append_management(outputRoute, routesFCLocation, "NO_TEST")         # delete layers from memory         arcpy.Delete_management(outRouteLayer)         arcpy.Delete_management(herkomst)         arcpy.Delete_management(expression1)         arcpy.Delete_management(bestemming)         arcpy.Delete_management(expression2)         arcpy.Delete_management(outGeographicalAreaCentroidsSelection)         arcpy.Delete_management(outGeographicalAreaCentroidsSelectionLyr)         arcpy.Delete_management(outputRoute)         del row     del cursor      There are more steps, but they are not relevant. I read a lot of topics about the out of memory problems and memory leaks, etc. But I can't seem to solve this problem. First I tried to remove every file made in the proces with the arcpy.Delete_management function. This seems to drop the memory use a little bit every step, but not enough, so the memory usage still builds up. Next, I tried to run my script in PythonWin and IDLE (thinking the memory issue would maybe not occur), but then I got errors saying the spatial network analyst (solve tool) is not licensed (a whole other issue). Are there any suggestions as to how I can solve this issue and calculate the routes? I read on one topic that it is possible to extract the code in the loop to a seperate script and then summon this script in the loop, would this be an option? And if yes, how is this done? Edits: For a similar 'out of memory'-problem when calculating service areas, chunking the calculation has proved a valuable solution (the memory resets after every chunk). However, this still not resolves the routing issue, since chunking the route calculation will not help. Is there a possibility to partition the loop, thus resetting the memory after every 'loop-chunk'? Code used to check license:               class LicenseError(Exception):         pass          try:         if arcpy.CheckExtension("Spatial") == "Available":             arcpy.CheckOutExtension("Spatial")             print "Checked out \"Spatial\" Extension"         else:             raise LicenseError     except LicenseError:         print "Spatial license is unavailable"     except:         print arcpy.GetMessages(2)      Code used to determine input variables (example):               inputMap = "C://Users//Koos//Documents//Werk//Data script//Inputs"     facility = inputMap + "//Totale_opvang_Vlaanderen.shp"     geographicalArea = inputMap + "//BASISZONERING_OVL.shp"     networkDataset = inputMap + "//belbel________nw_ND.nd"


How do I use VB .net to export the ActiveView to geotiff using Arcobjects?

I want to program in vb.net and Arcobject the exporting of a map to geotiff. What I have done so far is export the map to TIFF but I am not getting Geotiff. When we do it manually we check the write Geotiff tag and write word file. I am not able to these things through my program. I am new to arcobject. So please suggest how to do this?? Thanks in advance.


Running Buffer_analysis in PyScripter fails to execute

For some reason, I can't get Buffer_analysis to run successfully from PyScripter(2.5.3.0) for a particular shapefile. It fails to complete and exits with error 999999. I can run the exact same command and data in ArcMap(10.1 SP1) and it completes with no errors. Can somebody suggest a reason why this may happen and possibly a solution? I have noticed this with other commands as well. It runs fine in ArcMap, but has problems in PyScripter.


How to prepare a multi-colored vector layer?

I need to present a multi-colored vector layer and something similar to below: ![a multi-colored vector layer](http://i.stack.imgur.com/DwuM6.jpg) I need to prepare the vector layer by making use with the data set available in my database. Inside my database, I have geo coordinate data and color data               Long            Lat         ColorCode     121.4698        40.8417     FF6600     121.4698        40.8325     FF6600     .     .     .     121.0344        40.4658     FFCC00     121.0344        40.4567     FFCC00      I am beginner in web GIS. Kindly point me some direction. What would be the usual way to do this? I would guess I should put the data into GeoJSON format. But how do I prepare the polygon information?


Cutting Raster using two Polygons as Masks

I am trying to cut this raster in order to drop the outside of the walls white area and the area with the dots. I made one step using as mask the green polygon but i couldn't remove the inside of the walls area with the dots. Any idea? ![andros](http://i.stack.imgur.com/Cv2xC.jpg)


Mercator bias plot in Leaflet

I was inspired by this wikipedia image from the mercator projections page to hack around with leaflet. The idea was to interactively have your cursor move a continent and that it would be corrected for the projection. See the following JSFiddle for the status sofar; http://jsfiddle.net/cantdutchthis/NrAEL/1/ I am a bit new in the projections world and although the demo works well enough for the latitude. When I compare the equirectangular and the mercator projection on wikipedia I get the impression that the projection's bias is only on the 'y-axis' when you compare these two projections. I get the impression that I am not correcting for the longitude due to the first wikipedia picture. I would like to support this but I don't know what the best way to do this is. Currently the way I am able to show the bias of the mercator projection is by shifting the coordinates to the mousecursor everytime the mouse moves;               map.on("mousemove", function(d){          Object.keys(myLayer._layers).map(function(d){ myLayer.removeLayer( myLayer._layers[d] ) })              var plotCoords = [];              // green is the coordinate array for the landmass          var green = [ [-46.76373672, 82.62796021],... ]                   for ( i in green ) {            // shift the landmass to where the cursor is            var x = d.latlng.lng + green[i][0] + 40            var y = d.latlng.lat + green[i][1] - 80            circleCoords.push( [ x,y ] );         }              window.coords = plotCoords              window.geojsonFeature = {           "type": "Feature",           "properties": {},           "geometry": {               "type": "Polygon",               "coordinates": [coords]           }         };              myLayer.addData(geojsonFeature);          });      What would be the best way to have this interactive leaflet plot also show the effect as shown on wikipedia. -- Edit! For more examples see my blog; http://koaning.com


Event raised when selected layer changes in TOC

Is there an interface which exposes events for when a TOC selected item changes? I can find snippets showing how to get the currently selected feature from the TOC. However, I have not been able to find anything that allows you to track when a selection changes - only query the current state. What would be the best approach (preferably other than polling) to track the user's current layer selected within ArcMap and ArcScene?


Implementing Feature using AbstractFeatureType in schema

I'm trying to create a XML schema which uses AbstractFeaturetype in GML. I was using xmlspy and realised that while inheriting AbstractFeatureType, it already creates a lot of elements and attributes on my feature. In fact, i meant to use gml:Point as my location element. But now as there already is a location element inherited from Abstract feature type , Do I just define my other elements as new elements and use the location element defined by Abstractfeaturetype ?


making maps using Qt

D maps using Openstreetmap data with the help of Qt. I need to use Qt specifically as other components in the software have objects that integrate into the map using Qt. How should I proceed? Can I parse postgis data to construct maps using Qt? Are there some tutorials?


What is the compression gained by caching mod_tile's metatile instead png tiles?

What is the level of compression gained caching mod_tile's larger metatile instead of 256 by 256 .png tiles? I am trying to determine the extra cost of storage resources for pre-rendering some set of .png tiles, which will be served as static files.


output file naming

Alright, So I am using a batch process of raster calculator and in the calculator I am using 2 different raster files (meridional and zonal). This calculator will be running for 24 files of each the meridional and zonal. So one run will calculate an output file for, say, Mericional_0000 and Zonal_0000; then the next run will use Meridional_0100 and Zonal_0100, all the way till 2300. Is there a way that when the calculator runs, the output for Meridional_0000 and Zonal_0000 will go to one file while the Zonal_0100 and Meridional_0100 will go to another file. [each of the 24 files will have its own file when calculated]. I tried the %Name%, but that gives me an output for each individual file, and I don't want that. Any help would be great!


How to adjust/convert/transform set of points with unknown crs using reference points

I have a set of points in an unknown crs. How can I convert (not guess) this to a given crs? I know, or rather I can determine the actual coordinates of each point in order to have some reference points to match against. How can I convert the rest of the points using these reference points? I have done this with raster images (using qgis + georeferencer plugin) , but I don't seem to find any tools for doing this with points. I don't need great accuracy. I have managed to center it and scale it in a very naive and linear based on a single reference point (near the center) but the accuracy is pretty bad, specially with points far away from the reference point.


Batch convert jpeg2000 to GeoTIFF?

I need to convert approximately 3500 jpeg2000 4-band NAIP images to GeoTiff format without mosaicing. I have access to ENVI, ERDAS and Arc 10--is there an efficient way to batch convert these files to GeoTIFF while maintaining quality and band integrity? Thanks much. -Aaron


How to programmatically add shapefile to data frame in Arcmap

I have a toolbox with python script which creates a shapefile from JSON txt file, but it does not show the generated shapefile in arcmap, i have to add it from the output location. What code shall I use to display this shapefile once it is created. Also where do I write the code here in stackexchange?


creating vector layer from OSM file using OpenLayers

Using OpenLayers, I am creating a vector layer over a map. This vector layer is created from an OSM xml file. My purpose is to do some experiments in Prolog with this data, for example, querying the shortest path (following the declared "ways" in the OSM file) that will visit certain amounts of POIs, given a starting POI. My problem is that when I load the nodes and ways in my map basically I see a big mess of features, too close to each other and some of them irrelevant. My first idea was to filter some of these nodes in the original OSM xml file using XSLT, but after doing this filtering the map did not render the vector layer at all anymore. After some experimentation I realized that the problem was that the "way" elements were referencing non-existing node elements (since I filtered them using XSLT). I could also have deleted the "ways" elements that reference non existing nodes (using XSLT again), but this does not seem to be a good idea since then I would be loosing valuable information for calculating the shortest path and other graph typical problems. Then I arrived to the conclusion that I do not want to delete certain nodes, but just trying to make some of them non-visible by default in the map. Then I use XSLT again to change the "visible" attribute to certain nodes. But the problem is that all the nodes in the file are shown in the map anyway, even if they have the attribute "visible" set to false, as in this example:               <osm version="0.6" generator="CGImap 0.0.2">       <bounds minlat="50.8319000" minlon="4.3355000" maxlat="50.8599000" maxlon="4.3708000"/>       <node id="125892" lat="50.8500083" lon="4.3553223" user="eMerzh" uid="15399" visible="false" version="6" changeset="9938190" timestamp="2011-11-24T22:05:32Z"/>     ...     </osm>      Below the code I am using to create the vector layer from the OSM file:                           <title>My OpenLayers Map</title>


How to install and use mbpipe

`mbpipe` is a simple utility to batch process images in an MBTiles database (sqlite) by piping them to an image processing program. But how does one install and use it? It says here that mbpipe comes with the mbtiles node.js module, that is installed with the command `npm install -g mbtiles`. However after doing that there is in fact something in `/usr/local/lib/node_modules/mbtiles` but the "mbpipe" command or script cannot be found anywhere on my machine. What should one do...? Edit: on the github page for node-mbtiles it apparently says that the `mbpipe` utility was removed from the `mbtiles` module, but no one seems to be following up on this issue. Is there another utility to do the same? (It should be pretty straightforward: extract images from an sqlite db, send them to a program for processing, re- insert the processed image).


How to configure legend for ESRI Silverlight SDK 2.1

I can't get the simple Legend sample working with this florida mapservice. The names appear, but the tree doesn't get populated. Anyone see why this code shouldn't work? Here's my modified xaml:               <esri:Map x:Name="MyMap" Extent="-15000000,2000000,-7000000,8000000">                 <esri:ArcGISTiledMapServiceLayer ID="Street Map"                          Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>                 <esri:ArcGISDynamicMapServiceLayer ID="Florida" Opacity="0.6" Initialized="ArcGISDynamicMapServiceLayer_Initialized"                                                    InitializationFailed="ArcGISDynamicMapServiceLayer_InitializationFailed"                         Url="http://map.floridadisaster.org/GIS/rest/services/Facilities/Critical_Facilities/MapServer"/>             </esri:Map>                  <Border Background="#77919191" BorderThickness="1" CornerRadius="5"                 HorizontalAlignment="Right"  VerticalAlignment="Top"                 Margin="20" Padding="5" BorderBrush="Black" >                 <esri:Legend Map="{Binding ElementName=MyMap}"                               LayerIDs="Florida"                              LayerItemsMode="Tree"                                                       LayoutUpdated="Legend_LayoutUpdated"                        BindingValidationError="Legend_BindingValidationError"       />             </Border>      **Update:** Running the sample with fiddler, I see a request sent to here: http://www.arcgis.com/sharing/tools/legend?soapUrl=http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer&f=json&returnbytes=true&_ts=634254399369803267 However, no similar request is made when running my modified version.


GIS Layer of USA State Court Jurisdiction Boundaries

Does anyone know of a national layer? Edit: Sorry for the delay in clarifying. I am looking for all courts (district, circuit, municipal, Superior, etc.) depending on the terminology used for the state for the USA. Based on the answers provided and research I've done I don't believe this is available. I very much appreciate all the feedback and leads.


Using Custom Source for QGIS OpenLayers Plugin

I'm using a Custom Map Source for MOBAC that is based on a beanshell script (see below) which renders perfectly in MOBAC. Now, I'd be keen to do the same in QGIS and wonder if it is possible to implement the same source in the OpenLayers Plugin? Admittedly I'm completely new to OpenLayers so please excuse me if this approach turns out to be foolish. Or maybe there is an alternative to use this map source as base map in QGIS?               /**      beanshell code to use the online maps from bergfex          put it into your "mapsources"-directory...              This program is free software: you can redistribute it and/or modify         it under the terms of the GNU General Public License as published by         the Free Software Foundation, either version 3 of the License, or         (at your option) any later version.              This program is distributed in the hope that it will be useful,         but WITHOUT ANY WARRANTY; without even the implied warranty of         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         GNU General Public License for more details.              You should have received a copy of the GNU General Public License         along with this program.  If not, see <http://www.gnu.org/licenses/>          **/               static import java.lang.Math.*;          name = "Bergfex";          tileType = "png";          tileSize = 256; // optional     minZoom = 8;   // optional     maxZoom = 15;   // optional          /**     This method is called for each tile:      input parameters for this script: "zoom", "x" and "y"     **/          random = new Random( System.currentTimeMillis() );          String getTileUrl( int zoom, int x, int y ) {         // String baseurl = "http://s2.bergfex.at/images/amap/";         String baseurl = "http://s" + random.nextInt(10) + ".bergfex.at/images/amap/";         String xBase = "";         if (zoom > 13)             xBase = Integer.toString(x).substring(0, zoom - 12) + "/";         return baseurl + zoom + "/" + xBase + zoom + "_" + x + "_" + y + ".png";     }


How to control the order of appearance of markers using leaflet?

I'm plotting out markers from GeoJSON files onto my Leaflet map. Some of these markers overlap so now I want to control the order of appearance of these markers so that one type always sits above the others. How do I do this? Is it possible? The marker that I want to be on top of everything is also moving around in the map (see url below). I've noticed that sometimes it's above the other markers and sometimes below. I tried creating layer groups but nothing really happened...? Here's the map: http://www.oskarlin.com/hike2013/


Help converting projection/coordinates to Google Earth

I'm trying to program a GPS style tracker for a simulation game but I'm having a hard time figuring out how to transform the game's coordinates into Google Earth's. The game's world is flat and has the following map projection: http://postimage.org/image/czoi8rxgn/ The game's current position data is: Long: from -21,600,000 m to +21,600,000 m Lat: from -10,800,000 m to +10,800,000 m Centered at 0m, 0m (0,0 degrees) Distance between degrees is the same everywhere (120,000 m) for latitudes or longitudes. I believe this is called an equidistant projection? My problem is this, when using the formulas (180/21,600,000 * X position) and (90/10,800,000 * Y position) the game's coordinates don't translate correctly to Google Earth (like in this picture where red is the actual path in game, white is the path exported to GE) http://postimage.org/image/im67likq3 I realize that the world in Google Earth is a 3D sphere so there's probably some more factors I need to take into account but since I'm a completely beginner when it comes to cartography/GIS, I'm kind of lost. Is there a conversion formula I should be using to match the coordinates? Thanks in advance!


ECW Compression Engine Error in ERDAS Imagine

We have some IMGs that we're trying to convert to ECWs with the fourth band activated to mask the wretched black null data borders. The instructions we got from ERDAS were to create an AOI and export the data from IMG to ECW using the AOI as the mask layer. However, we keep getting the same error of "ERROR: Could not open ECW Compression Engine" when we try to run that export. Anyone run into these problems before? The files in question are quite large as IMGs (100+ GBs). Appreciate any help or advice you may have to offer. Unfortunately, I am limited to this software and this procedure because it is the only one that works with our IMS.