Thursday 31 December 2015

Determining if point on boundary using shapely?



I'm new to Python, and I want to test if a certain point lies ON the (boundary) of a polygon - not inside, not outside, just if it's on the boundary. The points and polygon already defined


polygon = [(3, 2), (5, 1), (7, 2), (8, 6), (9, 7), (11, 6), (10, 4), (12, 2), (15, 2), (16, 5), (19, 7), (18, 11), (14, 12), (11, 9), (5, 9), (2, 6)] 
Point_X = 14
Point_Y = 12

this point should be a boundary. How can I do that?




pyqgis - Compatibility PyQt5 and PyQt4


I'm having some compatibility problems with PyQt5, as expected some of the scripts I wrote are not working.


My biggest issues are with these two PyQt4 functions:


layer.pendingFields()

layer = QgsMapLayerRegistry.instance().mapLayersByName('Layer_Name')[0]


Is there a comparable function in PyQt5?


Does it work like the old functions?


In general it would be great to have something like a dictionary, where you could look for the old function and see the relate translation or substitutes in PyQt5.



Answer



I'm assuming when you say "PyQt5", you mean you are using QGIS 3.x. In which case:


layer.pendingFields()

becomes:


layer.fields()




And:


layer = QgsMapLayerRegistry.instance().mapLayersByName('Layer_Name')[0]

becomes:


layer = QgsProject.instance().mapLayersByName('Layer_Name')[0]



You can read here about the API changes and here for the PyQt4 and PyQt5 differences.


python - Creating image with specific latitude/longitude positions using GDAL?


I have an ASCII file with latitude, longitude, and data_val in the following format.


35-13.643782N, 080-57.190157W, 118.6
...

I have a GeoTiff image file, and I can easily view it.


I want to place a "pin" (can be a dot/flag/star or whatever is easiest) on the image at the specific latitude/longitude position found in the ASCII file.


Here is what I've managed to do so far:



My source image looks like this:


Driver: GTiff/GeoTIFF
Files: /tmp/Charlotte SEC 100.tif
Size is 16867, 12358
Coordinate System is:
PROJCS["Lambert Conformal Conic",
GEOGCS["NAD83",
DATUM["North_American_Datum_1983",
SPHEROID["GRS 1980",6378137,298.2572221010042,
AUTHORITY["EPSG","7019"]],

AUTHORITY["EPSG","6269"]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433],
AUTHORITY["EPSG","4269"]],
PROJECTION["Lambert_Conformal_Conic_2SP"],
PARAMETER["standard_parallel_1",38.66666666666666],
PARAMETER["standard_parallel_2",33.33333333333334],
PARAMETER["latitude_of_origin",34.11666666666667],
PARAMETER["central_meridian",-78.75],
PARAMETER["false_easting",0],

PARAMETER["false_northing",0],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]]]
Origin = (-365041.822331817995291,240536.419747152860509)
Pixel Size = (42.334586069440391,-42.334898968590878)
Metadata:
AREA_OR_POINT=Area
TIFFTAG_DATETIME=2016:06:24 12:46:45
TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
TIFFTAG_SOFTWARE=Adobe Photoshop CS5 Windows

TIFFTAG_XRESOLUTION=300
TIFFTAG_YRESOLUTION=300
Image Structure Metadata:
COMPRESSION=LZW
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( -365041.822, 240536.420) ( 82d48'55.43"W, 36d13' 4.92"N)
Lower Left ( -365041.822, -282638.262) ( 82d35'10.11"W, 31d30'17.00"N)
Upper Right ( 349015.641, 240536.420) ( 74d51'46.40"W, 36d13'26.16"N)
Lower Right ( 349015.641, -282638.262) ( 75d 4'55.60"W, 31d30'36.99"N)

Center ( -8013.091, -21050.921) ( 78d50'12.11"W, 33d55'36.35"N)
Band 1 Block=16867x1 Type=Byte, ColorInterp=Palette
Color Table (RGB with 256 entries)
0: 255,255,255,255
...

Here is what I've managed to cobble together in Python:


from osgeo import gdal, osr

src_filename = '/tmp/Charlotte SEC 100.tif'

dst_filename = '/tmp/foo.tiff'

# Opens source dataset
src_ds = gdal.Open(src_filename)
format = "GTiff"
driver = gdal.GetDriverByName(format)

# Open destination dataset
dst_ds = driver.CreateCopy(dst_filename, src_ds, 0)


# Specify raster location through geotransform array
# (upperleftx, scalex, skewx, upperlefty, skewy, scaley)
# Scale = size of one pixel in units of raster projection
# this example below assumes 100x100
gt = [-365041.822, 100, 0, 240536.420, 0, -100]

# Set location
dst_ds.SetGeoTransform(gt)

# Get raster projection

epsg = 4269 # http://spatialreference.org/ref/sr-org/lambert_conformal_conic_2sp/
srs = osr.SpatialReference()
srs.ImportFromEPSG(epsg)
dest_wkt = srs.ExportToWkt()

# Set projection
dst_ds.SetProjection(dest_wkt)

# Close files
dst_ds = None

src_ds = None

But, I can't quite figure out how to place a "red dot" at 35-13.643782N, 080-57.190157W


I'm having to learn some new details here (nomenclature about GIS).




arcobjects - Scaling Selection Symbols with Reference Scale using ArcGIS Engine?


With an ArcGIS Engine application, I am trying to figure out how to have the Selected Symbols scale with reference scale when selected using ArcObjects. They are currently not scaling correctly in ArcGIS Engine. Example, I select a stylized point that is using the "with this color" under layer properties (not the generic "with this symbol" option).


You can set this option in ArcMap via the "Select Options" dialog, and by checking "Scale selection symbols when a reference scale is set". Saving the map does not persist this setting when an MXD is opened in the ArcGIS Engine application. So in the example above, the stylized point will be colored, but it is only true to scale at the given reference scale when selected.


I have combed a lot of articles and found the various Selection interfaces (threshold tolerances, record counts, layer saving colors, etc.)


Where can I find this interface that controls the selection scaling (using ArcGIS Engine)?


I am about to go a graphics layer route, but I would prefer not to if the "easy" answer is out there.





javascript - Transform coordinates EPSG:32628 to EPSG:3857 Openlayers 3


I need to transform the example coordinates to a different projection in Openlayers3, the EPSG:32628 to EPSG:3857. I made a function to do it but the result is exactly the same numbers.


function plsHelp(){
var pt = [459123.1209, 3108334.7701];
var scr = new ol.proj.Projection('EPSG:32628');

var dest = new ol.proj.Projection('EPSG:3857');
var test= ol.proj.transform(pt,scr,dest);
console.log(test);
}

What is wrong with the function that is preventing the tranformation of the coordinates from EPSG:32628 to EPSG:3857 in Openlayers 3?



Answer



OpenLayers natively includes the two following projections only: EPSG:3857 and EPSG:4326. To be able to transform to or from any other projections, you must use the Proj4JS library.


Try adding the two following scripts, the first being the Proj4JS library itself, the other the definition of the EPSG:32628 projection:





qgis - GIS QUERY on point and buffer


I have a point table and the buffer geometry is created around the point.


I have defined the if the point is within the buffer_distance then its value is =1 and if it is outside the buffer its value is =0, and when it is on buffer_polygon then =2.


Now when ever i change the location of point then it should check the following conditions and the flag value should change according to the location of point new position.


I am changing the position of the point in QGIS.


My table structure is like this:-


GID(PK) Flag(INT)   Buffer_Distance THE_Geom    Buffer_GEOM
1 1 100 point(X,Y Location) Buffer Created around the Point

2 2 200 point(X,Y Location) Buffer Created around the Point
3 2 200 point(X,Y Location) Buffer Created around the Point
4 3 300 point(X,Y Location) Buffer Created around the Point
5 3 300 point(X,Y Location) Buffer Created around the Point
6 1 100 point(X,Y Location) Buffer Created around the Point


arcgis desktop - Matching colours in already mosaiced single image?




I have an already mosaiced image for a large area. I need to match colours in this single image. I do not have each image separately. I just have this large single image downloaded from GLS. How can I match the colour of this image if I do not have its image in parts? I did a Histogram match but it does not work. Please provide me steps for any of the following:



  • Erdas 2014

  • ArcGIS

  • ENVI

  • QGIS


Landsat GLS




Where is the "Add vector layer"-button in GRASS 6.4.4. plug-in QGIS 2.10.1?


I've just downloaded and installed the new version of QGIS 2.10.1 with GRASS 6.4.4. When opening a new GRASS mapset and importing layers, I missed the button "Add a new vector layer". I've updated the GRASS plugin, but again the button wasn't there (all other GRASS symbols except "add raster layer" were visuable).



It's maybe a stupid question of a GIS beginner, but what can I Do? Is there an option to add (not import) a vector layer via the GRASS toolbox?




Wednesday 30 December 2015

geoserver - Changing vector projection in OpenLayers


I have added vector layer to map:


    vactorTest = new OpenLayers.Layer.Vector("Editable Features", {
strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
projection: new OpenLayers.Projection("EPSG:900913"),
protocol: new OpenLayers.Protocol.WFS({

srsName: "EPSG:900913",
url: "http://localhost:8080/geoserver/wfs",
featureType: "ROADS",
featureNS: "http://localhost:8080/MIA",
featurePrefix: "MIA",
geometryName: "GEOM",
version: "1.1.0"
})
});


map.addLayer(vactorTest);

And then, added polygon draw control:


var drawPolygon = new OpenLayers.Control.DrawFeature(
vactorTest, OpenLayers.Handler.Polygon,
{
title: "Draw Polygon",
displayClass: "olControlDrawFeaturePolygon",
multi: true
}

);

with drawn polygon I want to filter layer:


testLayer.mergeNewParams({
"CQL_FILTER": mergeFilter
});

I use within filter:


WITHIN(GEOM, POLYGON((4693721.49445 672633.89194, 4560244.10812 322255.75282, 4703732.29843 422363.79257, 4693721.49445 672633.89194)))


target layer is in Georgia, and if I draw polygon near Italy then, filter works.


How can I change vector projection like my layer to get right result?



Answer



You can serialize your data. To reproject the data when converting, you should pass the internal and external projection to the format class, then use that format to write out your data.


var format = new OpenLayers.Format.GeoJSON({
'internalProjection': new OpenLayers.Projection("EPSG:900913"),
'externalProjection': new OpenLayers.Projection("EPSG:4326")
});
var jsonstring = format.write(vector_layer.features);


or you can transform your features on your vector layer as,


var proj = new OpenLayers.Projection("EPSG:4326");
var point = new OpenLayers.LonLat(-71, 42);
map.setCenter(point.transform(proj, map.getProjectionObject()));

modelbuilder - ArcGIS model tries to tabulate the number of rows from multiple table intersections


I'm trying to generate a table that captures the number of rows, and the source feature class, from the intersection of several FCs against one common layer. My expected output is one row per intersection set containing the number of rows intersected and the source feature class for that intersection (technically there are two source feature classes for a given intersection set but the second FC is always the same). However my final table turns out empty and I don't understand what I'm doing wrong.


My model, as shown, iterates through FCs in a geodatabase and intersects them against a common layer for all FCs. I subsequently use Summary Statistics to get a count of rows, add a field to include the name of the FC selected from the geodatabase, and append this to a dummy table I've generated.


enter image description here


The process runs and creates a table with the right fields but the cells are empty.enter image description here




openlayers - Add feature manually to a vector layer in ol3


I'm trying to add a layer manually to a vector layer with javascript. I can't seem to determine why this is failing:


http://jsfiddle.net/Kieveli/f4t6n6v1/4/


I've tried sane coordinates like 16,22, and big ones to match the view's xy values. I get a javascript error from ol3 : TypeError: b.Q is not a function.


HTML:




Javascript:



var vectorSource = new ol.source.Vector({});

var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.MapQuest({layer: 'sat'})
}),
new ol.layer.Vector({
source: vectorSource
})

],
target: 'map',
view: new ol.View({
center: [-11000000, 4600000],
zoom: 4
})
});

