SyntaxError: invalid syntax (<string>) in Pl/Python (PostgreSQL)

I have python 2.7 and I have weather script which returns temperature infos, I would like to implement this script into PostgreSQL. I always got this error: `DETAIL: SyntaxError: invalid syntax (<string>, line 10)` code:                   CREATE OR REPLACE FUNCTION GetWeather(lon float, lat float)         RETURNS float         AS $$         import urllib2         import simplejson as json              data = urllib2.urlopen(         "http://api.openweathermap.org/data/2.1/find/station?lat=%s&lon=%s&cnt=1"% (lat, lon))         js_data = json.load(data)         if js_data['cod'] == '200':          if int(js_data['cnt'])>0:          station = js_data['list'][0]          print 'Data from weather station %s' %station['name']         if 'main' in station:          if 'temp' in station['main']:          temperature = station['main']['temp'] - 273.15          else:temperature = None         else:temperature = None              return temperature              $$ LANGUAGE plpythonu;      I tried this version too, it is working in pure python but not in postgresql               CREATE OR REPLACE FUNCTION GetWeather(lon float, lat float)         RETURNS float         AS $$         import urllib2         import simplejson as json              def get_temp(lat, lon):         data = urllib2.urlopen(         "http://api.openweathermap.org/data/2.1/find/station?lat=%s&lon=%s&cnt=1"% (lat, lon))         js_data = json.load(data)         try:         return js_data['list'][0]['main']['temp']         except (KeyError, IndexError):             return None              $$ LANGUAGE plpythonu;


ArcGis - batch frequency of point groups to single table?

I'm kind of new in the GIS world but have been finding my way around in forums and help places up to now. Still, there's one task I need to perform that I cannot get my head around it or even find somebody with the same problem. I would be really grateful if somebody could help me on this. Basically I have a bunch of points (around 40,000), which are split in categories (1 to 9) and have a field which specifies their membership to a polygon (~50) (e.g, 30, which would mean that the point is located in polygon 30). Some zones do not contain points of all categories. I wish to know the frequency of each category per zone, in such a way that in the end I would have a table with the first column for the categories, and the zones listed in the first row. Did somebody have the same challenge? How did you solve it? Best regards! Andre


how we create line between two cordinates on polymap?

I am working on d3 and polymaps, I plot map and create circle on the given latitude and longitude which retrieves from the JSON file but now I want to connect those circles with line. I tried to do it with SVG but I am unable to find the accurate result.


ERDAS Imagine batch wizard edit replacement pattern help

I'm using ERDAS Imagine to batch produce NDVIs from NAIP imagery. I need to also replace the default file name (e.g. "m_3610132_nw_14_1_20100503") with a user friendly file name (e.g. 3610132nw). How can I change the edit replacement pattern in the batch wizard to output a subset of the original filename? Example: z:/project/studyarea_8_naip/ok_naip/temp_out/$(Input.pathright)$(Input.root) yields => m_3610132_nw_14_1_20100503 However, I want the output to be simply 3610132nw


Free / Open source GIS Education sources

I'm looking for free / open source GIS education sources for advanced GIS users. Specifically sources that cover programming, spatial analysis, modeling, spatial databases / data management. I use mostly ArcGIS as a federal employee, but sources that go into conceptual concepts are appreciated too. I'm a big fan of the Penn State Masters in GIS program because they offer many of their full classes under the MIT license. I'm also reading through the lectures from the Dublin Institute of Technology. I'm hoping that there are other high quality resources out there that I haven't come across yet. While I would prefer actual courses that have some degree of interactiveness (like quizes or tasks associated with lessons), books should be considered if they are high-quality, free resources.


Ring to Polygon

I want to get an exterior ring from a polygon. I need to itopologicaloperator.intersect a line with the polygon (exterior ring) to read attributes from the line. I have the original Polygon I can get the ring. I have the lines. I have the itopologicaloperator.intersect What i cant get is converting/casting the ring to a polygon so i can use itopologicaloperator.intersect. What i have is islands inside of lakes, the attributes i read from the line are picking up the island features, but i only want the lake lines, (exterior) not the interior (islands)               for (intProgress = 0; intProgress <= intIndex - 1; intProgress++)             {                 if (intExit == 1)                 {                     System.Environment.Exit(0);                 }                      // get the feature of the polygon class - idindex                 pPolyFeature = pPolyFeatureClass.GetFeature(IdIndex[intProgress]);                 intPolyOID = pPolyFeature.OID;                 pRelOp = (IRelationalOperator)pPolyFeature.Extent;                 dblFeatSize = Convert.ToDouble(pPolyFeature.get_Value(intPosPolyShapeArea));                      pGeometry = pPolyFeature.Shape;                      // http://resources.esri.com/help/9.3/arcgisengine/arcobjects/esriGeometry/IPolygon_Example.htm                 // set the polygon                 IPolygon4 pPolygon = pPolyFeature.Shape as IPolygon4;                      IGeometryCollection pPolyGeoCollection = (IGeometryCollection)pPolygon;                      // http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#/ExteriorRingBag_Property/002m000002n0000000/                 // IPolygon4.ExteriorRingBag should be used instead of IPolygon.QueryExteriorRings                 // which does not work in .NET because of C-Style Arrays                 IGeometryBag pExtRingGeometryBag = pPolygon.ExteriorRingBag;                      // cast geometry to geometrycollection                 IGeometryCollection pExtRingGeometryCollection = pExtRingGeometryBag as IGeometryCollection;                 IFeatureLayer pRingLayer= null;                      int ExtRingGCCount = pExtRingGeometryCollection.GeometryCount;                      IGeometry pExtRingGeometry = null;                      for (int i = 0; i < pExtRingGeometryCollection.GeometryCount; i++)                 {                     pExtRingGeometry = pExtRingGeometryCollection.get_Geometry(i);                          pPolyGeoCollection = new Polygon() as IGeometryCollection;                          object obj = Type.Missing;                     pPolyGeoCollection.AddGeometry(pExtRingGeometry, ref obj, ref obj);                 }                           //Can now be used with ITopologicalOperator methods.                                                    // creates a new spatial filter                 // selects lines that share a boundary with a polygon                 pSpatialFilter = new SpatialFilter();                 // - same as above  still gives me the same id count as intInitSelectCount                                pTopoOp5 = (ITopologicalOperator5)??????????????????.Shape; // pExtRingGeometry..Shape;                 pTopoOp5.IsKnownSimple_2 = false;                 pTopoOp5.Simplify();                      // find lines whose interiors intersect the Boundary of the polygon                 SpatialFilter pSFPolygonIntersects = new SpatialFilterClass();                      pSFPolygonIntersects.GeometryField = pLineFeatureClass.ShapeFieldName;                 pSFPolygonIntersects.Geometry = pTopoOp5 as IGeometry;                 pSFPolygonIntersects.SearchOrder = esriSearchOrder.esriSearchOrderSpatial;                 pSFPolygonIntersects.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;                      IFeatureCursor pFCCrossingLines = pLineFeatureClass.Search(pSFPolygonIntersects, false);                 IFeature pFeatureLineCross;                      List<int> LineOID = new List<int>();                      while ((pFeatureLineCross = pFCCrossingLines.NextFeature()) != null)                 {                     int featOID = pFeatureLineCross.OID;                          // This sample uses ITopologicalOperator::Intersect                     // to do the equivalent of a select by location with the share a line segment operator.                          // http://resources.esri.com/help/9.3/arcgisengine/arcobjects/esriGeometry/Share_a_line_segment.htm                          // is there an intersection between the two features                     // store the line 1 shape in the topo op                     ITopologicalOperator topologicalOperator = pFeatureLineCross.Shape as ITopologicalOperator;                     if (!topologicalOperator.IsSimple)                     {                         topologicalOperator.Simplify();                     }


Is there a bug in the "Layer 3D to Feature Class" tool?

I am trying to convert an etruded polygon feature class to a 3D multipatch feature using the "Layer 3D to Feature Class" tool. The result is a flat multipatch rather than the expected 3D feature. I am exporting from ArcScene not ArcMap to ensure 3D layer properties are used. (ArcGIS 10.2.1) Does anyone else have the same problem? Is this a bug? there a workaround?


Help choosing GIS elective class

I'd like some input on choosing an elective for my GIS study. My choices are: 1) Database management in GIS 2) Python and Spatial Analysis in GIS 3) Project management in GIS From what I understand, programming and database skills are both hot commodities; however, I think I would enjoy project management and the "big picture" approach. I already have a Master's in Geography and have taught undergraduate geography, but I'm going back to get these skills so that I can do geography outside of the classroom. Would each of those classes match up with a different role within the GIS field, or is there more overlap? Thanks! _edit_ Thanks everyone for your input. Very helpful clarifying some of the different roles within the GIS workplace. Much appreciated!


Will ogr2ogr correctly merge features from several OSM files to resulting set

In GDAL >= 1.10, `ogr2ogr` contains osm driver I want to try this feature and migrate OSM to PostGIS (I'm aware of `osm2pqsql` existence) I have several relatively small OSM files and wonder if `ogr2ogr` driver will merge all features correctly or do I have to use other tool for merging (`osmosis`) before migrating to PostGIS?


How to find ID's of nearest stations (points) in a specific radius

I am using ArcGIS 10.0 and I am doing rainfall data analysis :) I have a single layer including more than 1,000 stations (points) and I need **name (STATION_NO) of neighbor stations in more than one specific distance for each station**. I've tried all PROXIMITY options in Arctoolbox, but the outputs were not what I expected. For exa. I need to know the name of 5 nearest stations in a radius of 50Km. Thank you ![enter image description here](http://i.stack.imgur.com/T1LUq.png)


Using photon in a Leaflet code: example?

I need to put a geocoder in a Leaflet page and I'd like to uso Photon (rif. http://photon.komoot.de/). There is a leaflet plugin here https://github.com/komoot/leaflet.photon but no example is given: is there someone that use it in some projects and can give me a little example? Thank you very much in advance .... Cesare


How to Get Uncompressed Size of Raster in Arcobjects

How can we get the Uncompressed Size of a raster as shown in the layer properties below using ArcObjects? ![enter image description here](http://i.stack.imgur.com/PrMSm.png)


In "ArcGIS Server Manager." I wish that when I create a new "ASP.NET Web Application" already come with "pre-configured tags." How to do this?

I'm using the "ArcGIS Server Manager" to create "Web Applications" with my maps. In ASP.NET project has a "web.config". How do I get my "web.config" come with some "tags" standard? More specifically, these tags would be: > > < configuration> < configSections> < /configSections> < system.net> < > settings> < >>servicePointManager expect100Continue="false" /> < /settings> > < /system.net> < >>/configuration> These tags are described in: How do I use a layer of Bing / Google a "WebApplication" in "ArcGIS Server Manager"? I thank all the GIS forum! Thank you!


ArcMap 10.1 and MapProxy: what is the differense between WMS, WMTS and "Layer.OSM"

On Ubuntu I have PostgreSQL, postgis, renderd, mapnik, mapproxy. 1) I have OSM. It is rendered by Mapnik. 2) Then I have MapProxy. So I have this OSM by WMS protocol. 3) I also can have this OSM by WMTS protocol (nowdays I do not use this protocol) On Windows I have web-program on Aptana (OpenLayers) and ArcGis Server, ArcMap with Desktop application. So on the OpenLayers I can display this map as:   * `new OpenLayers.Layer.WMS("WMS", "http://192.168.36.139:8080/service?", {layers: 'osm'});` \- It is WMS protocol. Here we see one picture.   * `new OpenLayers.Layer.OSM("OSM", "http://192.168.36.139/osm_tiles2/${z}/${x}/${y}.png", {numZoomLevels: 19});` I do not know what this protocol is. Here we see the picture as many tiles. Also we have ArcMap and Desktop Application, upgrading by me, based on ArcObjects. I want to display this OSM here. So I add this OSM to ArcMap by WMS protocol. GCS_WGS_1984 and 900913. What is the difference? How to set mouse wheel zooms in ArcMap 10.1? But ArcMap 1) Every time renders the OSM. 2) On the different scales does not display this OSM. And returns errors. _**So, my questions are:_** 1) Do I solve this problems(with ArcMap), If I will use WMTS? 2) What is the difference between all this protocols?