var thing = new ol.geom.Polygon( [ [16000000,22000000],[44000000,55000000],[88000000,90000000] ] );
vectorSource.addFeature( thing );


Answer



As Gabor Farkas said, I was adding the geometry and not a feature to the source. I was also missing [] on the coordinates to the geometry, and wasn't converting properly. Outside of here, I was using lat/long as x/y instead of y/x. Updated fiddle:


http://jsfiddle.net/Kieveli/f4t6n6v1/7/


HTML:




JAVASCRIPT:


var vectorSource = new ol.source.Vector({});

var map = new ol.Map({

layers: [
new ol.layer.Tile({
source: new ol.source.MapQuest({layer: 'sat'})
}),
new ol.layer.Vector({
source: vectorSource
})
],
target: 'map',
view: new ol.View({

center: [-11000000, 4600000],
zoom: 4
})
});

var thing = new ol.geom.Polygon( [[
ol.proj.transform([-16,-22], 'EPSG:4326', 'EPSG:3857'),
ol.proj.transform([-44,-55], 'EPSG:4326', 'EPSG:3857'),
ol.proj.transform([-88,75], 'EPSG:4326', 'EPSG:3857')
]]);

var featurething = new ol.Feature({
name: "Thing",
geometry: thing
});
vectorSource.addFeature( featurething );

enterprise geodatabase - ArcGIS 10.2 Query Layer on SQL Server performance


I'm using a Query Layer on SQL Server in ArcMap. The Query Layer executes instantly in in SQL Server but but takes so long to draw in ArcMap that the system appears unresponsive for about 10 minutes or longer. During the ArcMap draw the one of the CPU's is maxed out on the SQL Server process.


My Query is the STIntersects of a buffer on a line feature (Shannon) against a polygon feature class (Townlands) , as follows;


SELECT TOWNLANDS.TL_ID,TOWNLANDS.Shape FROM dbo.TOWNLANDS as townlands
with(index(FDO_Shape))
JOIN dbo.Shannon on townlands.Shape.STIntersects
(Shannon.Shape.STBuffer(2.0))=1

The query returns 186 rows instantly. These can be draw in the SQL Server Management Studio Spatial pane without a problem



When I build a Query Layer in ArcMap with exactly the same syntax the system becomes unresponsive but does draw eventually. It looks as though, perhaps, ArcMap s not using the spatial index or is doing so differenlt from SQL Server causing an inefficient query on SQL Server that takes an age to return.


Can anyone advise on a remedy?


Thanks


ArcGIS Desktop: 10.2
ArcSDE: 10.2
RDBMS: Database and version: SQL Server 2008
OS: Windows Server


Tuesday 29 December 2015

enterprise geodatabase - Changing data source of table using ArcObjects?



Cross post from: https://geonet.esri.com/thread/125010


Does anyone know how to change the data source of a table using arcobjects? I know it can be done with arcpy, but I'm using C#. I've managed to change the source of all the layers in the mxd, but I need to do tables too.




I've come up with a solution by adding and removing from the table collection.


Is this the best way to do it?


        IMap map = ...;
IWorkspace = ...;

ITableCollection tableCollection = (ITableCollection)map;
int tableCount = tableCollection.TableCount;


// iterate over a copy of the tables so we can add and remove
List tables = new List();
for (int i = 0; i < tableCount; i++)
{
tables.Add(tableCollection.get_Table(i));
}

foreach (ITable oldTable in tables)
{

IDataset dataset = (IDataset)oldTable;
IDatasetName datasetName = (IDatasetName)dataset.FullName;
string workspaceName = datasetName.WorkspaceName.PathName;

// get the new table
ITable newTable = ((IFeatureWorkspace)workspace).OpenTable(datasetName.Name);

// replace the table in the TOC
tableCollection.RemoveTable(oldTable);
tableCollection.AddTable(newTable);


// fire change event to change table
IMapAdmin2 mapAdmin2 = (IMapAdmin2)map;
mapAdmin2.FireChangeTable(oldTable, newTable);
}

Note: this is simplified - I did check the table was in the new workspace before opening it.



Answer



You should use the table property of IStandaloneTable to change its datasource. First create a reference to the new ITable (e.g. a table from a geodatabase), then use this code to replace the Table property:


            IMap map = ...;

IStandaloneTableCollection tbcol= (IStandaloneTableCollection)map;

for (int i = 0; i < tbcol.StandaloneTableCount; i++)
{
var stTable = tbcol.get_StandaloneTable(i);
stTable.Table = newTable; //Here put the new ITable To change the datasource
if (!stTable.Valid)
MessageBox.Show("Table is not valid, "+stTable.Name);
}

Changing cache size for geocoding via ArcPy?


I recently posted this query: Arcpy script stalls, CPU usage goes to 0, no error message returned and got as a suggestion to increase the cache size in Arcpy for the geocoding of addresses that I am performing.



The link here describes how to do this for the GUI version of ArcMap.


But, the support page for the GeocodeAddresses_geocoding doesn't mention how to manage the cache via Arcpy, nor can I find other references to it.


How can this be accomplished in Arcpy?




postgis - How do I get started with GIS Servers on Amazon EC2?


Are there any tutorials, talks or presentations that discuss the use of EC2 or other cloud computing services to host GIS Servers? Has anyone had any experience in doing it with Amazon's EC2? How hard is it to setup? I know that ESRI has some versions of their server products focused especifically to EC2, has anyone had success in using them?


Thank you very much.



Answer



Here is a page with answers to common questions:


Questions and Answers about ArcGIS Server on Amazon EC2


And here's a recorded training seminar:


Running ArcGIS Server on Amazon EC2



raster - Automating creation of toe of slope from DEM using ArcGIS for Desktop?


I was looking for an automated process to "identify" the toe of a slope from a DEM and ran across this ESRI thread and technique:



I am at Step 7 but have no idea how this is accomplished. I get it is in Raster Calculator but how???



Re: Finding toe-of-slope in a DEM


Author William Huber


Date Nov 29, 2003


Message There are a lot of approaches that might be effective. Here's one. Implement it using the Raster Calculator.


(1) Create an indicator grid of "flat" areas. In the example (attached), I have begun with a DEM of part of Highland County, VA. The "flat" areas are those with a slope of less than 6 percent.


(2) Creat an indicator grid of "steep" areas. This is the complement of the flat areas.


(3), (4) Use the indicator grids to mask the original DEM, creating grids showing elevations only where the slope is flat or steep.