Find nearest POI of given GPS coordinates

I am new to GIS and need to achieve the following: Find the nearest train station or bus stop of given GPS coordinates in a Java application. Since there are many coordinates to be checked, an offline calculation is preferred. Visual rendering of maps is **NOT** required. After some research, I thought of the following:   1. use OpenStreetMap, download the maps   2. extract the relevant nodes using osmosis ("... --tf accept-nodes ...")   3. import the data into a PostgreSQL/PostGIS database   4. finally run the queries to select nearby train station Can you tell me if the outlined approach is possible and useful? Are there other, better ways to solve the problem? How can I implement step 4 in a simple yet effective way? Are there Java libraries which assist with the PostGIS stuff?


Retrieving ArcGIS:s Spatial Data into a Database

**Background:**   If you have created a vector map with lots of spatial data in geometry flat in with measurement kilometer. The following object that is used in the map will be point, line and polygon object. You create your own spatial data in ArcGIS without retrieving any data from a database. **Question:**   How do I retrieve the objects' X and Y coordinate data from ArcGIS into SQL server? Maybe using XML document or does ArcGIS has a local built-in database?


Highlight the WFS Layer on mouseover

I've set up a WFS layer in openlayer:                var v1497_shp = new OpenLayers.Layer.Vector("v1497_shp", {          strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],          //projection: new OpenLayers.Projection("EPSG:26910"),          protocol: new OpenLayers.Protocol.WFS({              version: "1.1.0",              // loading data through localhost url path              url: "http://localhost/geoserver/wfs",              featureNS :  "http://www.opengeospatial.net/cite",              maxExtent: mapextent,              // layer name              featureType: "v1497_db_wfs",              // geometry column name              geometryName: "the_geom",              schema: "http://localhost/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=cite:v1497_db_wfs"          })     });      Now i want to highlight the layer when i pass over with the mouse. how can i do this? Ay idea? Thank you.


QSpatialite install error in QGIS

I'm installing QGIS 1.7.4 in windows 7 & having problems with QSpatialite. I get 3 messages... **Message #1** This DB a valid SQlite DB, but not a valid SpatiaLite DB. QSpatiaLite will now try to Create a valid SpatiaLite DB then **Message #2** Error. Try to execute by yourself: SELECT InitSpatialMetadata() then **Message #3** You are using SpatiaLite V2.3 ( standart with QGIS<1.7). Please note that QspatiaLite full potential require SpatiaLite V2.4. Please update your SpatiaLite version, or move to QGIS 1.7 **What I've tried**   1. Executing the SELECT InitSpatialMetadata() command from within the dialog   2. I'm running QGIS 1.7.4   3. The QSpatialite dialog confirms the error message because in the bottom left corner it says I'm running Spatialite V2.3.1. Thinking my problem relates Spatialite version, I ran the OSGeo4W setup again. However, the setup says I'm running spatialite 3.0.1-2 and sqlite 3.7.10-2. The only thing I can think of is that spatialite v3 is not being picked up because the QSpatialite plugin installed v2.3.1 of spatialite somewhere. Is that possible? Any ideas? Thanks Ian


Why doesn't OpenLayers zoom?

I've got a little problem with OpenLayers. I've a simple function which sets the center of the map to the position of the user - this works fine. But: it should also zoom - which, for an unknown reason, don't work. Any ideas?               function gotSomeLocation(position){         var lat = position.coords.latitude;         var long = position.coords.longitude;         map.zoomTo(18);         alert("Lokalisiert!");         map.setCenter(tCoord(long, lat));          }


Can I "stack" labels in ArcMap (ArcView) without Maplex?

I do not see any obvious setting for stacking labels in ArcMap (ArcView license). Am I missing something or do i have to write a complex expression to stack my labels?


What is the easiest way to measure a polyline using either QGIS or ArcGIS

I've collected a bunch of GPS polylines (WGS84). What is the easiest way to measure the length of these lines in KM?


Convert from img to geotiff

Using gdal translate, would it be possible to convert from IMG to GeoTIFF? We have very little experience with gdal and would really be grateful for some insight.


ESRI Image Service On Google Earth API

I've been started developing GoogleEarth API on web. I'm using GoogleEarth plugin 7.1.2 version. It is probably a simple question but I'm having trouble with that. I'm trying to integrate the ArcGIS Image Extension for Server (version 10.1) to a web application based on google plugin and server enterprise, or at least find a proper solution. I know that there is a way to publish ESRI service as KML but I want it to be a last resort cause the image service is outsource Sorry if my English is not that good.


PostGIS and geometry column

I have a csv table. Each record includes a start node (lat1,lon1) and an end node (lat2,lon2). I have already imported the .csv into Postgresql 8.4. Now I would like set the geometry column. I tried to use this sql statement:               UPDATE mytable     SET the_geom = ST_GeomFromText('POINT(' || lat1 || ' ' || lon1 || ' ' ||                    lat2 || ' ' || lon2 || ')',4326);      but I receive this warning message:               WARNING:  OGC WKT expected, EWKT provided - use GeomFromEWKT() for this                 ERROR:  new row for relation "mytable" violates                  check constraint "enforce_dims_the_geom"      Do you have any idea on how to add geometries in my case? Thank you Selini


Add Oracle Spatial Vector Layer with QGIS 2.0 on Mac OSx

I installed version 2.0 using the recommended mac installer (http://www.kyngchaos.com/software/qgis), and the installation went fine, but there is no option to add an oracle spatial layer (not in the layer dropdown, or the sidebar buttons). I assume this has to do with gdal configuration, but I'm not sure how to fix that. I have the oracle instant client installed, and I can connect to oracle with sqlplus. Has anyone been able to get the new support for oracle to work on a Mac?


Geographic Transformation

I have an Image with the following metadata:               Projection Information :              Projection Zone  : 0         Spheroid Name   : Modified Everest         Georeferenced to : RSO               Map Information :              Upper Left center X : 598398.000000         Upper Left center Y : 506921.000000         Lower Right center X: 622798.000000         Lower Right center Y: 473521.000000         Pixel X size : 20.000000         Pixel Y size : 20.000000      The Geographic Coordinate System the image uses is:               Geographic Coordinate System: GCS_Kertau_RSO     Angular Unit: Degree (0.0174532925199433)     Prime Meridian: Greenwich (0.0)     Datum: D_Kertau_RSO      Spheroid: Everest_1830_RSO_1969       Semimajor Axis: 6377295.664       Semiminor Axis: 6356094.667915204       Inverse Flattening: 300.8017      I need to project this image in the WGS_1984_UTM_Zone_48N coordinate system. I am using the ArcGIS-Desktop package. To achieve this, I am using the _Project Raster_ tool under the Data Management Tools to convert the projection. The problem is that even after the projection takes place, the projected image does not get properly aligned to its place and stays at the same spot (over the original image). On checking the layer properties of the projected image, it shows the layer is spatially referenced to the WGS_1984_UTM_Zone_48N system, but unfortunately, it is not displayed at its correct position (which can be checked by adding a BaseMap from ArcGIS online resources). Need suggestions/ alternative solutions to the problem.


How to handle an "Input CRS error" when clipping?

I'm trying to clip a soil use shapefile, with a polygon I've created this morning. The clipping function works, but the clipped polygon doesn't have features (the table of contents is empty). QGIS advices me that: *Created output shapefile: /Users/biaginisandra/Desktop/Uso_suolo_Roncacce/Uso_suolo_Roncacce.shp Warnings: Input CRS error: One or more input layers missing coordinate reference information, results may not be as expected. GEOS geoprocessing error: One or more input features have invalid geometry. Some output geometries may be missing or invalid. Would you like to add the new layer anyway?* Where is the problem? Thanks in advance.


How to assign OGR geometry a spatial reference when writing to a new layer using the Python API?

I'm using the Python OGR API to add new features to a PostGIS layer. However, despite setting the geometry spatial reference, when the geometry is written out the spatial reference is missing. This is a problem as the destination table has check constraint forcing geom_srid to be a particular type. For example:               ogr.UseExceptions()          # Create a feature in an existing layer (where layer is a PostGIS table)     feature = ogr.Feature(layer.GetLayerDefn())          # Create spatial reference     out_srs = ogr.osr.SpatialReference()     out_srs.ImportFromEPSG(27700)          # Assign to geometry     geom.AssignSpatialReference(out_srs)          # Set feature geometry     feature.SetGeometry(geom)          # Create the feature     layer.CreateFeature(feature)     feature.Destroy()      Returns:               Error: new row for relation "table" violates check constraint      "enforce_srid_geom"     Command: INSERT INTO "table" ("geom", "attr1") VALUES (GeomFromEWKT('SRID=-1;POINT (5000, 1000)'::TEXT), 'row1')      At this point it is clear that OGR is converting the geometry to an EWKT string without pulling in the spatial reference attribute. Specific questions: 1) Does anyone know how I can force the geometry output from SetGeometry() to include an SRID when it is converted to EWKT? 2) Has anyone found this with the CPP bindings? 3) Is this a bug in OGR? From OGR source the output string is being created in ogrpgtablelayer.cpp where nSRSID is being set to -1 if no valid SRS input is found. Many thanks, Tom


Color ramp in multiple attributes symbology (Arcmap)

I am trying to use the "multiple attributes" symbology tool in Arcmap 10. I would like to divide my data in 2 categories. For each categories, I would like to display a color ramp. I read ESRI's documentation about that, but I can't figure how to obtain the proper color ramp: Screenshot I want to have a "green" color ramp for the first category (value '0'), and a "red" color ramp for the second one (value '1'). What am I doing wrong? Thanks for your help


Error handling with python script in ArcGIS 10

I have a python script that I am using to create a list of all mxd files (with full pathing) in our Projects folder. The script then uses that to iterate through the list and do a findandreplaceworkspacepaths on each mxd per ESRI's how to. I am running into problems when I hit a corrupted mxd file. The have tried try/except and haven't gotten it to work. The ideal situation would be to write the corrupt filename to a file and move on so I can come back to them at the end. I'm very new with python scripting, any help would be greatly appreciated.               import arcpy, os, sys, traceback, time          oldpath = 'W:'     newpath = 'W:\\GIS'          def find(path,pattern):         matches = []         for r,d,f in os.walk(path):             for files in f:                 if files.endswith(pattern):                     fpath = os.path.join(r,files)                     matches.append(fpath)                     print (fpath)         return matches               print ("Go: ")     mxdlist = (find('C:\\gis','.mxd'))     print (mxdlist)               print ("Starting Path Conversion")     try:             for mxdold in mxdlist:                 mxd = arcpy.mapping.MapDocument(mxdold)                 mxd.findAndReplaceWorkspacePaths(oldpath, newpath)                 time.sleep(6)                 mxd.save()                 time.sleep(6)                 print (mxdold)                 del mxd         except arcpy.ExecuteError:                 arcpy.AddError(arcpy.GetMessages(2))                  except:                 arcpy.AddError("Non-tool error occurred")


Experimenting with the W3C Geolocation API. Is there a way to get the method how the location was processed? I mean GPS, IP, Cell IDs etc. I didn't find any object properties doing that. Thanks!


How to use different 'missing tile' for OpenLayers?

I would like to use a different image for missing tiles with an OpenLayers application. Currently the tile is red/pink, with a red x in the upper left corner. I would like to remove that corner, does anybody know how to specify this image?


Using GIS for Interactive Floor Plan

GIS is brand new to me, but I've spent a couple of days researching so that I can at least ask somewhat intelligent questions.   1. I've decided to use QGIS   2. I need to do an interactive floor plan on the web and shapefiles fits the bill Problem: I need to put the floor plan in as a backdrop (raster) to all the polygons that will represent the rooms. But, I don't know how to properly set the scale so that when I use the 'measure' tool it will actually come up with correct measurements. Any advice? Edit: Adding sample image to show what I'm doing. As you can see there's a floorplan that I've imported into QGIS as a raster layer. I'm going to be tracing the shapes of the rooms into a separate shapefile, which I then want to use on the web (using Silverlight) to interactively update the polygon fill colors representing temperatures in the various rooms. The problem I'm experiencing is that when I load the image separately into the Silverlight application and then load the shapefile a) The position and shape of the polygon looks nothing like it does in the GIS app b) It's in the wrong place altogether, but I think I might be able to solve that one myself. The shape that's coming out totally different is the worry? ![floorplan with single polygon representing a single room](http://i.stack.imgur.com/hlzAc.gif) Regards, Jacques


QGIS and satellite images band combination

When I add a satellite images as a raster in QGIS: 1\. Why the image is changed, it looks like it has only one band?; 2\. where is a tool for band combination? Thanks!


CartoDB map in openlayers

Is there a way that i can upload my CartoDB map in Openlayers as a WMS layer or Vector layer. Here is the my CartoDB map link. http://cdb.io/1nxdrpf


Looking for Fortran code calculating drainage basin area

I am working in a project of glacier mass balance. For my project I want to integrate the area of the drainage basin in a glaciological system model (GSM). As the drainage area changes with time due to topographic evolution (ice accumulation or melt), I need to be able to integrate some code which calculates this area in the GSM. Would anybody know where I could find some code to compute the drainage area of a region?


How to trigger a map click event?

I have a map with some markers. On clicking a marker, a popup would appear and on clicking the map, any visible popup would be hidden. I want to hide any currently visible popup upon clicking a marker as well, and introduced a line of code in the following event listeners:               marker.events.register("click", marker, function(event) {      map.events.triggerEvent("click", map); // this line of code added      popup.show();     });     map.events.register("click", map, function(event) {      popup.hide();     });      However, I get an error upon clicking of a marker with the error given as "px is undefined" on line 1981 in Openlayers.debug.js file, which is the `Openlayers.Pixel` class with `distanceTo` method. I am not sure what is wrong and can't seem to make sense of it. Can anyone help me? Thanks.


How can I improve the speed at which QGIS 2.4 handles network data? (Seems much slower than 2.2 - even with small datasets)

I recently downloaded and installed QGIS 2.4 Chugiak on a Windows 7 64-bit machine with a quad core processor and 8GB RAM. I'm having a few problems using datasets of all sizes from a **network** drive - the data is slow to render and there is an annoying low-pitched "beep" each time I zoom in/out. In the previous release (2.2), this network data would render almost instantly for small datasets with no sounds. I've also noticed that opening the attribute tables for this network data is very slow. E.g. a dataset with just 91 records takes almost 30 seconds - something that was almost instant in QGIS 2.2 Valmiera. Using the dataset on a local drive removes the problems, though this is not an option as we have several members of staff working on the same datasets and want to avoid having multiple file versions all over the place! Have any network settings been changed from 2.2 to 2.4?


How to create graph out of two layers using ArcGIS 10.1 for Desktop?

![crmrttbl](http://i.stack.imgur.com/TqwFd.jpg)![crimerate](http://i.stack.imgur.com/Pnvzt.jpg)![landprize](http://i.stack.imgur.com/hdE0F.jpg)I would like to create a graph of two layers I have. on one hand its the land price of a certain area and on the other a layer with a crime rate. first of all, the layer with the land prices doesnt have a table like the crime rate layer. So i cant join them, which was my first intention, the other problem is that i dont even know how to create a table out of that layer (well I do in general but the create table tool wont offer me the land price layer as an option) if someone could explain that to me i guess the rest wouldnt be much of a problem. eventually the graph should look something like this(with the crime rate at the x-axis and the land price at the y-axis): ![Graph](http://i.stack.imgur.com/buJcq.jpg)


Using python libary simplejson and urllib in PostGIS

I installed PostGreSQL9.3 and want to create a Pl/Python function using simplejson library and urllib. First I use OSGeo4W Shell to test the similar python script, it works. Then in PostgreSQL, it doesn't work; the error info is "can't use a string pattern on a bytes-like object".               CREATE OR REPLACE FUNCTION scratch.GetWeather(lon float, lat float)     RETURNS float     AS $$         from urllib.request import urlopen         import json as simplejson         data = urlopen('http://api.openweathermap.org/data/2.1/find/station?lat=%s&lon=%s&cnt=1' % (lat, lon))         js_data = simplejson.load(data)         if js_data['cod'] == '200':                     if int(js_data['cnt'])>0:                 station = js_data['list'][0]                 print ('Data from weather station %s' % station['name'])                 if 'main' in station:                     if 'temp' in station['main']:                         temperature = station['main']['temp'] - 273.15                     else:                         temperature = None                 else:                     temperature = None             else:                 temperature = None             return temperature              $$ LANGUAGE plpython3u;        Error message is               "TypeError: can't use a string pattern on a bytes-like object     CONTEXT:  Traceback (most recent call last):       PL/Python function "getweather", line 5, in <module>         js_data = simplejson.load(data)..."      How to fix this? Thanks.


Moving map-embedded annotation to a different annotation group

I'm working with an annotation group that was generated by converting labels to annotation and storing it in the map instead of a database. After this conversion, the scale of the map was changed, and a number of edits were made to the annotations. I needed to duplicate a few of the annotations to indicate parts of some multi-part polygons that originally only had one label for each part. When I copied and pasted an existing label in the annotation group, however, I made the mistake of placing it in the Default annotation group instead of the one I was editing. Since the Default group has a reference scale fixed to the data frame, the pasted annotations are a much different size than the original annotations. Is there a way to move annotation from one annotation group to another?


How to reassign the values of a raster, based on the pixels of the raster beneath it?

In ArcMap 10.2.1, I have two rasters. Raster1 shows the extent of a habitat, and each pixel contains a categorical value for its land cover type (values 1-3). Raster1 has the smaller spatial extent of the two rasters. The cell size is 30x30 meters. Raster2 contains continuous data representing the total basal area (tree coverage) within each pixel. The cell size is 250x250 meters. Basically, I want to change all the values of my habitat pixels to instead reflect the basal area found in that pixel below, not the land cover type. I tried using Extract by Mask (extracting Raster2 values with Raster1 as a mask) to get what I need, however the large difference in cell sizes means that the edges and shape of the extracted habitat are now too inaccurate and unresolved to be useful in my analysis (it's now 250x250 instead of 30x30). I also tried a Raster to Point conversion on the habitat raster (so that I could Extract Values to Points and then re-convert back into a raster), but ArcMap won't create the point shapefile because it "exceeds the 2GB limit" (Error 010247). Any ideas how I can create this raster with the new values while maintaining the same level of resolution (30x30)?


How to calculate x/y in a different coordinate system in QGIS 2.4?

I'm trying to calculate Northing Easting in QGIS. I can get it to calculate my lat/long using $y and $x in the field calculator. I changed coordinate systems to what I want it displayed at, but it's still calcing the lat/long


Does QGIS automatically use spatialite spatial indexes?

When you write a query in spatialite you have to manually join your query to the spatial index for that index to be used to speed up the query. When QGIS displays data does it take advantage of any spatial indexes as you pan and zoom around your data?


Find and replace unicode character in a shapefile

I've found several example of script and blog posts on working with unicode characters, but I haven't been able to make anything works so far... It's a little frustrating I have a shapefile encoded in utf-8 (exported from QGIS) and there's many É, È, À, Ô, etc. in the values of some fields. For a geocoder, I need to normalize my fields values. This is what I have so far:               # -*- coding: utf-8 -*-     ###############################################################################     import sys     from sys import argv     import osgeo.ogr     from amtpy import EndOfScript     ###############################################################################          script, src_shp, fld_shp = argv          #- Opening the shapefile     shapefile = osgeo.ogr.Open(src_shp)     layer = shapefile.GetLayer(0)     spatialRef = layer.GetSpatialRef()               #- Going through each feature, one by one     for i in range(layer.GetFeatureCount()):         print "Normalisation de la ligne %i" %(i+1)         feat = layer.GetFeature(i)              texte_norm = feat.GetField(fld_shp)         texte_norm = texte_norm.encode('utf-8')              texte_norm = texte_norm.upper()         texte_norm = texte_norm.replace(u'\00c2', 'A') #À         texte_norm = texte_norm.replace(u'\u00C9', 'E') #É         texte_norm = texte_norm.replace(u'\u00C8', 'E') #È         # I've remove 16-17 characters to replace, for the example...         texte_norm = texte_norm.decode('utf-8')              print texte_norm         #feat.SetField(fld_shp, texte_norm)          #- print EndOfScript message     print EndOfScript()      I've put a print instead of the SetField just so I could see if the replace works. Then the script encounters the first unicode character, I have this error message: 'ascii' codec can't decode byte 0xc3 in position 5: ordinal not in range(128). Well, I know that, since the character is a "À". I can't seem to find the right way. Any tips? Thanks!


What causes RuntimeError: ERROR 010240 saving after CellStatistics?

I am having trouble saving outputs from CellStatistics but only when I run it on a list of rasters. This was working on python 26 but not 27. I know this example is nonsense, but:               env.workspace =    "G:\\Faculty\\Mann\\Historic_BCM\\Aggregated1080\\"      relevant_tifnames_year_i= ['cwd1975jan.tif', 'cwd1975feb.tif', 'cwd1975mar.tif', 'cwd1975apr.tif', 'cwd1975may.tif', 'cwd1975jun.tif', 'cwd1975jul.tif', 'cwd1975aug.tif', 'cwd1975sep.tif', 'cwd1975oct.tif', 'cwd1975nov.tif', 'cwd1975dec.tif']          mean = CellStatistics(relevant_tifnames_year_i, "MEAN", "DATA")     mean.save(str(env.workspace)+"outa.tif")          sd = CellStatistics(relevant_tifnames_year_i, "STD", "DATA")     sd.save(str(env.workspace)+"outb.tif")          Atest= CellStatistics([mean,sd], "MEAN", "DATA")     Atest.save(str(env.workspace)+"outc.tif")          Traceback (most recent call last):       File "<pyshell#81>", line 1, in <module>         Atest.save(str(env.workspace)+"out3.tif")     RuntimeError: ERROR 010240: Could not save raster dataset to G:\Faculty\Mann\Historic_BCM\Aggregated1080\Scratch\meanc_ras3 with output format GRID.      Notice that I can save CellStats run on a list of files from my working directory, but not on a list made up of my intermediate inputs "sd" and "mean". I know that I can run it if I pass the file paths, but in my actual code I need to run it off of intermediate inputs. Am I missing something here? Note: Overwrite = True has been set. There are no files with the same name in the output folder etc. Here is the actual code (storing rasters to a list and then running CellStats)               for year in base_year:         # paths for files         relevant_tifnames_year = [v for v in relevant_tifnames if int(re.sub('[^0-9]','',v) or 0) >= year and int(re.sub('[^0-9]','',v) or 0) <= year+years_to_end ]         #list to store annual means         decadal_holder_Amn = []               # for each period of interest         for year_i in range(year, (year+years_to_end+1)):            # get relevant paths            relevant_tifnames_year_i = filter(lambda x: str(year_i) in x,relevant_tifnames_year)            #calc annual mean            mean = CellStatistics(relevant_tifnames_year_i, "MEAN", "DATA")            #append mean mean to list of annual means            decadal_holder_Amn.append(mean)         #calc mean of annual means for the decade         Amean=CellStatistics(decadal_holder_Amn, "MEAN", "DATA")         Amean.save(str(env.workspace)+"outd.tif")


Why does ogr's CreateLayer() return None?

Why does ogr's driver method `CreateLayer` return `None`? I'm using python 2.7 with gdal 1.9.1.               path = r'D:\_tempAuto'     out_shp = '%s\test_OGR.shp' % (path,)      driver = ogr.GetDriverByName('ESRI Shapefile')     ds = driver.CreateDataSource(out_shp)     layer = ds.CreateLayer('test_OGR', geom_type=ogr.wkbLineString)          >>> ds     <osgeo.ogr.DataSource; proxy of <Swig Object of type 'OGRDataSourceShadow      *' at 0x00C71638> >          type(layer)     <type 'NoneType'>


How to automatically reloaded raster layer if source is changed in QGIS?

How to automatically reloaded raster layer if source is changed? (The path is the same but inside source file are changes) I use:                qgis.utils.iface.mapCanvas().refresh()      but layer not refresh. # # # The maps are repainting but there are still the same image (source file is changed on disc) I use:                 layers = qgis.utils.iface.legendInterface().layers()       for layer in layers:           layer.triggerRepaint()


Cannot get arcpy.MosiacToNewRaster to work with list

Below I have a snippet of a much larger code that I cannot get to work and I am not sure why. It seems that I always have trouble using arcpy functions with rasters. Can anyone help me get this code to work? Thanks!               outpath = 'G:\\PROJECTS\\Cedar\\Environmental\\FEMA\\Results\\Processing.gdb'     arcpy.env.workspace = outpath          # List the relative elevation rasters in gdb and Mosiac     rasters = arcpy.ListRasters('Rel_elv*')     arcpy.MosaicToNewRaster_management(rasters, outpath, 'Relative')      I have tried all sorts of different ways to do this and the mosiac to new raster function does not seem to like my list.


ArcObjects + comtypes at 10.1

Has anyone played around with using ArcObjects in Python at version 10.1? I am having all sorts of problems, such as `TypeError`s when wrapping the ESRI OLB modules and `AttributeError`s when attempting to use a method or property of a wrapped module. Anyone had any better luck?


Official source for QGIS icons or banners?

I am going to use maps and analysis results generated by QGIS in a presentation. Besides citing the official reference i want to show a small QGIS icon or Banner on the first slide.   I found some nice examples on the net (1)(2), but i wonder if there is an official source providing a QGIS (and maybe GRASS) icon for such purposes ?


Select by attribute expression invalid in python

I'm not sure how my expression is failing. Any ideas?               inPoints = "points.shp"     i = 0     arcpy.MakeFeatureLayer_management(inPoints, "pts")     arcpy.SelectLayerByAttribute_management("pts", "NEW_SELECTION", '\"FID\" = i')


How to do a "fuzzy" intersection?

I have two layers that look like this: ![before1](http://i.stack.imgur.com/HTPZC.png) I want the intersection (or whatever the correct term may be) to look like this where the output polygons are the same as the original base layer, just with added attributes if there is any kind of intersection. Preferably, there'd be a way to say something like, if there is over 50% coverage, take the property, if not, no property. ![after1](http://i.stack.imgur.com/cCcUc.png) Similarly, this area has a lot of intersections where it shouldn't. (The C4 applies to the dark shapes and the numbers apply to the lighter shapes. The darker wide line is where the two number polygons overlap.) ![before2](http://i.stack.imgur.com/UbXdd.png) Ideally, the "fuzzy" intersection would work similarly here where the polygon below gets the added property of the polygon above that overlaps the most with it. Again, the output should be with the same polygon shapes as the base layer. ![after2](http://i.stack.imgur.com/bN4nv.png) How can I achieve these results? I've looked into Union, Intersect, Clip, Identity and such, but none seem to be right. Perhaps there is an option in one of these that I am missing? I can use either ArcGIS or QGIS.


Geoprocessing service failure

I have a python script tool that I have published to a geoprocessing service. Every time I run the service it fails. Here's what I'm getting for errors: ![enter image description here](http://i.stack.imgur.com/IqE3V.png) The python code in the tool is below:               import arcpy, arcgisscripting, sys, os     MapIndexFC = r'C:\Users\p04729\AppData\Roaming\ESRI\Desktop10.2\ArcCatalog\Testing.sde\MapSets_D04_ALL_HFs_MapIndex_WGS84'     MapIndexLyr = r'\\sv04esri\Records\GIS\MapSheetImages\MapIndexSelected.lyr'     ImageOutput = r'\\sv04esri\Records\GIS\MapSheetImages\Testing.gdb\Image.lyr'     MI_FC_field = 'filename'     out_buffer_FC = r'C:\Users\p04729\AppData\Roaming\ESRI\Desktop10.2\ArcCatalog\Testing.sde\Buffer'     MapIndexSelect = r'C:\Users\p04729\AppData\Roaming\ESRI\Desktop10.2\ArcCatalog\Testing.sde\Selected_Features'               arcpy.env.overwriteOutput = True          Input = arcpy.GetParameterAsText(0)     Fset = arcpy.FeatureSet()     Fset.load(Input)          arcpy.Buffer_analysis(Fset,out_buffer_FC,'5 FEET','FULL','ROUND','ALL')          arcpy.MakeFeatureLayer_management(MapIndexFC,MapIndexLyr)          arcpy.AddMessage('selecting features in Map Index layer...')     arcpy.SelectLayerByLocation_management(MapIndexLyr,'INTERSECT',out_buffer_FC)          matchcount = int(arcpy.GetCount_management(MapIndexLyr).getOutput(0))     if matchcount == 0:         print('no Map Index features were selected...')         arcpy.AddError('You must select a feature from the Map Index layer, exiting script')         sys.exit()     else:         arcpy.CopyFeatures_management(MapIndexLyr, MapIndexSelect)              for row in arcpy.da.SearchCursor(MapIndexSelect,MI_FC_field):             selected_val = row[0]             img_name = selected_val.split('.')[0]             arcpy.AddMessage('iterating over selected Map Index features. ..')             arcpy.AddMessage('looking for image...')             for dirpath, dirnames, filenames in os.walk(r'\\sv04esri\Records\GIS\MapSheetImages'):                 for file in filenames:                     if file.endswith('.tif') or file.endswith('.sid'):                         if img_name in file:                             Out = arcpy.MakeRasterLayer_management(dirpath+'\\'+file)                             arcpy.SetParameter(1,Out)              del row, selected_val, img_name      The error is telling me that my Buffer output does not exist or is not supported. I know it does exist, and I'm unsure why it would not be supported?


ArcObjects SDK Server toolbox

Seems to be a recurring nightmare here, but it seems ESRI UK gave us a bum steer. You do not need to install ArcObjects .NET SDK (and, of course, the obligatory VS IDE), but you do need to have an installation of one of the desktop products in order to be able to use the dlls. Heres a link to the help page, but it appears you need to have ArcMap/ArcCatalog/etc installed in order to fully be able to deploy any application you've developed using ArcObjects? Is this insanity on my part? I would have thought the easiest way would be to bundle the dlls, but am told you can reference the GAC dlls (Not too sure I understand this so a steer would be appreciated). However, ESRI docs seem to clearly state they cannot be deployed without an appropriate ArcGIS Desktop application installed. Surely this is just for custom Desktop tools and not AGS tools? Any ideas?


POST not implemented

I'm developing a client wps modifying the example WPSDemo.js from http://suite.opengeo.org/4.1/processing/wpsclient/index.html . I'm using zoo- project as WPS server. I'm trying to invoke the "buffer" process implemented in GRASS GIS gives me the following error:               POST http://localhost:9080/proxy/?url=http%3A%2F%2Flocalhost%2Fcgi-bin%2Fzoo_loader.cgi%3F 501 (Not Implemented)      The query POST is:               <wps:Execute xmlns:wps="http://www.opengis.net/wps/1.0.0" version="1.0.0" service="WPS" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">     <ows:Identifier xmlns:ows="http://www.opengis.net/ows/1.1">v_buffer</ows:Identifier>     <wps:DataInputs>         <wps:Input>             <ows:Identifier xmlns:ows="http://www.opengis.net/ows/1.1">input</ows:Identifier>             <ows:Title xmlns:ows="http://www.opengis.net/ows/1.1">Or data source for direct OGR access</ows:Title>             <wps:Data>                 <wps:ComplexData mimeType="text/xml"><![CDATA[<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs"><gml:featureMember xmlns:gml="http://www.opengis.net/gml"><feature:features xmlns:feature="http://mapserver.gis.umn.edu/mapserver" fid="OpenLayers_Feature_Vector_248"><feature:geometry><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates decimal="." cs="," ts=" ">-6383273.5489707,1396657.4552779 -4230806.8327598,26905.908598173 -6246298.3943028,-442723.19312058 -6383273.5489707,1396657.4552779</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></feature:geometry></feature:features></gml:featureMember></wfs:FeatureCollection>]]></wps:ComplexData>             </wps:Data>         </wps:Input>         <wps:Input>             <ows:Identifier xmlns:ows="http://www.opengis.net/ows/1.1">layer</ows:Identifier>             <ows:Title xmlns:ows="http://www.opengis.net/ows/1.1">A single vector map can be connected to multiple database tables. This number determines which table to use. When used with direct OGR access this is the layer name.</ows:Title>             <wps:Data>                 <wps:LiteralData />             </wps:Data>         </wps:Input>         <wps:Input>             <ows:Identifier xmlns:ows="http://www.opengis.net/ows/1.1">cats</ows:Identifier>             <ows:Title xmlns:ows="http://www.opengis.net/ows/1.1">Example: 1,3,7-9,13</ows:Title>             <wps:Data>                 <wps:LiteralData />             </wps:Data>         </wps:Input>         <wps:Input>             <ows:Identifier xmlns:ows="http://www.opengis.net/ows/1.1">where</ows:Identifier>             <ows:Title xmlns:ows="http://www.opengis.net/ows/1.1">Example: income  1000 and inhab :: 10000</ows:Title>             <wps:Data>                 <wps:LiteralData />             </wps:Data>         </wps:Input>         <wps:Input>             <ows:Identifier xmlns:ows="http://www.opengis.net/ows/1.1">type</ows:Identifier>             <ows:Title xmlns:ows="http://www.opengis.net/ows/1.1">Feature type</ows:Title>             <wps:Data>                 <wps:LiteralData />             </wps:Data>         </wps:Input>         <wps:Input>             <ows:Identifier xmlns:ows="http://www.opengis.net/ows/1.1">distance</ows:Identifier>             <ows:Title xmlns:ows="http://www.opengis.net/ows/1.1">Buffer distance along major axis in map units</ows:Title>             <wps:Data>                 <wps:LiteralData>195678.7923828125</wps:LiteralData>             </wps:Data>         </wps:Input>         <wps:Input>             <ows:Identifier xmlns:ows="http://www.opengis.net/ows/1.1">minordistance</ows:Identifier>             <ows:Title xmlns:ows="http://www.opengis.net/ows/1.1">Buffer distance along minor axis in map units</ows:Title>             <wps:Data>                 <wps:LiteralData />             </wps:Data>         </wps:Input>         <wps:Input>             <ows:Identifier xmlns:ows="http://www.opengis.net/ows/1.1">angle</ows:Identifier>             <ows:Title xmlns:ows="http://www.opengis.net/ows/1.1">Angle of major axis in degrees</ows:Title>             <wps:Data>                 <wps:LiteralData />             </wps:Data>         </wps:Input>         <wps:Input>             <ows:Identifier xmlns:ows="http://www.opengis.net/ows/1.1">bufcolumn</ows:Identifier>             <ows:Title xmlns:ows="http://www.opengis.net/ows/1.1">Name of column to use for buffer distances</ows:Title>             <wps:Data>                 <wps:LiteralData />             </wps:Data>         </wps:Input>         <wps:Input>             <ows:Identifier xmlns:ows="http://www.opengis.net/ows/1.1">scale</ows:Identifier>             <ows:Title xmlns:ows="http://www.opengis.net/ows/1.1">Scaling factor for attribute column values</ows:Title>             <wps:Data>                 <wps:LiteralData />             </wps:Data>         </wps:Input>         <wps:Input>             <ows:Identifier xmlns:ows="http://www.opengis.net/ows/1.1">tolerance</ows:Identifier>             <ows:Title xmlns:ows="http://www.opengis.net/ows/1.1">Maximum distance between theoretical arc and polygon segments as multiple of buffer</ows:Title>             <wps:Data>                 <wps:LiteralData />             </wps:Data>         </wps:Input>         <wps:Input>             <ows:Identifier xmlns:ows="http://www.opengis.net/ows/1.1">-s</ows:Identifier>             <ows:Title xmlns:ows="http://www.opengis.net/ows/1.1">Make outside corners straight</ows:Title>             <wps:Data>                 <wps:LiteralData />             </wps:Data>         </wps:Input>         <wps:Input>             <ows:Identifier xmlns:ows="http://www.opengis.net/ows/1.1">-c</ows:Identifier>             <ows:Title xmlns:ows="http://www.opengis.net/ows/1.1">Dont make caps at the ends of polylines</ows:Title>             <wps:Data>                 <wps:LiteralData />             </wps:Data>         </wps:Input>         <wps:Input>             <ows:Identifier xmlns:ows="http://www.opengis.net/ows/1.1">-t</ows:Identifier>             <ows:Title xmlns:ows="http://www.opengis.net/ows/1.1">Transfer categories and attributes</ows:Title>             <wps:Data>                 <wps:LiteralData />             </wps:Data>         </wps:Input>     </wps:DataInputs>     <wps:ResponseForm>         <wps:RawDataOutput mimeType="text/xml">             <ows:Identifier xmlns:ows="http://www.opengis.net/ows/1.1">output</ows:Identifier>         </wps:RawDataOutput>     </wps:ResponseForm>


Editing KML breaks icons

Edit: Solved it. When I was creating my new zip/kmz my code was creating various folders within the zip/kmz. Changed: NewZip.write(addedfile) to: NewZip.write(addedfile, newfl) /Edit I have KMZs that need changes to their points. The changes are simply updating their attributes - changing the values in the tables that appear when a point is clicked. My method involves extracting the files from the KMZ to a temp location, making a copy of the "doc.kml", digging through the copied "doc.kml" for instances of text that needs to be changed, and then renaming the old KMZ, creating a new KMZ with the same name as the original, and adding the all the files (including my edited "doc.kml") to the new KMZ. I have automated this process with a pthython script, but when I run it, any KMZs that gets updated have broken point icons. i can't find anything that would cause this - my changes are quite minimal and do not replace and obvious KML. Changes are formatted: "PR_A_1567_20" to "PR_AB_1567_20", so essentially I am adding an extra letter into a few lines of the KML. Anyone know why this might break icons? Everything else still functions perfectly. Thanks. Edit: Simpler question: Why does this KMZ work: https://drive.google.com/file/d/0B9n9YNu8ulsmb1ljQmJMdW5QQXc/edit?usp=sharing But not this one: https://drive.google.com/file/d/0B9n9YNu8ulsmLXYwNkpIQlY2STg/edit?usp=sharing /Edit Code:               import os     import zipfile     import arcpy          folder =r"C:\KMZTest"     table = r"C:\ProjectNumberSwitch_20140729.xlsx\C_Projects_Being_Switched$"     tblcolm = "Old_P6_NBR"     temploc = r"C:\KMZTest\Temp"          oldP6list = []     print "Finding project numbers"     cursor = arcpy.da.SearchCursor(table, tblcolm)     for row in cursor:         oldP6list.append(row[0])     del row     del cursor          updatedlist = []     for root, dirs, files in os.walk(folder):         for fil in files:             if "Projects.kmz" in fil or "Points.kmz" in fil:                 print                 print fil                 print                 flpath = os.path.join (root, fil)                 zipfl = zipfile.ZipFile(flpath)                 foundoldP6 = False                 for content in zipfl.namelist():                     zipfl.extract(content, temploc)                     if content == "doc.kml":                         doc = os.path.join(temploc, content)                         os.rename(doc, doc + ".tmp")                         destination = open(doc, "w")                         source = open(doc + ".tmp", "r")                         for line in source:                             for oldP6 in oldP6list:                                 if oldP6 in line:                                     foundoldP6 = True                                     print "found:", oldP6                                     line = (line.replace(oldP6, oldP6.split("C")[0] + "VC" + oldP6.split("C")[1]))                             destination.write(line)                         source.close()                         destination.close()                 zipfl.close()                 if foundoldP6 == True:                     print "Updating", fil                     updatedlist.append(fil)                     os.rename(flpath, flpath + ".tmp")                     NewZip = zipfile.ZipFile(flpath, "w")                     for newfl in os.listdir(temploc):                         if not newfl.endswith(".tmp"):                             addedfile = os.path.join (temploc, newfl)                             NewZip.write(addedfile)                                        os.remove(flpath + ".tmp")                 for oldfile in os.listdir(temploc):                     os.remove (os.path.join(temploc, oldfile))     print     print     print "Updated:"     for update in updatedlist:         print update          print     print "Done"


How can I programatically register a feature class as versioned

Is there a way to programatically register a feature class as versioned? I'm able to register a`FeatureDataset`with the IVersionObject3 interface, but not an individual feature class.


Selection on Feature layer (geoprocessing)

I have a feature layers with states and counties fields. I want to make a selection tool. Tool dialog should have input for feature layer and two drop downboxes for states and counties. When user gives input feature layer, states drop downbox should get updated with unique values fron states column so that user can select state. And when user select state the counties dropdown box should get updated with the counties of the selected state, so user can select county from the selected state only. After that when user click on ok button the respective county should get selected on map. Can anyone please tell me how can I achieve this using model builder or python script in arcgis desktop?


Which class should I use to work with vector layers?

I'm doing different operations on vector layers. Kindly suggest which class should I use for vector layer i.e QgsVectorLayer or QgsVectorLayerDataProvider.


How to load Shapefiles into a remote PostGIS db using command line?

Can we import a Shapefile from a system which doesn't have PostgreSQL installed (client machine) into a system having PostGIS installed? I am getting problem with 'shp2pgsql' and 'psql' since both are not recognized on the client machine. I am trying this using console.


How to compute mean coordinates?

Can anybody explain how to compute mean coordinates? Regards.


How to batch export layers to kml in Arcmap?

Is there a way to export layers to KML by altering the layer to KML tool to have more than one layer input?


How to edit feature attributes with openlayers?

I want to edit object's attributes on WFS layer. I see this example http://gis.ibbeck.de/ginfo/apps/OLExamples/OL26/examples/styles_unique_with_group_wfs.html but popup is horrible. I want to use ExtJs form to editing.   So how to edit attributes in this case?


Execute Spyder within Grass GIS

I'm using GRASS Gis with a small Python script. Is there a way (for windows users) to use the sypder ide within grass? I looked at http://grasswiki.osgeo.org/wiki/Tools_for_Python_programming but there is only the command for linux (spyder -w . 2>/dev/null &) It would be great, if someone can post an small how-to to start spyder within grass. Thanks alot! Friedrich


How can I get SOESupport to handle Polymorphism?

I've got some business objects below that I can serialize and deserialize successfully with Json.NET. I don't see a simple way to do this with Esri's SOESupport however. I'm happy with Json.NET, but I'd like to leverage Esri's IGeometry conversion routines. Is there some way to get SOESupport to work for this? **Update:** Since it doesn't look like Esri can do this, I'm trying to use Json.NET. See my related issue on stackoverflow: How can I deserialize with TypeNameHandling.Objects in Json.NET Silverlight?               public class Animal     {         public string Name { get; set; }     }     public class Dog: Animal      {         public bool LikesBones { get; set; }     }     public class Cat: Animal      {         public bool LikesMice { get; set; }     }     public class Zoo     {         public int ID { get; set; }         private List<Animal> m_Animals = new List<Animal>();         public List<Animal> Animals { get { return m_Animals; } set { m_Animals = value; } }     }      Is there some way to get Esri's JsonObject to support this sort of test?               public static void Test1()     {         // use Json.NET         Zoo z1 = new Zoo() { ID = 1 };         z1.Animals.Add(new Dog() { Name = "Fido", LikesBones = true });         z1.Animals.Add(new Cat() { Name = "Felix", LikesMice = false });         string s1 = Util.Serialize(z1);                              Debug.Print(s1);         var z2 = Util.Deserialize<Zoo>(s1);         string s2 = Util.Serialize(z2);         Debug.Print(s2);         if (s1 != s2)             Debug.Print("failed");         else             Debug.Print("ok");     }      I can apply settings in Json.NET that force the typename to be serialized, allowing polymorphism for the list of Animals. How can I implement these same functions with SOESupport?               public static string Serialize(object o)     {         JsonSerializerSettings settings = new JsonSerializerSettings();         settings.TypeNameHandling = TypeNameHandling.Objects;         return JsonConvert.SerializeObject(o, Formatting.Indented, settings);     }     public static T Deserialize<T>(string s)     {         JsonSerializerSettings settings = new JsonSerializerSettings();         settings.TypeNameHandling = TypeNameHandling.Objects;         return JsonConvert.DeserializeObject<T>(s,settings);     }


geoserver wfs insert error

I keep getting an insert error from geoserver when trying to save a point, poly etc etc to my postgis table. any ideas, my code is below                   var Projection = new OpenLayers.Projection("EPSG:4326");               var map = new OpenLayers.Map("Map", {             //projection: new OpenLayers.Projection("EPSG:900913"),             displayProjection:Projection,             controls:[]             }         );              //add google map         var GoogleMap = new OpenLayers.Layer.Google(             "GoogleSatellite",{                 type:G_SATELLITE_MAP,                 isBaseLayer:true,                 sphericalMercator:true,                 maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34),                 numZoomLevels: 21               }          );                var NYC = new OpenLayers.Layer.WMS(           "nyc_buildings - Tiled", "http://soiisdev:8080/geoserver/wms",             {                 layers: 'cite:nyc_buildings',                 styles: '',                 format: "image/png",                 tiled: 'true',                 transparent: true,                 Projection:Projection              },             {                 buffer: 0,                 displayOutsideMaxExtent: true             }                       );              var saveStrategy = new OpenLayers.Strategy.Save({auto:true})              var vectors = new OpenLayers.Layer.Vector("Vectors", {             strategies: [                 new OpenLayers.Strategy.BBOX(),                  saveStrategy             ],             Projection:Projection,              protocol: new OpenLayers.Protocol.WFS({                 version: "1.1.0",                  url:  "http://soiisdev:8080/geoserver/wfs",                 featureNS : "http://www.opengeospatial.net/cite",                  featureType: "nyc_vectors",                 srsName: "EPSG:4326"             })         });              map.addLayers([GoogleMap, NYC, vectors]);          //map.zoomToMaxExtent();              var LonLat = new OpenLayers.LonLat(-73.988113, 40.750898);         LonLat.transform(Projection, map.getProjectionObject());           map.setCenter(LonLat, 15);       ive checked the header in fiddler and below is the xml sent to geoserver               <wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.1.0"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation="http://www.opengis.net/wfs  http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">     <wfs:Insert>      <feature:nyc_vectors xmlns:feature="http://www.opengeospatial.net/cite">        <feature:the_geom>          <gml:Point xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326">            <gml:pos>-73.986374928559 40.742379645006</gml:pos>          </gml:Point>        </feature:the_geom>      </feature:nyc_vectors>


GRASS module g.copy returns irrational outputs

I took this as reference, Moving raster to different mapset GRASS GIS, and I use **pyscripter** to use GRASS module **g.copy** from outside,               import os     import sys          #set up GRASS environment variables     sys.path.append(os.path.join(os.environ['GISBASE'], 'etc', 'python'))     import grass.script as g     import grass.script.setup as gsetup     gisbase = os.environ['GISBASE']     gisdb = 'C:\Users\Heinz\Documents\grassdata'     location = 'newLocation'     mapset = 'watershed_analysis'     gsetup.init(gisbase, gisdb, location, mapset)          #copy raster data     g.run_command('g.copy', rast = 'hc@TC, hc')          #check result     print g.read_command('g.list', _type = 'rast')      The output is raster files in mapset PERMANENT, thus not what I want. (current mapset is watershed_analysis)               *** Remote Interpreter Reinitialized  ***     >>>      ----------------------------------------------          raster files available in mapset <PERMANENT>:     hc          ----------------------------------------------      Seems I don't successfully copy the raster file to the mapset I want. How to fix this problem？ I am using GRASS 6.4.3, python 2.7.6 under Windows 8.1 x64. * * * **Update#1** @gene, I do the same thing in the python shell of the GRASS layer manager,               Python 2.7.4 (default, Apr  6 2013, 19:54:46) [MSC v.1500 32 bit (Intel)] on win32     Type "help", "copyright", "credits" or "license" for more information.     >>>import grass.script as g     >>>g.run_command('g.copy', rast = 'acc@TC, acc@watershed_analysis')     0          >>>g.read_command('g.list', _type = 'rast')     ----------------------------------------------          raster files available in mapset <PERMANENT>:     hc          ----------------------------------------------          g.read_command('g.mlist', _type = 'rast')     hc      In the output above, I want to copy the file **acc** from mapset TC to current mapset watershed_analysis, but the output still tells me about another mapset. (g.list and g.mlist outputs the same except the later one wouldn't tell me the info of mapset.) **And I go to check results in the file of this mapset, there are no new file copied to it.** Maybe there are problems in my script. * * * **Update#2** If I tried the module in GRASS GUI, here's result, ![enter image description here](http://i.stack.imgur.com/SrRkM.png) ![enter image description here](http://i.stack.imgur.com/VoFxb.png) No output but the error message,               Traceback (most recent call last):               File "C:\OSGeo4W\apps\grass\grass-6.4.3\etc\wxpython\gui_c     ore\forms.py", line 655, in OnRun          self.goutput.RunCmd(cmd, onDone = self.OnDone)       File "C:\OSGeo4W\apps\grass\grass-6.4.3\etc\wxpython\gui_c     ore\goutput.py", line 554, in RunCmd          task = GUI(show = None).ParseCommand(command)       File "C:\OSGeo4W\apps\grass\grass-6.4.3\etc\wxpython\gui_c     ore\forms.py", line 1871, in ParseCommand          blackList = _blackList)       File "C:\OSGeo4W\apps\grass\grass-6.4.3\etc\python\grass\s     cript\task.py", line 470, in parse_interface          tree = etree.fromstring(get_interface_description(name))       File     "C:\OSGeo4W\apps\Python27\lib\xml\etree\ElementTree.py",     line 1300, in XML          parser.feed(text)       File     "C:\OSGeo4W\apps\Python27\lib\xml\etree\ElementTree.py",     line 1642, in feed          self._raiseerror(v)       File     "C:\OSGeo4W\apps\Python27\lib\xml\etree\ElementTree.py",     line 1506, in _raiseerror          raise err     xml.etree.ElementTree     .     ParseError     :     unknown encoding: line 1, column 30      I don't know if I did something wrong in inputs.


Problem with Command Console (GRASS GIS 7.0,0 beta2 on Windows 8.1)

I have a problem with Command Console. When I do for example, `File-> Map display-> Add raster-> elevation`, it works. But when I write into Command Console `d.rast map=elevation@PERMANENT`, it shows this error. Any help would be greatly appreciated. Thank you.               Traceback (most recent call last):       File "C:\Program Files (x86)\GRASS GIS     7.0.0beta2\etc\gui\wxpython\gui_core\prompt.py", line 262,     in OnItemSelected          self.cmdDesc = gtask.parse_interface(GetRealCmd(cmd))       File "C:\Program Files (x86)\GRASS GIS     7.0.0beta2\etc\python\grass\script\task.py", line 505, in     parse_interface          tree = etree.fromstring(get_interface_description(name))       File "C:\Program Files (x86)\GRASS GIS     7.0.0beta2\etc\python\grass\script\task.py", line 465, in     get_interface_description          stderr = PIPE)       File "C:\Program Files (x86)\GRASS GIS     7.0.0beta2\etc\python\grass\script\core.py", line 55, in     __init__          fcmd = get_real_command(args[0])       File "C:\Program Files (x86)\GRASS GIS     7.0.0beta2\etc\python\grass\script\core.py", line 261, in     get_real_command          full_path = shutil_which(cmd + '.py')       File "C:\Program Files (x86)\GRASS GIS     7.0.0beta2\etc\python\grass\script\core.py", line 223, in     shutil_which          name = os.path.join(dir, thefile)       File "C:\Program Files (x86)\GRASS GIS     7.0.0beta2\Python27\lib\ntpath.py", line 108, in join          path += "\\" + b     UnicodeDecodeError     :     'ascii' codec can't decode byte 0xbc in position 9: ordinal     not in range(128)


Python for loop doesn't work for Spatial ETL Tool

I've created a Spatial ETL tool from ArcGIS 10.1 and would like to run this tool to all 200 featureclasses in a geodatabase. Therefore, I've written a python script to do this automation. (btw, i'm new to arcpy) However, I get an error message stating that my featureclasses do not exist in the geodabase. It does exist though. "Failed to execute. Parameters are not valid. 'Export1' does not exist. Failed to execute (SpatialETLTool152)" I couldn't find any solution on the internet.               `import arcpy, os     from arcpy import env          arcpy.ImportToolbox("M:/GIS-Data/Poin2Line.tbx")          env.workspace = r"L:\\ExportLines\\Test.gdb"     FakeTide_All1_tif = r"L:\\ExportLines\\FakeTide.tif"     Test_gdb = r"L:\\ExportLines\\Test.gdb"     Destination_Comma_Separated_Value__CSV__Directory_ = r"L:\\ExportLines\\Output"     fClass = arcpy.ListFeatureClasses()          for fc in fClass:         arcpy.gp.toolbox = "M:/00-GIS-Data-4-All/Poin2Line.tbx";     #arguments (Tiff, output, input)         arcpy.gp.SpatialETLTool152("'L:\\ExportLines\\FakeTide.tif'", Destination_Comma_Separated_Value__CSV__Directory_, fc )`


esri map popup problem

My map works fine. Popup works fine. For some reason, the bottom of the popup window has some layout issues. I have all the resources included. script:               dojo.require("esri.map");     dojo.require("esri.dijit.Popup");      And css:               <link rel="stylesheet" href="css/esri.css" type="text/css">     <link rel="stylesheet" href="css/Popup.css" type="text/css">      ![Bottom is incorrectly displayed](http://i.stack.imgur.com/ZgWH7.png) Do you have any suggestions on how I could debug this issue? Thanks.


How to get 2010 Census Block Data on Race and Age?

I'm interested in observing racial segregation in public & charter elementary schools in San Diego city (not county). I believe the best way to analyze this would be at the block level and have the following questions: 1) I played around with Fact Finder to get San Diego county by race at the block level, but I only want city. How do I get the city level only? 2) What do I do with the data to get forward in my project? Join it through Access? 3) What's the difference in analyzing at the block level versus block group level? 4) Can I get this same data (race and age) from ACS versus AFF?


GDAL polygonize lines

I have a raster file containing roads (left image). I polygonize the raster file with GDAL (see the script below). In the end I like to have vector lines. However GDAL only gives me something like this back (right image). Obviously this is correct, since polygonize creates polygons. Is there a way to "linize" a raster? ![enter image description here](http://i.stack.imgur.com/IWDYO.png) Here is my code:               import gdal,ogr,os          # open raster file     raster = gdal.Open('test.tif')     band = raster.GetRasterBand(1)          #create new shp file     newSHPfn = 'test.shp'     shpDriver = ogr.GetDriverByName("ESRI Shapefile")     if os.path.exists(newSHPfn):         shpDriver.DeleteDataSource(newSHPfn)     outDataSource = shpDriver.CreateDataSource(newSHPfn)     outLayer = outDataSource.CreateLayer(newSHPfn, geom_type=ogr.wkbLineString )          # polygonize     gdal.Polygonize(band, None, outLayer, 1)


Automate database conversion from NAD83 to Web Mercator

A NAD83 database is updated daily while a Web Mercator clone is only update when time is available. Looking to automate this process of   * Copying Layers   * Projecting them to Web Mercator   * Placing in correct .SDE What would be the best way to do this? FME, model builder, python? Thanks


QGIS 2.0.1-3 not opening

I've excitedly just downloaded the latest version of QGIS 2.0.1-3 (QGIS Dufour) and now it won't open. I performed the exact same process last night (without problem) on my home laptop (64-bit OS & windows 7) using the correct installer package. Why wont this open now! Lisboa, (1.8.1 I think) worked fine. My computer is 64-bit OS and Windows 7. Edits:   1. Have now tried the 32-bit version. Completely unresponsive. It went through an extra step during the install procedure loading a C++ package (from 2005). Other than that I'm still having the same problem.


How are EGM96 and WGS84 related to each other?

As far as I understand the EGM96 defines the Geoid, where as the WGS84 Standard defines the Ellipsoid. Is the ellipsoid defined in the WGS84 standard defined in a way to maximize the congruency with the the geoid defined in the EGM96 standard?


3D Polygon Layer Stack with QGIS

I was curious if there is a way, or plugin to visualize a 3D polygon layer stack in QGIS (or another open source package). I have looked at NViz, but it only seems to work for rasters. I have a building floor plan with Z info for each floor. In ArcScene you can import the data and it will "stack" the layers in the Z axis. I am hoping to be able to complete this in something other than ESRI. Any help is appreciated... Thanks.... ![3D Polygon Layer Stack](http://i.stack.imgur.com/FIa1t.jpg)


Is it possible to have self intersecting polygons in GML or shapefile?

GIS vector data for example GML or shapefile contains polygonal data. Lets assume, we have polygon A which has self-intersection which means that the edges in this polygon intersect with each other. Lets say if we want to intersect A with polygon B, then the steps of computing the overlaid polygon differs whether A is a polygon with self-intersections or not. My question is do the polygons in one map layer have self-intersections or not? I searched for this question on internet and I found couple of instances where people complain about error caused while importing data due to the presence of self- intersecting polygons. Also I got the impression that self intersecting polygons are not possible in certain file formats.


Unable to removeLayers from Map

I was trying to create a FeatureLayer from the features returned from the ViewShed GP and I was successful at doing it. So when I click on the map, that featureSet is sent to the GP Tool and the return has all the features and I add it to the map as a FeatureLayer. Now I want to remove the layer when the user clicks again on the map, but strangely, the `map.layerIds` returns, `["layer0"]`, indicating only the basemap. I am not sure how to remove the featureLayer? This is my code,               function init() {         dojo.connect(map, "onClick", computeViewShed);     }          function computeViewShed(evt) {         map.graphics.clear();         map.removeLayer("finalLayer"); //finalLayer is the id that I assigned to the featureLayer that I am adding              var pointSymbol = new esri.symbol.SimpleMarkerSymbol();         pointSymbol.setSize(20);         pointSymbol.setOutline(new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0, 0, 0]), 1));         pointSymbol.setColor(new dojo.Color([0, 0, 255, 0.25]));              var graphic = new esri.Graphic(evt.mapPoint, pointSymbol);         map.graphics.add(graphic);              var features = [];         features.push(graphic);         var featureSet = new esri.tasks.FeatureSet();         featureSet.features = features;         var vsDistance = new esri.tasks.LinearUnit();         vsDistance.distance = 5;         vsDistance.units = "esriMiles";         var params = {             "Input_Observation_Point": featureSet,             "Viewshed_Distance": vsDistance         };         gp.execute(params, drawViewshed);     }          function drawViewshed(results, messages) {         var polySymbol = new esri.symbol.SimpleFillSymbol();         polySymbol.setOutline(new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0, 0, 0, 0.5]), 1));         polySymbol.setColor(new dojo.Color([255, 127, 0, 0.7]));         var features = results[0].value.features;         var layerDefinition = {             "geometryType": "esriGeometryPolygon",             "fields": [{                 "name": "OBJECTID",                 "alias": "ID",                 "type": "esriFieldTypeOID"             }, {                 "name": "grid_code",                 "alias": "Grid Number",                 "type": "esriFieldTypeString"             }, {                 "name": "Shape_Area",                 "alias": "Area",                 "type": "esriFieldTypeNumber"             }]              }         var featureCollection = {             "layerDefinition": layerDefinition,             "featureSet": {                 "features": features,                 "geometryType": "esriGeometryPolygon"             }         };         //create a feature layer based on the feature collection         featureLayer = new esri.layers.FeatureLayer(featureCollection, {             id: 'finalLayer',             mode: esri.layers.FeatureLayer.MODE_SNAPSHOT         });         map.addLayers([featureLayer]);     }


Distance between Paris and San Francisco with PostGis (out of range coordinates?)

SELECT ST_Distance(gg1, gg2) As spheroid_dist, ST_Distance(gg1, gg2, false) As sphere_dist     FROM (SELECT         ST_GeographyFromText('SRID=4326;POINT(37 -122)') As gg1,         ST_GeographyFromText('SRID=4326;POINT(48 2)') As gg2         ) As foo  ;      \--> `ERROR: Coordinate values are out of range [-180 -90, 180 90] for GEOGRAPHY type` I understand those points are pretty distant (San Franciso vs Paris, France), but how can I get the distance calculated between those two?


Sources for long-term NDVI datasets with coverage to west Asia?

I'm in need for long-term NDVI dataset for my research in bio-climatology, looks like GLCF GIMMS are no longer available online, any suggestions/workarounds to get the data. Thanks in advance.


Problem using SLD to style a layer in OpenLayers

I am using and SLD file to add style to my layers but I am hitting a snag and get a "... not defined error". Below is the code which loads my SLD. I get an error on line 10, "styles = sld.namedLayers[pipe_anno].userStyles[0];"               var format = new OpenLayers.Format.SLD();             OpenLayers.Request.GET({                 url: "label.sld",                 success: sldparser             });                  function sldparser(req) {                 sld = format.read(req.responseXML || req.responseText);                 console.log (sld);                 styles = sld.namedLayers[pipe_anno].userStyles[0];                 //console.log (styles);                 pipe_label_stylemap.styleMap.styles.default = styles;             }      Below is the part which add the style:               pipe_layer.styleMap = pipe_label_stylemap;      Below is the relevant SLD snippet:               <?xml version="1.0" encoding="UTF-8"?>     <sld:StyledLayerDescriptor xmlns="http://www.opengis.net/sld"      xmlns:sld="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" version="1.0.0">     <sld:UserLayer>         <sld:LayerFeatureConstraints>             <sld:FeatureTypeConstraint/>         </sld:LayerFeatureConstraints>         <sld:UserStyle>             <sld:Name>pipe_anno</sld:Name>             <sld:Title/>             <sld:FeatureTypeStyle>      Thanks for the help.


JOSM plugin not working

I have been trying to use a PicLayer plugin in the JOSM editor, however after installing the plugin it would never appear in the top menu next to Windows, Audio, Help dropdowns (at least that's where I think it should be). I must say I am a total newbie to JOSM, and I do have no idea on how to even uninstall that plugin, so i could give it another try installing it back (so it hopefully shows now). I'd appreciate any hints on how to uninstall that plugin, thanks. P.S. the reason I came here as opposed to JOSM forums was because they, for some reason have shut down the registration.


QgsRasterLayer::identify() is missing after QGis upgrade to 2.0.1

My Ubuntu has just downloaded the latest version of QGis (1.8 -> 2.01), and my plugin failed with a plenty of bugs due to implemented changes in QGis API. I still can not figure out how do I replace the function `QgsRasterLayer::identify()` returning the values of the raster layer bands:               rlayer = QgsRasterLayer(rlayer_path, rlayer_basebame)       val = rlayer.identify(QgsPoint(current_point.x, current_point.y))[1]      What should I use instead of the one? Thank you


ArcGIS runtime SDK 10.1.1 for java does not display anything

I am currently trying to display a map (using OpenStreetMapLayer) and nothing shows up but the esri logo and the OpenStreetMap copyright. I am not getting any error message even if the event mapReady never occurs. I am running the application on a distant server (via Remote Desktop) on Windows Server 2008 R2 Enterprise (SP1) and using the jre 1.7.0_25 x86. Although the SDK version is 10.1.1, an ArcGIS 10.2 application is installed on the server (ArcMap and others). Another strange thing is that even the SDK samples seem to encounter the same issue when run in the same conditions (I cannot try on another PC). See the screenshot below: ![SDK sample displaying nothing](http://i.stack.imgur.com/ZS4rA.png) I have been searching the web for two days but found nothing and, as there are no error messages, I ran out of ideas to google.


Issues with Selection and Viewing of Attribute Table using QGIS and SQL Server Express 2008 R2

I am having issues with Selection using QGIS 2.0.1. Dufour. When I select one point, all of the points get highlighted. Attribute Table dialog shows Errors for all of the attributes. It indicates that Features total:12691, filtered:12691, selected: 1. Has anyone else experienced this issue?


Importation of .csv on grass gis converts numeric data to string data

When importing a csv file on grass7, the numeric data is converted into a data of type string. My csv looks like this :                   id_core value     1   F1  83.0611472396      2   F2  98.8584345936     3   F3  102.0621496367     4   F4  95.4304750175     ...      The command I use is : `db.in.ogr dsn=my_file.csv output=my_table` which displays the following message :               WARNING: Width for column field_1 set to 255 (was not specified by OGR),              some strings may be truncated!     WARNING: Width for column id_core set to 255 (was not specified by OGR), some              strings may be truncated!     WARNING: Width for column value set to 255 (was not specified by OGR), some              strings may be truncated!     WARNING: 50 features without geometry     Imported table <my_table> with 50 rows      And `db.describe -c table=my_table` returns :               ncols: 3     nrows: 50     Column 1: field_1:TEXT:1000     Column 2: core:TEXT:1000     Column 3: stock:TEXT:1000      I tried to import the .csv without the header, or with only 2 decimal places on the values. I also tried to import an sqlite file (that I created with with libreoffice base) but the output is identical. Does anyone has a suggestion for specifying that some fields are numeric? Thanks Léo


Rendering temperature on google maps

I have a number of data points in the form of (latitude,longitude,temperature). I am required to render the temperature on a map. The final result should be similar to the the map **here** I used google heat maps for this, and was able to render the data points successfully. The problem however is that the readings are far apart, so each reading appear as a disconnected circle. I could increase the radius of the rendered data points to solve this. My question is: Is google heat map used to render the temperature correctly? or should I use another api? Any advice is highly appreciated.


gdal_translate- why jpg compressed tif is 2 times greater than jpg file?

Using the following two commands yields completely different size files: `gdal_translate test.tif -of GTiff -co "COMPRESS=JPEG" -co "JPEG_QUALITY=100" output.tif` and `gdal_translate test.tif -of JPEG -co "QUALITY=100" -co "WORLDFILE=YES" output.jpg`. (I Wrote the commands from my memory, not sure that the syntax is correct) The jpg file (second command) is 2 times smaller than the compressed tif file. Why? Thanks a lot.


ArcGIS for Server 10.1 (including ArcSDE) and SQL Server 2012 problem with Create Enterprise-Geodatabase

i have the following server system: -Windows Server 2008R2 -SQL Server 2008 (SDE10 Enterprise Geodatabaees) and SQL Server 2012 on the the same machine -ArcSDE Application Server 10  First - Is that right, that i do not need to install the ArcSDE 10.1 for Microsoft SQL Server because we use direct connect on the client ? Now i want to create with ArcGIS 10.1 a new ArcSDE 10.1 Enterprise Geodatabase on SQL Server 2012 with the "create enterprise geodatabase" tool. But i get an error messagge: Unknown errorNo extended error. I look at the sdedc_SQL Server.log: DB_instance_open() db_connect error: -1 CAN'T OPEN INSTANCE: sde:sqlserver. Spatial Engine Connection Failed (-51). Cannot Get Access to Instance sde:sqlserver


Syntax of conditional statements in QGIS Field Calculator(s)

I have a shapefile which I need to modify. There is one column "CLASS" with the attributes: "A", "B" and "C". I need to change "A" into "1!, "B" into "2" and "C" into "3". I tried it with case when function. With one case its not a problem but how does it work with 3 in row? Is it also possible do build a model with the field calculator function? Thank you! * * * I gues I figured it out! Is this right:               CASE       WHEN "VSt_K" IS 'E' THEN '5'       WHEN "VSt_K" IS 'A' THEN '1'       WHEN "VSt_K" IS 'B' THEN '2'       WHEN "VSt_K" IS 'C' THEN '3'     END      But I cant use this in the modeler field calculator function...


What is the right syntax to the decision tree using the Con statement or any other method to classify?

![enter image description here](http://i.stack.imgur.com/cUpY5.jpg) Can you please show me how to construct the decision tree for the attached land cover classification.   I assume it is nested Con statement, but I am confused on how to write the statement.


How to make two raster correlation coefficient map？

![enter image description here](http://i.stack.imgur.com/Y5dgW.jpg) The pictures showed correlation analysis of NDVI and precipitation or temperature. How can I made these pictures in ArcGIS？Or use other ways？The different colors represent different correlation coefficients,from positive,negative…to significant correlation,Highly significant correlation.


Calculate Coordinates with tolerance

I am trying to find the XY coordinates that can be allowed with the tolerance of 2 meters. ![enter image description here](http://i.stack.imgur.com/Qp3an.png) In the above image, When the user(smiley) with GPS reach the ----- border line, the system should understand that user is in the coordinates (with tolerance of 2 meters). How to validate this? Could anyone help me on this?


How to run custom queries on vector layers and display results?

Is there a way to display the result of a query in QGIS? For instance :   * To get the total number of inhabitants : `SELECT SUM( inhabitants ) FROM countries`   * To get the total density : `SELECT SUM(inhabitants)/SUM($area) FROM countries`   * To get the maximal human density : `SELECT MAX( inhabitants/$area) FROM countries` And so on... It looks it is not possible natively, but is there a plugin ? Or a way to do it in python (using the console) ? If so, is there a way to restrict the query to the current selection ? I've found out about the plugin "Statist", which almost does the job, but which does not allow custom queries... * * * Related questions:   * A SQL console in QGIS


How to use Field Calculator to calculate area as percentage?

I am searching for python code to use in Field Calculator to calculate area as a percentage in relation to another field? ![enter image description here](http://i.stack.imgur.com/90YvA.jpg) The area percentage needs be calculated based on the total area for each "Basin_ID" separately.


Large buffers in PostGIS (5000 km radius)

I have a number of points stored as geographies in PostGIS (version 2.0.1), and I'd like to create rather large buffers around them (with a radius of 5000+ km). However, ST_Buffer doesn't handle this case. As the documentation warns, it doesn't work well when you cross the poles or the international dateline, which happens with this very large radius. What can I do instead? I only have 170 points, and this is being done offline, so it doesn't have to be super fast. I'm envisioning creating smaller buffers (which work correctly), and then programmatically extending each of the corners of the resulting polygon outward to approximately the right distance from the point (probably by creating a function in pl/python or something). But it seems like there ought to be a better way. (In case it matters, after creating these buffers I'm unioning them; my use case is to visualize parts of the earth that are not within 5000 km of these points, by filling in the areas that are within that range.)


Fixed Scale / Fixed Zoom in eCognition

i`m wondering if there is any option in eCognition Developer / Architect were I can control Zoom or Scale Factors. It`s neccessary for my work that i use the same scale for all processing steps. Maybe someone can help. Greetz, Stefan


Changing displayed elements of a KML file based on current system time in Google Earth

Is there any way to have Google Earth turn features in a KML file on and off automatically based on the current system time? I have created the simple example below of a rectangle with a `<TimeStamp>` set to end before now, but it displays anyway when I load the file. If I set it for a minute or so in the future then load it and wait, the rectangle doesn't disappear when the system clock rolls past the specified end time.               <?xml version="1.0" encoding="UTF-8" standalone="no"?>     <kml xmlns="http://earth.google.com/kml/2.2">     <Document>       <Placemark>         <TimeSpan>           <end>2013-07-30T22:38:00Z</end>         </TimeSpan>         <Polygon>           <extrude>0</extrude>           <tessellate>1</tessellate>           <altitudeMode>clampToGround</altitudeMode>           <outerBoundaryIs>             <LinearRing>               <coordinates>                 -10,10                 -10,-10                 10,-10                 10,10                 -10,10               </coordinates>             </LinearRing>           </outerBoundaryIs>         </Polygon>       </Placemark>     </Document>     </kml>


How to handle postgresql/postgis geometry type errors in a function?

I have created the following function in PL/SQL to make a polygon from a set of linestrings:               CREATE OR REPLACE FUNCTION _myfunction(         _fid    integer,         _rid    integer          )     RETURNS VOID AS $$      BEGIN             BEGIN             INSERT INTO _data (fid, rid, cost, geom) (             SELECT              _fid,                _rid,             500,              ST_ConcaveHull(ST_Collect(geom), 0.85) As geom             FROM table_distance as d             WHERE _fid = fid);         END;       END;     $$ LANGUAGE plpgsql;      I defined the table that this function inserts data into as:               CREATE TABLE _data (fid integer, rid integer, cost double precision);     SELECT AddGeometryColumn('_data','geom',900913,'POLYGON',2);      This function works most of the time, except when the result of making a concave hull around `ST_Collect(geom)` is a linestring, instead of a polygon. When a linestring is returned, I get the following error message:               ********** Error **********          ERROR: Geometry type (LineString) does not match column type (Polygon)     SQL state: 22023     Context: SQL statement "INSERT INTO _data (fid, rid, cost, geom) (         SELECT            _fid,            _rid,           500,            ST_ConcaveHull(ST_Collect(geom), 0.85) As geom         FROM table_distance as d             WHERE _fid = fid)"     PL/pgSQL function "_ncg_isodist" line 4 at SQL statement      I would like to disregard the result if a line is returned, but I'm not sure how to do this. I started off by nesting the block in a `BEGIN END;` statement, hoping that the function would not crash, but this does not solve the problem. I then wondered if there was some way of checking either the geometry type that is returned, or some other feature of `ST_Collect(geom)` so that I know when a polygon has been created. I noticed the `ST_Dump()` function, but I can't figure out how to count the number of values in `ST_Dump()` in this query as I get the error message that `aggregate function calls cannot be nested`. Any thoughts on how I can solve this? EDIT: @simplexio suggested using `GeometryType(ST_ConcaveHull(ST_Collect(geom), 0.85)) != 'LINESTRING'` in the `WHERE` clause. I tried this, but got a similar error to earlier:               ERROR: aggregates not allowed in WHERE clause LINE 7: AND      GeometryType(ST_ConcaveHull(ST_Collect(geom), 0.85)) != 'LINESTRING'


Layers change position when saving to another data format

When I save my map after using the composer, the layers move a little bit on the images of the OpenLayers plugin. It is like they ignore the CRS option. Do you have an idea?


How to search for layers in the layers panel?

I have QGIS projects with a lot of layers. Sometime it's difficult to find a layer into Layers Panel. How to search it?


In what form should make requests to geoserver gml file from javascript?. I have made this question, but neither on nor XMLRequest jquery and have downloaded some of geoserver, geoserver values always returns null. someone will have examples, or know that library is useful for this case. Thanks for your answers


Using a web map to identify and access data

I am trying to making a webpage where the user pans and zooms on a map, and based on the location and zoom level, some data is displayed on the webpage (drawn from another source). The data that will be displayed is not spatial data, and it will not be shown on the map. I thought I could have a database for each zoom level, and then when a call to the database is made, it returns the data associated with that location and zoom level. I saw an approach on the google earth documentation regarding regions and this related SE question. However, I was hoping to use Google maps for this. The data being returned for each area is just one number. For example, say I wanted to see the number of people in a certain area, it would show that value on the webpage. The first iteration of this I was hoping to do for a city (London), and then see if there were any performance issues. Is this a reasonable approach? Are there any better ways of doing this, or things that I should be aware of?


OSM Data Missing Name Field in ArcGIS

I downloaded and loaded osm data into ArcGis Catalog using OpenStreetMap plugin. But there's no field named "NAME" in the attribute table. And therefore I cannot display the name on the map. Did I do something wrong? Following are the steps and results in screenshots. ![I download the data from openstreetmap.org](http://i.stack.imgur.com/wrhqq.png) ![Loaded into arcgis catalog, sde backed by oracle](http://i.stack.imgur.com/lmtvx.png) ![The data is loaded and shown as graph](http://i.stack.imgur.com/c6BDS.png) ![But when open the table, no "NAME"](http://i.stack.imgur.com/iD9Is.png)