(5), (6) Compute neighborhood means of the steep elevations and flat elevations.



(7)Create a "valley edges" grid at cells where the mean of the steep elevations exceeds the mean of the flat elevations.**


(8), (9) Simplify this valley edge grid by performing a Boundary Clean operation, then shrink it by a cell or two.



Any help would be appreciated. Or maybe there is a different way.




coordinate system - Creating custom projections with Proj4?


I'm reading into how to customise projections with Proj4 - specifically to achieve tilted projections such as the example below (from vis4.net)


enter image description here


The Proj4 literature is pretty heavy going and having explored it I'm not clear which parameters I'd need to change, or whether a custom datum would need to be defined.



Answer




Define a tilted perspective projection (tpers) using:



  • h: height (in meters) above the surface

  • azi: bearing (in degrees) from due north

  • tilt: angle (in degrees) away from nadir

  • lat_0: latitude (in degrees) of the view position

  • lon_0: longitude (in degrees) of the view position


Putting it all together, here is an example PROJ string for part of Europe:


+proj=tpers +ellps=WGS84 +h=5000000 +azi=30 +tilt=40 +lat_0=20 +lon_0=0

arcgis desktop - Getting nearest point distance in ArcMap?


How do you calculate the nearest distance from one XY coordinate to another XY.



I'm using Arc Map 10


I went into Arc tool box -> proximity -> then I only have 2 buffering options.


But under buffer I do not see any "near features" option



Answer



Based on your other question, you have a Basic license and so don't have access to the Near or Generate Near Table tools. But you can still do it with a Spatial Join. If your XY are just coordinates, you need to make point features out of them first. There are other questions here that cover that.


Spatial Join your points to themselves (if they're in the same layer) with a one-to-one join_operation and closest match_option. Specify a distance field name, and the output table of the join will include a column with the distance (in dataframe CRS units) from each point to its closest neighbor.


Monday 28 December 2015

web service - Web GIS Development Skill Sets




What technologies and skill sets should one who wants to do web GIS development study/acquire?


One skill/technology per answer please.



Answer



I can tell you about my experience, which started as a simple geographer, trying to use GIS products to do spatial analysis.


As I said, I'm a geographer, and from the beginning in college I started working with GIS as a user. After that, I started to research on how to automate tedious tasks I had to do often. That came as passion, and after 3 three years, I'm employed by a multinational software house, that works with many GIS systems and developing custom solutions.


My steps were:




  • Learn GIS well. Don't start out learning programming without having the fundamental right. Projections and transformations, spatial analysis, differences between the raster and vector model, etc.





  • Learn the database fundamentals: Introduction to Database Systems,Fundamentals of Database Systems. The two books are a bit different. The first is heavy on theory, the second one takes a more practical approach.




  • Learn SQL. This is actually a second part to the first. It will help you a great deal if you start to think in a "sqlish" manner. SQL changes from vendor to vendor. I can recommend you with PostgreSQL, which , is the vendor that follows the standard the most. If you need to learn specific dialects, do it later, when you actually need it.




  • Object Oriented Programming. It seems a challenge, but it's quite easy once you grasp the basics. Choose a easy language to do it. Python is by far the easiest one. Learning Python is an excellent starting point. There are open-source/free Python books, like Dive into Python. After Python, interesting choices are: .NET, Java, and C/C++.





  • Study programming. Read code, write code. Read geospatial code. Write geospatial code. Study the classic APIs: GEOS, JTS, GDAL, ArcObjects (if you are an ESRI fan - and it's a big plus in the market), etc.


    - Take a geospatial problem and write code to solve it. I cannot stress how useful this is. This will make you crazy, but it's a very good way to confirm that you learned the programming side and to make sure your geo-spatial skills are up to date. In my case I wrote a small PostgreSQL application to geocode traffic accidents.




  • Keep on studying. OGC standards are a nice choice here.




arcgis desktop - How to export all the layers from Table of Content to shp file?


I have got lots of different layers in the Table of Content panel in ArcMap. I want to export them all in shp format in one go. How can I do that? So far I have been doing it one by one by right clicking on the layer-->data-->export as shp. and it is taking longer time. I want to do them all together.




ArcGis 10 interpolate Z between polyline's vertices (IZ.InterpolateZsBetween ?)


Here's what's happening:


I want to create a 3D line using only the height of some GSP points. I need to be able to extrapolate the vertice's height between where it's known to the one where it's unkonwn.


What I have tried:



  • Creating a TIN from GPS points: where the line meanders and there is no GPS points, the height is not correct.

  • Linear Referencing tools: but as originally the Polyline Z has no value interpolated between each vertex, it doesn't seem to do what is needed

  • Conversion of Point to raster at a 1 m cell (Nodata outside the cell where the GPS points lay) and extraction of the Z value to the vertex where they overlap the cell with value, leaving the not-overlapping vertices without Z value.


Is this what I need?:



I think I should use something like "IZ.InterpolateZsBetween" but I am useless at coding. Could someone please explain me how to implement this fonction?


Many thanks



Answer



IZ.InterpolateZsBetween interpolates between vertices with Z value. Use it if your polyline has some Z values.


Otherwise you can use Extract Values to points or Interpolate Shape. These both require surface that you may get your values. Not sure if TIN would be ok, but always you can convert TIN To Raster.


Also you could construct polyline ZM and Calibrate Route M with your GPS points. It should do what IZ.InterpolateZsBetween, only for M. Than you could use M as Z. though as far as I remember year back there was a bug in this algorithm. Still worth a try.


heat map - Workarounds for heatmap plugin in QGIS?


In QGIS 2.8, the heatmap plugin got CRS broken. I updated to 2.10, now in the plugin the dialog is broken: it does not let you choose the format.


I render layers for atlases with heatmap style. But I need to export it to GeoTIFF, and I don't see a way to do this.


Updating the QGIS is not easy in Ubuntu, since it works normally when installed from a PPA, but installing from sources, or downloading debs is very painful.


Is there a workaround?


A command line example will do too.


edit here's a screenshot. The format list is empty, and if I write file extension manually as I did here, it still does not allow, showing a message that format is not chosen.


Screenshot: format dropdown is empty


Meanwhile in another dialog, format choice works correctly:


enter image description here



Versions: Versions enter image description here




file formats - QGIS processing default output vector layer extensions


You can set the default output-extension of a model in processing > options > general. The intermediate transactions in a model are processed in that default file format.


After installing QGIS, the default extension is set to 'shp'.


A well-known disadvantage of using shp is the restriction in attributenames (set to 10 characters).


When I set the default to eg. 'geojson' I can evade the naming-restriction. But I then get some other errors on processing geometries.


So I'm looking for an explanation of the advantages and disadvantages of the different output-extensions used in the graphical modeller.




convert - Converting .las to .pcd file using PDAL?


Is it possible to translate .las files to .pcd with PDAL? If so, using which tool? I need an example about how to set the command-line with such tool.


If it is not possible (or alternatively), is there other open source software that can translate .las to .pcd?



Answer



The PDAL PCD Writer can write .pcd files. For it to work, you must have linked the PCL libraries at compile time. The PDAL OSGeo4W build does not have PCL support. If you are unable to build PDAL with PCL support yourself, one possibility is to use PDAL's Docker containers to achieve your task -- those have PCL linked.


Then, simply run pdal translate:


Using your own PDAL build with PCL linked:



pdal translate input.las output.pcd

With Docker:


docker run -v /c/Users/hobu/:/data pdal/pdal:1.5 ^
pdal translate /data/input.las /data/output.pcd

qgis - OpenLayers-plugin error after installing update


After installing an update for the OpenLayers-plugin today, this plugin does not work any longer. Reinstalling did not function neither with QGIS 2.12.0-Lyon nor with QGIS 2.14.1 ESSEN. Following error message occurred:


"Konnte Erweiterung openlayers_plugin nicht laden aufgrund eines Fehlers beim Aufruf der initGui() Methode 

UnicodeEncodeError: 'ascii' codec can't encode character u'\xdc' in position 11: ordinal not in range(128)
Traceback (most recent call last):

File "C:/PROGRA~1/QGISLY~1/apps/qgis/./python\qgis\utils.py", line 315, in startPlugin
plugins[packageName].initGui()
File "C:/Users/Stalze/.qgis2/python/plugins\openlayers_plugin\openlayers_plugin.py", line 115, in initGui
print action.text()
UnicodeEncodeError: 'ascii' codec can't encode character u'\xdc' in position 11: ordinal not in range(128)


Python-Version: 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]
QGIS-Version: 2.12.0-Lyon Lyon, cd9d645


Python-Pfad:
C:/Users/Stalze/.qgis2/python/plugins\processing
C:/PROGRA~1/QGISLY~1/apps/qgis/./python
C:/Users/Stalze/.qgis2/python
C:/Users/Stalze/.qgis2/python/plugins
C:/PROGRA~1/QGISLY~1/apps/qgis/./python/plugins
C:\PROGRA~1\QGISLY~1\apps\Python27\lib\site-packages\matplotlib-1.3.1-py2.7-win-amd64.egg
C:\PROGRA~1\QGISLY~1\apps\Python27\lib\site-packages\nose-1.3.3-py2.7.egg
C:\PROGRA~1\QGISLY~1\apps\Python27\lib\site-packages\tornado-4.0.1-py2.7-win-amd64.egg
C:\PROGRA~1\QGISLY~1\apps\Python27\lib\site-packages\backports.ssl_match_hostname-3.4.0.2-py2.7.egg

C:\PROGRA~1\QGISLY~1\apps\Python27\lib\site-packages\certifi-14.05.14-py2.7.egg
c:\osgeo4~1\apps\python27\lib\site-packages\python_dateutil-2.1-py2.7.egg
c:\osgeo4~1\apps\python27\lib\site-packages\six-1.3.0-py2.7.egg
C:\PROGRA~1\QGISLY~1\bin\python27.zip
C:\PROGRA~1\QGISLY~1\apps\Python27\DLLs
C:\PROGRA~1\QGISLY~1\apps\Python27\lib
C:\PROGRA~1\QGISLY~1\apps\Python27\lib\plat-win
C:\PROGRA~1\QGISLY~1\apps\Python27\lib\lib-tk
C:\PROGRA~1\QGISLY~1\bin
C:\PROGRA~1\QGISLY~1\apps\Python27

C:\PROGRA~1\QGISLY~1\apps\Python27\lib\site-packages
C:\PROGRA~1\QGISLY~1\apps\Python27\lib\site-packages\PIL
C:\PROGRA~1\QGISLY~1\apps\Python27\lib\site-packages\jinja2-2.7.2-py2.7.egg
C:\PROGRA~1\QGISLY~1\apps\Python27\lib\site-packages\markupsafe-0.23-py2.7-win-amd64.egg
C:\PROGRA~1\QGISLY~1\apps\Python27\lib\site-packages\pytz-2012j-py2.7.egg
C:\PROGRA~1\QGISLY~1\apps\Python27\lib\site-packages\win32
C:\PROGRA~1\QGISLY~1\apps\Python27\lib\site-packages\win32\lib
C:\PROGRA~1\QGISLY~1\apps\Python27\lib\site-packages\Pythonwin
C:\PROGRA~1\QGISLY~1\apps\Python27\lib\site-packages\Shapely-1.2.18-py2.7-win-amd64.egg
C:\PROGRA~1\QGISLY~1\apps\Python27\lib\site-packages\six-1.3.0-py2.7.egg

C:\PROGRA~1\QGISLY~1\apps\Python27\lib\site-packages\wx-2.8-msw-unicode
C:\PROGRA~1\QGISLY~1\apps\Python27\lib\site-packages\xlrd-0.9.2-py2.7.egg
C:\PROGRA~1\QGISLY~1\apps\Python27\lib\site-packages\xlwt-0.7.5-py2.7.egg
C:/Users/Stalze/.qgis2//python
C:\Users\Stalze\.qgis2\python\plugins\DigitizingTools\tools
C:\Users\Stalze\.qgis2\python\plugins\mmqgis/forms
C:\Users\Stalze\.qgis2\python\plugins\SelectTools/tools
C:/Users/Stalze/.qgis2/python/plugins\shpsync\xlrd-0.9.4-py2.7.egg
C:/Users/Stalze/.qgis2/python/plugins\shpsync\xlwt-1.0.0-py2.7.egg
.

C:\PROGRA~1\QGISLY~1\apps\qgis\python\plugins\fTools\tools"

As I work with the Bing aerial layer quite often, what could I do to make this plugin run again?




Sunday 27 December 2015

write python ndarray to raster


I think I understood the steps to write an array to a raster file using python. however it doesn't work in my case and I don't know why. I have an array that I want to write to a Geotiff with Swiss Oblique Mercator Projection. I have a DEM as Geotiff in the exact same location with same projections and Geotransform, so I thought I just read all parameters from that DEM and use them to write my new raster. Here's the code that I'm, using:


driver.Register()
fn = '/media/LACIE_SHARE/davos2015.tif'
inDs = gdal.Open(fn)
if inDs is None:
print 'Could not open ' + fn
sys.exit(1)

rows=inDs.RasterYSize

cols=inDs.RasterXSize

driver=inDs.GetDriver()
outDs=driver.Create('/home/grassdata/test.tif',cols,rows,1,gdal.GDT_Float32)

if outDs is None:
print "crap"
sys.exit(1)
outBand=outDs.GetRasterBand(1)
outData=coh0 #coh0 is the array I want to convert to raster. it's an array with float32 entries.


outBand.WriteArray(outData) # this gives 0
outBand.FlushCache()
outBand.SetNoDataValue(-99) #this gives 0
outDs.SetGeoTransform(inDs.GetGeoTransform()) #this gives 0
outDs.SetProjection(inDs.GetProjection()) #this gives 0
del outData

the lines where I commented accordingly raise 0 as result and I don't understand why.



Answer




Your issue is rooted in a well known GDAL Python gotcha - a dataset needs to be closed for it to be written to disk.


In Python this happens when the object goes out of scope and is garbage collected or when you manually dereference it. This is usually done by setting it to None or deleting it.


In your particular code the error is in the last line: del outData only closes your coherence numpy array. You want to close outDs so it is written to disk. FlushCache() is not necesary in your case since that only influences the behaviour of the blockcache which GDAL handles internally.


Your last lines should look like this:


outBand.WriteArray(coh0)
outBand.SetNoDataValue(-99)
outDs.SetGeoTransform(inDs.GetGeoTransform())
outDs.SetProjection(inDs.GetProjection())

outBand = None

outDs = None

Additional notes:



  • If you want to create a copy of an existing dataset and just fill it with new data you could also use the CreateCopy() method to save some lines of code.

  • GDAL is very mighty but at the same time very unpythonic. rasterio is an alternative way to use the GDAL bindings in a much more pythonic way.


arcgis desktop - Points along one or more lines at a time, with rotation


I'm using ArcMap 10.3, and I have several lines, that I would like to add arrows along at a defined interval, with that lines rotation, so the arrows point correct way along the line.



When I use the construct point (while having a line marked) I can get points at a defined interval for one line at a time, but it does not rotate according to the line direction. The funny thing is, it pretty much shows a preview, when you use this tool, with exactly the type of points I want (maybe a different arrow type), question is, how do I get it as shown on the picture below?


So to sum up, I would like to add points (in the shape of arrows) along a line, with the arrows pointing in the line direction.


What I want


Tried what is suggested at: Unable to rotate Marker Line Symbols


However this gives the difference, that smaller lines will have perhaps 5 markers on a line of 100 meters, but a line of 10000 meters will also have 5, so the interval is not ~ close to each other.



Answer



The line shown below drawn using @Richard Fairhurst solution for my question


Line symbology


Alternatively use workflow below, to assign correct bearing to your points, called “chainage”.


arcpy.AddField_management("chainage","IDFIELD","LONG")

arcpy.CalculateField_management("chainage", "IDFIELD", "[FID]")
arcpy.Buffer_analysis("chainage", "D:/Scratch/buffers.shp","5 Meters")
arcpy.Intersect_analysis("LINE #;buffers #", "D:/Scratch/directions.shp", "ALL")

Note that my line(s) layer called LINE. At this stage you can use “directions” with arrow-right symbol:


Segments


If you insist on points, calculate “directions” bearing:


arcpy.AddGeometryAttributes_management("directions", Geometry_Properties="LINE_BEARING")

Transfer bearing to chainage points using common “IDFIELD” and apply rotation to point symbol:



Symbol Point Symbol


Solution assumes you know how to place points at regular interval.


You might experiment with distance between points and buffer size and smoothed version of your line. In above example I placed points at 100m interval and used 5m buffer.


SQL queries in shapefiles using python/gdal return none result



I want try use Python and GDAL to create some SQL queries in my shapefiles. I try something and it looks good, but doesn't work. I get a none result.


Here is the code :


from osgeo import ogr
ogr_ds = ogr.Open('line.shp')
TEST=3
sql = "SELECT id FROM {} where id='{}'".format(ogr_ds,TEST)
layer = ogr_ds.ExecuteSQL(sql)
print layer

Answer



You are probably using the input layer in a wrong way; furthermore, also the .format{} operation doesn't seem correct.



You may try the following code:


from osgeo import ogr

filepath = 'C:/Users/path_to_the_shapefile/line.shp' # set the filepath
layer_name = filepath[:-4].split('/')[-1] # get the layer name
driver = ogr.GetDriverByName ("ESRI Shapefile")
ogr_ds = driver.Open(filepath)
TEST=3
sql = "SELECT id FROM %s WHERE id=%s" %(layer_name,TEST)
layer = ogr_ds.ExecuteSQL(sql)

print layer

I tested it with another shapefile (and a similar query) and it returns what expected:


print layer
>

EDIT


If you want to print the id value, you may add these lines:


feat = layer.GetNextFeature()
val = feat.GetField(0)

print val

but this will only returns one feature and not all the queried features (this kind of operation would be useful if you are only interested in knowing if a specific value for the id field is stored in the input layer). Furthermore, you will get an error if there isn't any id value equals to the TEST variable.


qgis - Voronoi / Thiessen polygons doesn't create a part for 1 of 4 input points


I am using QGIS to create Voronoi / Thiessen polygons for 4 rain gauges.



I am having issues with both the QGIS 'Voronoi polygons' tool and the Grass equivalent 'v.voronoi' where one of my 4 points is skipped and only 3 polygons are generated in the output.


As a test I have added an additional point and have found that both tools output a polygon with the correct number of parts (5). Is there a reason it will not work correctly on 4 or less points?


Edit - image showing the configuration of points and the output Voronoi polygons skipping the central point


image showing the configuration of points and the output Voronoi polygons skipping the central point




labeling - In QGIS, how do you place horizontal label outside polygon border?


I am attempting to recreate a layout from ArcGIS in QGIS. One of the advanced label options in ArcGIS is to force horizontal labels outside a polygon. You can optionally choose which quadrant the labels fall in.
Horizontal label outside polygon - ArcGIS


This question is related, but the labels are parallel with the polygon perimeter: Labels outside polygons in ArcMap


The answer to this question is basically what I'm looking for, but my polygons aren't circles: Upright/Horizontal labels when labeling polygons at perimeter in QGIS That question was asked in 2014, so perhaps a solution has been found in ensuing years? I am fine with prioritizing a quadrant for location, if that would help.




Saturday 26 December 2015

raster - QGIS Processing - Edge Extraction


I am looking for QGIS function to extract (or detect) edge from a raster, which was referred in here, How to digitize a raster automatically as answer by @MappaGnosis.



The name could have changed since then, or it may have been integrated into other tool... I cannot find it in my QGIS Processing Toolbox (2.14.10 and 2.18.2).


There are similar tools such as GRASS "i.zc Zero-crossing" and SAGA "Gaussian filter", but I am hoping to find this QGIS geoalgorithm.



Answer



The Edge Extraction tool may have been moved to the Orfeo Toolbox as this focuses on image analysis. The Orfeo Toolbox contains a number of edge extraction tools using various methods such as:



Open source approach to classifying and removing LiDAR points from overlapping scans?


The attached screenshot shows a LiDAR point cloud with significant overlapping scans. This point cloud tile is part of the MN statewide LiDAR dataset which has 25% scan overlap and 1.5 NPS. For many applications, these overlaps pose no problem. However, when calculating LiDAR metrics such as forestry grid metrics, these overlapping scan can pose a major problem by creating biases in the resulting products.


There are several commercial applications that can deal with these overlapping scans such as Esri's Classify LAS Overlap and Lastools lasoverage. Is there an open source approach to detect, classify, and remove overlapping points from multiple flight lines?


enter image description here



Answer



There are a couple of options. Depending on the area of MN where you're processing, the overlap areas of the data are classified, and you can use a PDAL filters.range to cull them out:


pdal translate input.las output.las range --filters.range.limits="!Classification[12:12]"


MN flightline overlap (inspect and visualize that in your browser here)


Not everywhere has these nicely classified, however, and PDAL's filters.sample would be one way to create a point cloud of consistent density.


pdal translate input.las output.las sample --filters.sample.radius=1.414

PDAL works on Windows, OSX, and Linux/Docker. You can find out how to install PDAL from this SO post or on the PDAL website.


arcgis desktop - Iterating feature class output file names using ModelBuilder?


I am trying to iterate a series of feature classes (polygons) in model builder to convert a series of polygons to rasters, however, I am having an issue with the output file names.


After inserting the "iterate feature class" tool into the model builder window, and linking my gdb storing all the polygons as the input, the output feature (green bubble) automatically becomes the name of my first polygon. As a result the model that I attempt to run seems to recur to that named polygon rather than then going to the next polygon in the list. Output rasters are created, but overwrite that file name rather than generating a new raster with a new name that matches the subsequent polygons.


What am I doing wrong?



Answer



Here is the model, it uses inline substitution as described by Aaron. Note the output of the Polygon to raster tool is ..\fGBD_Scratch.gdb\ras_%Value%. Value is coming from the iterator which in this case was set to FID to hand out unique rows. So the first raster dataset would be ras_1, then ras_2, etc.


Model


references - Learning ArcPy?



Where can I start to learn ArcPy?




remote sensing - What are LiDAR returns?


Can someone help with an explanation and some references, in order to understand the nature of return pulses within a LiDAR system.




python - Programmatically populating shapefile field with polygon areas in OGR?


I'm trying to programmatically populate a shp field with polygon areas:


import sys
import ogr

ds = ogr.Open( 'tttttttttt.shp', update = 1 )

if ds is None:
print "Open failed./n"
sys.exit( 1 )

lyr = ds.GetLayerByName( "tttttttttt" )
lyr.ResetReading()

field_defn = ogr.FieldDefn( "Area", ogr.OFTReal )
lyr.CreateField(field_defn)


for i in lyr:
# feat = lyr.GetFeature(i)
geom = i.GetGeometryRef()
area = geom.GetArea()
print 'Area =', area
lyr.SetFeature(i)
i.SetField( "Area", area )

ds = None


But I get an empty values in the field...



Answer



You have to use lyr.SetFeature(i) to trigger the update in your shape file. You'll have to close the data sources in the end so things get written.


import sys
import ogr

ds = ogr.Open( 'tttttttttt.shp', update = 1 )
if ds is None:
print "Open failed./n"
sys.exit( 1 )


lyr = ds.GetLayerByName( "tttttttttt" )
lyr.ResetReading()

field_defn = ogr.FieldDefn( "Area", ogr.OFTReal )
lyr.CreateField(field_defn)

for i in lyr:
# feat = lyr.GetFeature(i)
geom = i.GetGeometryRef()

area = geom.GetArea()
print 'Area =', area
lyr.SetFeature(i)
i.SetField( "Area", area )
lyr.SetFeature(i)
ds = None

*Low-rep comment and concern: If the 'Area' field already exists, this code creates an extra field, like "Area_n", and overwrites the existing Area field. Maybe folks should add some safety code like:


ldef = lyr.GetLayerDefn()
if ldef.GetFieldIndex("Area") != -1:

print "'Area' field already defined"
... # exit or overwrite logic

python - Explicitly close a OGR result object from a call to ExecuteSQL


How can I explicitly close/release the result of an ExecuteSQL statement when querying a Spatialite database with OGR via Python? I have a simple query to return the SRID of a dataset. This works as expected. However, subsequent calls to ds.ExecuteSQL fail with the error 'SQL logic error or missing database' unless I iterate all the way through the result rows.


For example:


ogr.UseExceptions()


# This query returns a single row
sql = 'select distinct srid(geometry) from foo'
result = ds.ExecuteSQL(sql)
row = result.next()
epsg = row.GetField(0)

# This call fails
ds.ExecuteSQL('drop table bar')


Completing the iteration avoids the error:


_ = [r for r in result]

This is fine for simple cases, but not very explicit. I've tried calling result.Dereference(), row=None; result=None but these do not help. What is it that I'm missing here?


UPDATE The exception is only raised when I enable ogr.UseExceptions(). Otherwise the error passes silently and the drop table statement has no affect.




installation - Problems installing QGIS 2.2 on Ubuntu 14.04


After major upgrade to 14.04 I tried to purge and reinstall QGIS.


Unfortunately I get and error (full listing below) and cannot finish clean installation.


Information in the log points errors to appear with pyspatialite and/or python-pyspatialite but I cannot find any solution to this issue.


Also - QGIS actually manages to start after installation but points to another error with PyQGIS this time:


enter image description here


Any ideas how to solve this issue?



rdk@hal:~$ sudo apt-get install qgis python-qgis qgis-plugin-grass
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
grass grass-core grass-doc grass-gui libmotif-common libmrm4
libopenscenegraph99 libosgearth3 libosgearthannotation3 libosgearthfeatures3
libosgearthqt3 libosgearthsymbology3 libosgearthutil3 libqgis-analysis2.2.0
libqgis-core2.2.0 libqgis-gui2.2.0 libqgis-networkanalysis2.2.0
libqgisgrass2.2.0 libqgispython2.2.0 libspatialindex3 libtcl8.5 libtk8.5

libuil4 libxm4 osgearth-data python-opengl python-pyspatialite
python-qgis-common qgis-common qgis-plugin-globe qgis-plugin-globe-common
qgis-plugin-grass-common qgis-providers qgis-providers-common tcl8.5 tk8.5
Suggested packages:
grass-dev e00compr avce00 gnuplot gpstrans python-rpy2 xml2 grass-dev-doc
openscenegraph libgle3 tcl-tclreadline
The following NEW packages will be installed
grass grass-core grass-doc grass-gui libmotif-common libmrm4
libopenscenegraph99 libosgearth3 libosgearthannotation3 libosgearthfeatures3
libosgearthqt3 libosgearthsymbology3 libosgearthutil3 libqgis-analysis2.2.0

libqgis-core2.2.0 libqgis-gui2.2.0 libqgis-networkanalysis2.2.0
libqgisgrass2.2.0 libqgispython2.2.0 libspatialindex3 libtcl8.5 libtk8.5
libuil4 libxm4 osgearth-data python-opengl python-pyspatialite python-qgis
python-qgis-common qgis qgis-common qgis-plugin-globe
qgis-plugin-globe-common qgis-plugin-grass qgis-plugin-grass-common
qgis-providers qgis-providers-common tcl8.5 tk8.5
0 to upgrade, 39 to newly install, 0 to remove and 0 not to upgrade.
Need to get 62.2 MB of archives.
After this operation, 235 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y

Get:1 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ trusty/main qgis-providers-common all 2.2.0-2~trusty1 [1,539 kB]
Get:2 http://mirror.switch.ch/ftp/mirror/ubuntu/ trusty/universe libmotif-common all 2.3.4-5 [11.8 kB]
Get:3 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ trusty/main libqgis-core2.2.0 amd64 2.2.0-2~trusty1 [2,607 kB]
Get:4 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ trusty/main libqgis-gui2.2.0 amd64 2.2.0-2~trusty1 [1,913 kB]
Get:5 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ trusty/main qgis-providers amd64 2.2.0-2~trusty1 [1,770 kB]
Get:6 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ trusty/main libosgearth3 amd64 2.5.0+dfsg-3~trusty1 [775 kB]
Get:7 http://mirror.switch.ch/ftp/mirror/ubuntu/ trusty/universe libxm4 amd64 2.3.4-5 [967 kB]
Get:8 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ trusty/main libosgearthsymbology3 amd64 2.5.0+dfsg-3~trusty1 [244 kB]
Get:9 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ trusty/main libosgearthfeatures3 amd64 2.5.0+dfsg-3~trusty1 [246 kB]
Get:10 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ trusty/main libosgearthannotation3 amd64 2.5.0+dfsg-3~trusty1 [172 kB]

Get:11 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ trusty/main libosgearthutil3 amd64 2.5.0+dfsg-3~trusty1 [633 kB]
Get:12 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ trusty/main libosgearthqt3 amd64 2.5.0+dfsg-3~trusty1 [176 kB]
Get:13 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ trusty/main libqgis-analysis2.2.0 amd64 2.2.0-2~trusty1 [930 kB]
Get:14 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ trusty/main libqgis-networkanalysis2.2.0 amd64 2.2.0-2~trusty1 [794 kB]
Get:15 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ trusty/main libqgisgrass2.2.0 amd64 2.2.0-2~trusty1 [844 kB]
Get:16 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ trusty/main libqgispython2.2.0 amd64 2.2.0-2~trusty1 [789 kB]
Get:17 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ trusty/main osgearth-data all 2.5.0+dfsg-3~trusty1 [3,946 kB]
Get:18 http://mirror.switch.ch/ftp/mirror/ubuntu/ trusty/universe libmrm4 amd64 2.3.4-5 [56.2 kB]
Get:19 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ trusty/main python-qgis-common all 2.2.0-2~trusty1 [2,882 kB]
Get:20 http://mirror.switch.ch/ftp/mirror/ubuntu/ trusty/universe libspatialindex3 amd64 1.8.1-2 [218 kB]

Get:21 http://mirror.switch.ch/ftp/mirror/ubuntu/ trusty/main libtcl8.5 amd64 8.5.15-2ubuntu1 [684 kB]
Get:22 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ trusty/main python-qgis amd64 2.2.0-2~trusty1 [2,671 kB]
Get:23 http://mirror.switch.ch/ftp/mirror/ubuntu/ trusty/main libtk8.5 amd64 8.5.15-2ubuntu3 [641 kB]
Get:24 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ trusty/main qgis-common all 2.2.0-2~trusty1 [6,335 kB]
Get:25 http://mirror.switch.ch/ftp/mirror/ubuntu/ trusty/universe libuil4 amd64 2.3.4-5 [126 kB]
Get:26 http://mirror.switch.ch/ftp/mirror/ubuntu/ trusty/universe grass-core amd64 6.4.3-3 [7,199 kB]
Get:27 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ trusty/main qgis amd64 2.2.0-2~trusty1 [4,890 kB]
Get:28 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ trusty/main qgis-plugin-globe-common all 2.2.0-2~trusty1 [780 kB]
Get:29 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ trusty/main qgis-plugin-globe amd64 2.2.0-2~trusty1 [856 kB]
Get:30 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ trusty/main qgis-plugin-grass-common all 2.2.0-2~trusty1 [1,198 kB]

Get:31 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/ trusty/main qgis-plugin-grass amd64 2.2.0-2~trusty1 [1,508 kB]
Get:32 http://mirror.switch.ch/ftp/mirror/ubuntu/ trusty/universe grass-doc all 6.4.3-3 [6,303 kB]
Get:33 http://mirror.switch.ch/ftp/mirror/ubuntu/ trusty/main tcl8.5 amd64 8.5.15-2ubuntu1 [13.9 kB]
Get:34 http://mirror.switch.ch/ftp/mirror/ubuntu/ trusty/main tk8.5 amd64 8.5.15-2ubuntu3 [12.0 kB]
Get:35 http://mirror.switch.ch/ftp/mirror/ubuntu/ trusty/universe python-opengl all 3.0.2-1 [364 kB]
Get:36 http://mirror.switch.ch/ftp/mirror/ubuntu/ trusty/universe grass-gui amd64 6.4.3-3 [1,818 kB]
Get:37 http://mirror.switch.ch/ftp/mirror/ubuntu/ trusty/universe libopenscenegraph99 amd64 3.2.0~rc1-4 [5,283 kB]
Get:38 http://mirror.switch.ch/ftp/mirror/ubuntu/ trusty/universe python-pyspatialite amd64 3.0.1-4 [29.4 kB]
Get:39 http://mirror.switch.ch/ftp/mirror/ubuntu/ trusty/universe grass all 6.4.3-3 [6,148 B]
Fetched 62.2 MB in 5s (10.8 MB/s)

Extract templates from packages: 100%
Selecting previously unselected package libmotif-common.
dpkg: warning: files list file for package 'gettext' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'texinfo' missing; assuming package has no files currently installed
(Reading database ... 500015 files and directories currently installed.)
Preparing to unpack .../libmotif-common_2.3.4-5_all.deb ...
Unpacking libmotif-common (2.3.4-5) ...
Selecting previously unselected package libxm4:amd64.
Preparing to unpack .../libxm4_2.3.4-5_amd64.deb ...
Unpacking libxm4:amd64 (2.3.4-5) ...

Selecting previously unselected package libmrm4:amd64.
Preparing to unpack .../libmrm4_2.3.4-5_amd64.deb ...
Unpacking libmrm4:amd64 (2.3.4-5) ...
Selecting previously unselected package libspatialindex3:amd64.
Preparing to unpack .../libspatialindex3_1.8.1-2_amd64.deb ...
Unpacking libspatialindex3:amd64 (1.8.1-2) ...
Selecting previously unselected package libtcl8.5:amd64.
Preparing to unpack .../libtcl8.5_8.5.15-2ubuntu1_amd64.deb ...
Unpacking libtcl8.5:amd64 (8.5.15-2ubuntu1) ...
Selecting previously unselected package libtk8.5:amd64.

Preparing to unpack .../libtk8.5_8.5.15-2ubuntu3_amd64.deb ...
Unpacking libtk8.5:amd64 (8.5.15-2ubuntu3) ...
Selecting previously unselected package libuil4:amd64.
Preparing to unpack .../libuil4_2.3.4-5_amd64.deb ...
Unpacking libuil4:amd64 (2.3.4-5) ...
Selecting previously unselected package qgis-providers-common.
Preparing to unpack .../qgis-providers-common_2.2.0-2~trusty1_all.deb ...
Unpacking qgis-providers-common (2.2.0-2~trusty1) ...
Selecting previously unselected package libqgis-core2.2.0.
Preparing to unpack .../libqgis-core2.2.0_2.2.0-2~trusty1_amd64.deb ...

Unpacking libqgis-core2.2.0 (2.2.0-2~trusty1) ...
Selecting previously unselected package libqgis-gui2.2.0.
Preparing to unpack .../libqgis-gui2.2.0_2.2.0-2~trusty1_amd64.deb ...
Unpacking libqgis-gui2.2.0 (2.2.0-2~trusty1) ...
Selecting previously unselected package qgis-providers.
Preparing to unpack .../qgis-providers_2.2.0-2~trusty1_amd64.deb ...
Unpacking qgis-providers (2.2.0-2~trusty1) ...
Selecting previously unselected package grass-core.
Preparing to unpack .../grass-core_6.4.3-3_amd64.deb ...
Unpacking grass-core (6.4.3-3) ...

Selecting previously unselected package grass-doc.
Preparing to unpack .../grass-doc_6.4.3-3_all.deb ...
Unpacking grass-doc (6.4.3-3) ...
Selecting previously unselected package tcl8.5.
Preparing to unpack .../tcl8.5_8.5.15-2ubuntu1_amd64.deb ...
Unpacking tcl8.5 (8.5.15-2ubuntu1) ...
Selecting previously unselected package tk8.5.
Preparing to unpack .../tk8.5_8.5.15-2ubuntu3_amd64.deb ...
Unpacking tk8.5 (8.5.15-2ubuntu3) ...
Selecting previously unselected package python-opengl.

Preparing to unpack .../python-opengl_3.0.2-1_all.deb ...
Unpacking python-opengl (3.0.2-1) ...
Selecting previously unselected package grass-gui.
Preparing to unpack .../grass-gui_6.4.3-3_amd64.deb ...
Unpacking grass-gui (6.4.3-3) ...
Selecting previously unselected package libopenscenegraph99.
Preparing to unpack .../libopenscenegraph99_3.2.0~rc1-4_amd64.deb ...
Unpacking libopenscenegraph99 (3.2.0~rc1-4) ...
Selecting previously unselected package libosgearth3.
Preparing to unpack .../libosgearth3_2.5.0+dfsg-3~trusty1_amd64.deb ...

Unpacking libosgearth3 (2.5.0+dfsg-3~trusty1) ...
Selecting previously unselected package libosgearthsymbology3.
Preparing to unpack .../libosgearthsymbology3_2.5.0+dfsg-3~trusty1_amd64.deb ...
Unpacking libosgearthsymbology3 (2.5.0+dfsg-3~trusty1) ...
Selecting previously unselected package libosgearthfeatures3.
Preparing to unpack .../libosgearthfeatures3_2.5.0+dfsg-3~trusty1_amd64.deb ...
Unpacking libosgearthfeatures3 (2.5.0+dfsg-3~trusty1) ...
Selecting previously unselected package libosgearthannotation3.
Preparing to unpack .../libosgearthannotation3_2.5.0+dfsg-3~trusty1_amd64.deb ...
Unpacking libosgearthannotation3 (2.5.0+dfsg-3~trusty1) ...

Selecting previously unselected package libosgearthutil3.
Preparing to unpack .../libosgearthutil3_2.5.0+dfsg-3~trusty1_amd64.deb ...
Unpacking libosgearthutil3 (2.5.0+dfsg-3~trusty1) ...
Selecting previously unselected package libosgearthqt3.
Preparing to unpack .../libosgearthqt3_2.5.0+dfsg-3~trusty1_amd64.deb ...
Unpacking libosgearthqt3 (2.5.0+dfsg-3~trusty1) ...
Selecting previously unselected package libqgis-analysis2.2.0.
Preparing to unpack .../libqgis-analysis2.2.0_2.2.0-2~trusty1_amd64.deb ...
Unpacking libqgis-analysis2.2.0 (2.2.0-2~trusty1) ...
Selecting previously unselected package libqgis-networkanalysis2.2.0.

Preparing to unpack .../libqgis-networkanalysis2.2.0_2.2.0-2~trusty1_amd64.deb ...
Unpacking libqgis-networkanalysis2.2.0 (2.2.0-2~trusty1) ...
Selecting previously unselected package libqgisgrass2.2.0.
Preparing to unpack .../libqgisgrass2.2.0_2.2.0-2~trusty1_amd64.deb ...
Unpacking libqgisgrass2.2.0 (2.2.0-2~trusty1) ...
Selecting previously unselected package libqgispython2.2.0.
Preparing to unpack .../libqgispython2.2.0_2.2.0-2~trusty1_amd64.deb ...
Unpacking libqgispython2.2.0 (2.2.0-2~trusty1) ...
Selecting previously unselected package osgearth-data.
Preparing to unpack .../osgearth-data_2.5.0+dfsg-3~trusty1_all.deb ...

Unpacking osgearth-data (2.5.0+dfsg-3~trusty1) ...
Selecting previously unselected package python-qgis-common.
Preparing to unpack .../python-qgis-common_2.2.0-2~trusty1_all.deb ...
Unpacking python-qgis-common (2.2.0-2~trusty1) ...
Selecting previously unselected package python-pyspatialite.
Preparing to unpack .../python-pyspatialite_3.0.1-4_amd64.deb ...
Unpacking python-pyspatialite (3.0.1-4) ...
Preparing to unpack .../python-qgis_2.2.0-2~trusty1_amd64.deb ...
Unpacking python-qgis (2.2.0-2~trusty1) ...
dpkg: error processing archive /var/cache/apt/archives/python-qgis_2.2.0-2~trusty1_amd64.deb (--unpack):

trying to overwrite '/usr/lib/python2.7/dist-packages/pyspatialite/dump.py', which is also in package python-pyspatialite 3.0.1-4
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Selecting previously unselected package qgis-common.
Preparing to unpack .../qgis-common_2.2.0-2~trusty1_all.deb ...
Unpacking qgis-common (2.2.0-2~trusty1) ...
Selecting previously unselected package qgis.
Preparing to unpack .../qgis_2.2.0-2~trusty1_amd64.deb ...
Unpacking qgis (2.2.0-2~trusty1) ...
Selecting previously unselected package qgis-plugin-globe-common.
Preparing to unpack .../qgis-plugin-globe-common_2.2.0-2~trusty1_all.deb ...

Unpacking qgis-plugin-globe-common (2.2.0-2~trusty1) ...
Selecting previously unselected package qgis-plugin-globe.
Preparing to unpack .../qgis-plugin-globe_2.2.0-2~trusty1_amd64.deb ...
Unpacking qgis-plugin-globe (2.2.0-2~trusty1) ...
Selecting previously unselected package qgis-plugin-grass-common.
Preparing to unpack .../qgis-plugin-grass-common_2.2.0-2~trusty1_all.deb ...
Unpacking qgis-plugin-grass-common (2.2.0-2~trusty1) ...
Selecting previously unselected package grass.
Preparing to unpack .../archives/grass_6.4.3-3_all.deb ...
Unpacking grass (6.4.3-3) ...

Selecting previously unselected package qgis-plugin-grass.
Preparing to unpack .../qgis-plugin-grass_2.2.0-2~trusty1_amd64.deb ...
Adding 'diversion of /usr/bin/qgis to /usr/bin/qgis.bin by qgis-plugin-grass'
Adding 'diversion of /usr/bin/qbrowser to /usr/bin/qbrowser.bin by qgis-plugin-grass'
Unpacking qgis-plugin-grass (2.2.0-2~trusty1) ...
Processing triggers for man-db (2.6.7.1-1) ...
Processing triggers for bamfdaemon (0.5.1+14.04.20140409-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for desktop-file-utils (0.22-1ubuntu1) ...
Processing triggers for gnome-menus (3.10.1-0ubuntu2) ...

Processing triggers for mime-support (3.54ubuntu1) ...
Processing triggers for menu (2.1.46ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.13-1) ...
Processing triggers for doc-base (0.10.5) ...
Processing 1 added doc-base file...
Registering documents with scrollkeeper...
Processing triggers for shared-mime-info (1.2-0ubuntu3) ...
Errors were encountered while processing:
/var/cache/apt/archives/python-qgis_2.2.0-2~trusty1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)


Answer



Until Ubuntugis supports all required packages (especially GDAL and spatialite), it is recommended to use the official QGIS repository:


https://www.qgis.org/en/site/forusers/alldownloads.html#ubuntu


It works for me, except for the exotic drivers that require special gdal packages. These will be available from ubuntugis again once they are finished.


geojson - How to plot geo-data using matplotlib/python


I am trying to plot a polygone on python, using different libararies, but no one of these worked with me. I tried vincent ,Shapely , .. and now matplotlib. I don't wanna use softwares like qgis


I used this example: http://geographika.co.uk/visualising-geojson-in-15-minutes


from matplotlib import pyplot
from descartes import PolygonPatch
import math
import urllib2
import simplejson


data = []
with open('file.json') as f:
for line in f:
data.append(json.loads(line))


def plotFeature(coordlist, myplot):
#create a polygon geojson-like feature
poly = {"type": "Polygon", "coordinates": coordlist}

patch = PolygonPatch(poly, fc='#6699cc', ec='#6699cc', alpha=0.5, zorder=2)
#plot it on the graph
myplot.add_patch(patch)


for coordlist in data['features'][0]['geometry']['coordinates']:
plotFeature(coordlist, myplot)

fig = pyplot.figure(1, figsize=(10, 4), dpi=180)
ax = fig.add_subplot(121)

ax.savefig('myplot.png')

External file "file.json"


var states = [{
"type": "Feature",
"properties": {"party": "Republican"},
"geometry":

{
"type": "Polygon",

"coordinates": [
[
[
-84.32281494140625,
34.9895035675793
],
[
-84.29122924804688,
35.21981940793435
],

[
-84.24041748046875,
35.25459097465022
],
[
-84.22531127929688,
35.266925688950074
],
[
-84.20745849609375,

35.26580442886754
],
[
-84.19921875,
35.24674063355999
],
[
-84.16213989257812,
35.24113278166642
],

[
-84.12368774414062,
35.24898366572645
],
[
-84.09072875976562,
35.24898366572645
],
[
-84.08798217773438,

35.264683153268116
],
[
-84.04266357421875,
35.27701633139884
],
[
-84.03030395507812,
35.291589484566124
],

[
-84.0234375,
35.306160014550784
],
[
-84.03305053710936,
35.32745068492882
],
[
-84.03579711914062,

35.34313496028189
],
[
-84.03579711914062,
35.348735749472546
],
[
-84.01657104492188,
35.35545618392078
],

[
-84.01107788085938,
35.37337460834958
],
[
-84.00970458984374,
35.39128905521763
],
[
-84.01931762695312,

35.41479572901859
],
[
-84.00283813476562,
35.429344044107154
],
[
-83.93692016601562,
35.47409160773029
],

[
-83.91220092773438,
35.47632833265728
],
[
-83.88885498046875,
35.504282143299655
],
[
-83.88473510742186,

35.516578738902936
],
[
-83.8751220703125,
35.52104976129943
],
[
-83.85314941406249,
35.52104976129943
],

[
-83.82843017578125,
35.52104976129943
],
[
-83.8092041015625,
35.53446133418443
],
[
-83.80233764648438,

35.54116627999813
],
[
-83.76800537109374,
35.56239491058853
],
[
-83.7432861328125,
35.56239491058853
],

[
-83.71994018554688,
35.56239491058853
],
[
-83.67050170898438,
35.569097520776054
],
[
-83.6334228515625,

35.570214567965984
],
[
-83.61007690429688,
35.576916524038616
],
[
-83.59634399414061,
35.574682600980914
],

[
-83.5894775390625,
35.55904339525896
],
[
-83.55239868164062,
35.56574628576276
],
[
-83.49746704101562,

35.563512051219696
],
[
-83.47000122070312,
35.586968406786475
],
[
-83.4466552734375,
35.60818490437746
],

[
-83.37936401367188,
35.63609277863135
],
[
-83.35739135742188,
35.65618041632016
],
[
-83.32305908203124,

35.66622234103479
],
[
-83.3148193359375,
35.65394870599763
],
[
-83.29971313476561,
35.660643649881614
],

[
-83.28598022460938,
35.67180064238771
],
[
-83.26126098632811,
35.6907639509368
],
[
-83.25714111328125,

35.69968630125201
],
[
-83.25576782226562,
35.715298012125295
],
[
-83.23516845703125,
35.72310272092263
],

[
-83.19808959960936,
35.72756221127198
],
[
-83.16238403320312,
35.753199435570316
],
[
-83.15826416015625,

35.76322914549896
],
[
-83.10333251953125,
35.76991491635478
],
[
-83.08685302734375,
35.7843988251953
],

[
-83.0511474609375,
35.787740890986576
],
[
-83.01681518554688,
35.78328477203738
],
[
-83.001708984375,

35.77882840327371
],
[
-82.96737670898438,
35.793310688351724
],
[
-82.94540405273438,
35.820040281161
],

[
-82.9193115234375,
35.85121343450061
],
[
-82.9083251953125,
35.86902116501695
],
[
-82.90557861328125,

35.87792352995116
],
[
-82.91244506835938,
35.92353244718235
],
[
-82.88360595703125,
35.94688293218141
],

[
-82.85614013671875,
35.951329861522666
],
[
-82.8424072265625,
35.94243575255426
],
[
-82.825927734375,

35.92464453144099
],
[
-82.80670166015625,
35.927980690382704
],
[
-82.80532836914062,
35.94243575255426
],

[
-82.77923583984375,
35.97356075349624
],
[
-82.78060913085938,
35.99245209055831
],
[
-82.76138305664062,

36.00356252895066
],
[
-82.69546508789062,
36.04465753921525
],
[
-82.64465332031249,
36.060201412392914
],

[
-82.61306762695312,
36.060201412392914
],
[
-82.60620117187499,
36.033552893400376
],
[
-82.60620117187499,

35.991340960635405
],
[
-82.60620117187499,
35.97911749857497
],
[
-82.5787353515625,
35.96133453736691
],

[
-82.5677490234375,
35.951329861522666
],
[
-82.53067016601562,
35.97244935753683
],
[
-82.46475219726562,

36.006895355244666
],
[
-82.41668701171875,
36.070192281208456
],
[
-82.37960815429686,
36.10126686921446
],

[
-82.35488891601562,
36.117908916563685
],
[
-82.34115600585936,
36.113471382052175
],
[
-82.29583740234375,

36.13343831245866
],
[
-82.26287841796874,
36.13565654678543
],
[
-82.23403930664062,
36.13565654678543
],

[
-82.2216796875,
36.154509006695
],
[
-82.20382690429688,
36.15561783381855
],
[
-82.19009399414062,

36.144528857027744
],
[
-82.15438842773438,
36.15007354140755
],
[
-82.14065551757812,
36.134547437460064
],

[
-82.1337890625,
36.116799556445024
],
[
-82.12142944335938,
36.10570509327921
],
[
-82.08984375,

36.10792411128649
],
[
-82.05276489257811,
36.12678323326429
],
[
-82.03628540039062,
36.12900165569652
],

[
-81.91268920898438,
36.29409768373033
],
[
-81.89071655273438,
36.30959215409138
],
[
-81.86325073242188,

36.33504067209607
],
[
-81.83029174804688,
36.34499652561904
],
[
-81.80145263671875,
36.35605709240176
],

[
-81.77947998046874,
36.34610265300638
],
[
-81.76162719726562,
36.33835943134047
],
[
-81.73690795898438,

36.33835943134047
],
[
-81.71905517578125,
36.33835943134047
],
[
-81.70669555664062,
36.33504067209607
],

[
-81.70669555664062,
36.342784223707234
],
[
-81.72317504882812,
36.357163062654365
],
[
-81.73278808593749,

36.379279167407965
],
[
-81.73690795898438,
36.40028364332352
],
[
-81.73690795898438,
36.41354670392876
],

[
-81.72454833984374,
36.423492513472326
],
[
-81.71768188476562,
36.445589751779174
],
[
-81.69845581054688,

36.47541104282962
],
[
-81.69845581054688,
36.51073994146672
],
[
-81.705322265625,
36.53060536411363
],

[
-81.69158935546875,
36.55929085774001
],
[
-81.68060302734375,
36.56480607840351
],
[
-81.68197631835938,

36.58686302344181
],
[
-81.04202270507812,
36.56370306576917
],
[
-80.74264526367186,
36.561496993252575
],

[
-79.89120483398438,
36.54053616262899
],
[
-78.68408203124999,
36.53943280355122
],
[
-77.88345336914062,

36.54053616262899
],
[
-76.91665649414062,
36.54163950596125
],
[
-76.91665649414062,
36.55046568575947
],

[
-76.31103515625,
36.551568887374
],
[
-75.79605102539062,
36.54936246839778
],
[
-75.6298828125,

36.07574221562703
],
[
-75.4925537109375,
35.82226734114509
],
[
-75.3936767578125,
35.639441068973916
],

[
-75.41015624999999,
35.43829554739668
],
[
-75.43212890625,
35.263561862152095
],
[
-75.487060546875,

35.18727767598896
],
[
-75.5914306640625,
35.17380831799959
],
[
-75.9210205078125,
35.04798673426734
],

[
-76.17919921875,
34.867904962568744
],
[
-76.41540527343749,
34.62868797377061
],
[
-76.4593505859375,

34.57442951865274
],
[
-76.53076171875,
34.53371242139567
],
[
-76.5911865234375,
34.551811369170494
],

[
-76.651611328125,
34.615126683462194
],
[
-76.761474609375,
34.63320791137959
],
[
-77.069091796875,

34.59704151614417
],
[
-77.376708984375,
34.45674800347809
],
[
-77.5909423828125,
34.3207552752374
],

[
-77.8326416015625,
33.97980872872457
],
[
-77.9150390625,
33.80197351806589
],
[
-77.9754638671875,

33.73804486328907
],
[
-78.11279296875,
33.8521697014074
],
[
-78.2830810546875,
33.8521697014074
],

[
-78.4808349609375,
33.815666308702774
],
[
-79.6728515625,
34.8047829195724
],
[
-80.782470703125,

34.836349990763864
],
[
-80.782470703125,
34.91746688928252
],
[
-80.9307861328125,
35.092945313732635
],

[
-81.0516357421875,
35.02999636902566
],
[
-81.0516357421875,
35.05248370662468
],
[
-81.0516357421875,

35.137879119634185
],
[
-82.3150634765625,
35.19625600786368
],
[
-82.3590087890625,
35.19625600786368
],

[
-82.40295410156249,
35.22318504970181
],
[
-82.4688720703125,
35.16931803601131
],
[
-82.6885986328125,

35.1154153142536
],
[
-82.781982421875,
35.06147690849717
],
[
-83.1060791015625,
35.003003395276714
],

[
-83.616943359375,
34.99850370014629
],
[
-84.05639648437499,
34.985003130171066
],
[
-84.22119140625,

34.985003130171066
],
[
-84.32281494140625,
34.9895035675793
]
],
[
[
-75.69030761718749,

35.74205383068037
],
[
-75.5914306640625,
35.74205383068037
],
[
-75.5419921875,
35.585851593232356
],

[
-75.56396484375,
35.32633026307483
],
[
-75.69030761718749,
35.285984736065735
],
[
-75.970458984375,

35.16482750605027
],
[
-76.2066650390625,
34.994003757575776
],
[
-76.300048828125,
35.02999636902566
],

[
-76.409912109375,
35.07946034047981
],
[
-76.5252685546875,
35.10642805736423
],
[
-76.4208984375,

35.25907654252574
],
[
-76.3385009765625,
35.294952147406576
],
[
-76.0858154296875,
35.29943548054543
],

[
-75.948486328125,
35.44277092585766
],
[
-75.8660888671875,
35.53669637839501
],
[
-75.772705078125,

35.567980458012094
],
[
-75.706787109375,
35.634976650677295
],
[
-75.706787109375,
35.74205383068037
],

[
-75.69030761718749,
35.74205383068037
]
]
]
} } ]

But it doesn't seem to work out. I need to plot these coordinates with a map on background. Any example, library, tutorial to recommend ?




arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...