Re: [Qgis-user] qgis-server issue whit custom RS. Impossible to work with planetary data (sorry for possible cross-posting)

2013-11-26 Thread Marco Hugentobler

Hi Andrea

Using custom CRS with QGIS server is not so common, so probably it is a 
bug in the server code. However I'm not sure what the correct way is to 
call a user CRS in a WMS request (need to have a look in the WMS spec).


Regards,
Marco

On 25.11.2013 21:42, andrea pacifici wrote:


Hi there,

I'm trying to set-up a WMS server using the qgis-server (qgis 2.0 and
Ubuntu 12.04) and data of planet Mars. Since Mars is not the Earth I
must use custom RS. So, I have realized a qgis project with Martian
data and I have properly filled fields in OWS server of Project
Properties.

Then I started a new Qgis project using the same custom RS and I try
to add the layers using Add layer from a server command. Once Qgis
is connected to the server the layers name are visible but layers
don't appears.

WMS Log Messages report:

Map request error (Title:Service Exception; Error:Request contains a
CRS not offered by the server for one or more of the Layers in the
request.
The WMS vendor also reported: Could not create output CRS; URL:
http://localhost/cgi-bin/liz_test/qgis_mapserv.fcgi?SERVICE=WMSVERSION=1.3.0REQUEST=GetMapBBOX=-112389.97944659927452449,-163304.16266460958286189,99132.64792997627228033,-33665.77575473205070011CRS=USER:10WIDTH=574HEIGHT=352LAYERS=molaSTYLES=FORMAT=image/jpegDPI=96MAP_RESOLUTION=96FORMAT_OPTIONS=dpi:96)

I copied my own CRS in the RS database of Qgis in
/usr/share/qgis/resources/srs.

db but I have still the same issue.

Any idea?

Thanks!

Andrea


___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user



--
Dr. Marco Hugentobler
Sourcepole -  Linux  Open Source Solutions
Weberstrasse 5, CH-8004 Zürich, Switzerland
marco.hugentob...@sourcepole.ch http://www.sourcepole.ch
Technical Advisor QGIS Project Steering Committee

___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] qgis-server issue whit custom RS. Impossible to work with planetary data (sorry for possible cross-posting)

2013-11-26 Thread G. Allegri
I don't see where QGIS Server could differ from QGIS Desktop in retrieving
the output CRS. It seems to use the same mechanism (through QgsCRSCache).
Andrea, can you confirm it works properly inside QGIS Desktop? Would you
share the user defined CRS and some extract of your data in that CRS?

Giovanni


2013/11/26 Marco Hugentobler marco.hugentob...@sourcepole.ch

  Hi Andrea

 Using custom CRS with QGIS server is not so common, so probably it is a
 bug in the server code. However I'm not sure what the correct way is to
 call a user CRS in a WMS request (need to have a look in the WMS spec).

 Regards,
 Marco

 On 25.11.2013 21:42, andrea pacifici wrote:

  Hi there,

 I'm trying to set-up a WMS server using the qgis-server (qgis 2.0 and
 Ubuntu 12.04) and data of planet Mars. Since Mars is not the Earth I
 must use custom RS. So, I have realized a qgis project with Martian
 data and I have properly filled fields in OWS server of Project
 Properties.

 Then I started a new Qgis project using the same custom RS and I try
 to add the layers using Add layer from a server command. Once Qgis
 is connected to the server the layers name are visible but layers
 don't appears.

 WMS Log Messages report:

 Map request error (Title:Service Exception; Error:Request contains a
 CRS not offered by the server for one or more of the Layers in the
 request.
 The WMS vendor also reported: Could not create output CRS; URL:

 http://localhost/cgi-bin/liz_test/qgis_mapserv.fcgi?SERVICE=WMSVERSION=1.3.0REQUEST=GetMapBBOX=-112389.97944659927452449,-163304.16266460958286189,99132.64792997627228033,-33665.77575473205070011CRS=USER:10WIDTH=574HEIGHT=352LAYERS=molaSTYLES=FORMAT=image/jpegDPI=96MAP_RESOLUTION=96FORMAT_OPTIONS=dpi:96
 )

 I copied my own CRS in the RS database of Qgis in
 /usr/share/qgis/resources/srs.
 db but I have still the same issue.

 Any idea?

  Thanks!

  Andrea


 ___
 Qgis-user mailing 
 listQgis-user@lists.osgeo.orghttp://lists.osgeo.org/mailman/listinfo/qgis-user



 --
 Dr. Marco Hugentobler
 Sourcepole -  Linux  Open Source Solutions
 Weberstrasse 5, CH-8004 Zürich, switzerlandmarco.hugentob...@sourcepole.ch 
 http://www.sourcepole.ch
 Technical Advisor QGIS Project Steering Committee


 ___
 Qgis-user mailing list
 Qgis-user@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/qgis-user




-- 
Giovanni Allegri
http://about.me/giovanniallegri
blog: http://blog.spaziogis.it
GEO+ geomatica in Italia http://bit.ly/GEOplus
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] Merging multiple shapefiles - why doesn't it work?

2013-11-26 Thread Alex Mandel
On 11/25/2013 07:24 AM, BigBaka wrote:
 Hi, I have for a particular province in my country of question I have
 multiple separate folders for each segment of the province and I'm trying to
 get all the segments combined into one larger shapefile for each unit (eg
 rivers). I've been looking around forums to try and do this seemingly simple
 task, but cannot find a solution that seems to work.Trying to use the merge
 shapefiles in Vector- Data Management Tools doesn't seem to be a great
 option because it seems that you can only merge 2 files at a time, which is
 not particularly practical with 20 odd files. So I looked around and found a
 plugin called mmqgis which has a Merge Layers option which seems to offer a
 way to highlight certain layers in the TOC and spit out an output into a new
 shapefile. Everything seemed to work when I tried this but finally, I
 realised that not all the layers had been copied into the new shapefile. In
 fact it seems that only one or two layers will be combined at any one time.
 Lastly I followed a suggestion  here
 http://osgeo-org.1560.x6.nabble.com/Merging-3-different-Shapefiles-tt4138254.html#a4138257
   
 to copy and paste the attribute tables from each different shapefile into a
 new shapefile. This seemed to work until I saved the new shapefile, and all
 the values in the attribute table turned to NULL. I have exactly the same
 problem running Windows 7 (QGIS 1.8) and Ubuntu 12.04 (QGIS 2.0).Any
 suggestions welcome.ThanksBigBaka
 
 


Depends on if you want to learn to script a loop. You can definitely use
ogr2ogr on the command line with the append option. You'd need to write
a short script to loop over all shp files in your directory adding them
one at time. Or do something similar by importing all of the files into
a spatialite or postgis database (both could also be scripted).

Enjoy,
Alex
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user


[Qgis-user] strange results when calculating area and perimeter

2013-11-26 Thread rob vech

Hello,
I'm using the wounderful (:)) qgis Dufour 2.0.1 and I'm trying to 
calculate area and perimeter from a simple shapefile with CRS WGS84UTM32 
following these steps:
1) set up the CRS of the project to WGS84UTM32 (on the fly 
transformation is checked)

2) load the shapefile
3) click on it with the identifier tool (identify features) I obtain:
- area: 19.321 km²
- perimeter: 0.221 m ()
4) then I try to calculate in the table ...
- area: 2,301,030,218 while in the preview was 19,320,205.394043 ()
- perimeter: 2,859,402,286 while in the preview was 20,391.7709396732 ()

then I modify the general CRS settings for new project (settings -- 
options) to WGS84UTM32 and, after reloading qgis, I did steps 1, 2 again 
and I obtained:

3bis) in the identify tool:
- area: 19.321 km²
- perimeter: 20.392 km
4bis) and in table:
- area: 19,320,205.3
- perimeter: 20,391.771

The second way seems to give more consistent results.
But why should I setup the general CRS option if I've already setup the 
project CRS?

Shouldn't the geometry function all referred to the project settings?
There is something of wrong in my first procedure?
Thank you in advance
rob





___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user

[Qgis-user] How to generate a topo map from an excel file

2013-11-26 Thread Eyal Saiet
Hello all,
I have an excel file that looks like a 2D array ( Lat and Long on the
axis). I would like to convert this file to a topo map using QGIS.
First, I would like to add that Excel sheet, but is too large so it will
not go through the server e-mail-list. Second, I would appreciate any
solutions to the merit of the problem.

Suggestions?

-- 
Eyal Saiet

University of Alaska Fairbanks
Fairbanks, AK 99775
(907) 750 6555 (cell)

ejsa...@alaska.edu gregory.wal...@gi.alaska.edu
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] How to generate a topo map from an excel file

2013-11-26 Thread Alexandre Neto
Hello Eyal,

You need to convert your excel into a Comma Separate Values (CSV) file. You
can do it in Excel itself using save as...

After that, you can use the Layer  Add Delimited Text Layer to add your
file in the map as points.

Best regards,

Alexandre Neto



On Tue, Nov 26, 2013 at 10:16 AM, Eyal Saiet ejsa...@alaska.edu wrote:

 Hello all,
 I have an excel file that looks like a 2D array ( Lat and Long on the
 axis). I would like to convert this file to a topo map using QGIS.
 First, I would like to add that Excel sheet, but is too large so it will
 not go through the server e-mail-list. Second, I would appreciate any
 solutions to the merit of the problem.

 Suggestions?

 --
 Eyal Saiet

 University of Alaska Fairbanks
 Fairbanks, AK 99775
 (907) 750 6555 (cell)

 ejsa...@alaska.edu gregory.wal...@gi.alaska.edu

 ___
 Qgis-user mailing list
 Qgis-user@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/qgis-user

___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user

[Qgis-user] Custom color managing

2013-11-26 Thread Jorge Tornero - Listas

Dear all:

I've trying to speed up diagram creation. I have a bunch of layers with 
the same fields (rigth now it's difficult to have a single layer and 
filter it) where I want to display diagrams.


I have to set each individual color in each layer. Maybe it would be 
nice to have a way of saving the diagram style, so it is loadable like 
layer style, but now i'm just thinking about have a set of colors easily 
accesible, like color picker *custom colors*


The problem is that AFAIK I can't remove colors from inside *custom 
colors* nor define a new palette, so my current custom color palette 
is useless.


Is there a method to accomplish this? Where are palettes stored (to try 
to remove/create manually)?


Thanks in advance

Jorge Tornero
Instituto Español de Oceanografía
Centro Oceanográfico de Cádiz
www.ieo.es
Cádiz, Spain

Personal web http://imasdemase.com
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] strange results when calculating area and perimeter

2013-11-26 Thread Harish
I have made a long discussion on the matter in July 2012.
http://lists.osgeo.org/pipermail/qgis-user/2012-July/018177.html

So with the same Datum/Ellipsoid the area/perimeter/length values remain
different with different tools/ways ( like Identify Features, Export/Add
geometry columns, Measure tool, Field calculator),  even for the same
Projection (I have tried with EPSG:4326 and EPSG:32643.

Regards
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user

[Qgis-user] Field calculator issue

2013-11-26 Thread Carlos Cerdán
Hi list:

(Maybe related with Rob Vech e-mail: strange results when calculating area
and perimeter )

I'm was trying calculate area of a layer with two polygons, but I can't get
right values. Layer and project are in UTM 17s (epsg 32717) projection. I
want square kilometers, so the used expression is:

$area/10

Field type is real, 10 digits, 2 decimals (also tryed with 15 digits) buth
result is wrong for one polygon and zero for second.

The layer has not geometric errors (I've check it), and can be download
from
https://sites.google.com/site/ccerdan/Home/Cuencas_Cajamarca.zip?attredirects=0d=1

There are a field Area_KM2 that was calculated in ArcGIS and it has the
right values. The Area_Ha has the (wrong) result of QGIS field calculator.

What is wrong with field calculator?

UPDATE: After a reboot, field calculator found the right values... but What
was wrong?

Carlos
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user

[Qgis-user] Layer Visibility and Atlas

2013-11-26 Thread Lee Hachadoorian
Is there a way to restrict layer visibility when using the atlas 
capability of Print Composer? For example, let's say I have a points of 
interest layer, but I only want the POIs that fall *in* the current 
coverage layer feature to display, not the POIs in the neighboring areas 
(i.e., at the edges of the map).


Best,
--Lee

--
Lee Hachadoorian
Assistant Professor in Geography, Dartmouth College
http://geospatial.commons.gc.cuny.edu
http://freecity.commons.gc.cuny.edu

___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] including images in (database) attributes

2013-11-26 Thread kimaidou
Hi all

We also implemented Image dynamic link in Lizmap Web Client. You need to
store the image file in a media folder relative the the project, fill an
attribute of the layer with relative path to the image files
(e.ggmedia/pictures/photo1.jpg ) . In the web client the image is
displayed in
the information popup (getFeatureInfo). If the file is not a photo, Lizmap
popup shows a link to the file (pdf, zip, etc.).

Example here :
http://demo.lizmap.3liz.com/index.php/view/map/?repository=montpellierproject=montpellierzoom=1lat=5405666.66058lon=431227.17957layers=B0FTFFFTFTT
You can click on one district polygon to show the popup. The attribute
illustration contains the relative path to the image (with a link to open
it in a new tab).

The photo widget in QGIS forms is the right way to go. We must make the
stored path relative to the project though, to help people move or publish
the project and data easily.

Michael


2013/11/25 Brent Wood pcr...@pcreso.com


 Cheers Niklaas,

 The website is developed using the Silverstripe CMS,
 rai...@silverstripe.com is the guy behind the web mapping stuff. The
 images are retrieved using a custom web service, from a local image
 database (now with several 100,000 images). Commercial application called
 Atlas (www.atlamd.com).

 We funded the development of a map search for images in Atlas, which we
 are looking to update at present. See the map search tool at
 https://atlas.niwa.co.nz/public.jsp

 Enable Assets - images (right of map)
 update the map (button top right of map)
 (don't zoom right now - the back end web map server is broken)

 Choose the left hand Marquee selection tool (box)
 draw a box around some area with images on the map
 the images in that box will be displayed...
  (note that I've just added about 16,000 echogram images - they are being
 processed, with thumbnails, etc being generated in a low priority
 background job - so you'll see lots of entries with no thumbnails until
 that completes)

 This also seems to be very similar to the sort of facility you are looking
 at implementing - images associated with features (or locations) on a map
 which can be previewed  downloaded.

 I'm considering developing a QGIS plugin to provide similar access from a
 map based desktop - part of this initiative:
 http://www.niwa.co.nz/software/quantum-map


 Brent

   --
  *From:* Niklaas Baudet von Gersdorff nikl...@kulturflatrate.net
 *To:* qgis-user@lists.osgeo.org qgis-user@lists.osgeo.org
 *Sent:* Tuesday, November 26, 2013 10:10 AM
 *Subject:* Re: [Qgis-user] including images in (database) attributes

 Hi Brent,

 Brent Wood [2013-11-25 12:38 -0800] :

 Not quite sure how this fits your needs, but the QGIS actions facility
 was
 implemented originally to do just this on the desktop - and it works well.

 OK, great I'll have a look at it!

 Also, we did not use QGIS for this, but built an (Open Source) web
 facility to
 do this, with a set of images at each location:
 [1]http://www.os2020.org.nz/project-map/
 Click a green triangle (DTIS location) to drill down to the images at each
 site...

 This looks great! I could at least digg in the code and get some ideas.

 May give you some ideas if nothing else

 Definitely! Thank you,


 Niklaas

 --
 Niklaas Baudet von Gersdorff
 nikl...@kulturflatrate.net

 http://www.kulturflatrate.net/niklaas
 ___
 Qgis-user mailing list
 Qgis-user@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/qgis-user



 ___
 Qgis-user mailing list
 Qgis-user@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/qgis-user

___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] What is the best way to do a simple watershed analysis on a raster grid?

2013-11-26 Thread kimaidou
Hi

I already tried the saga and grass tools via Processing framework. They are
really powerfull, but also really complicated in my opinion. Hard to find
the correct algo, the correct treshold, necessity to manually vectorize the
produced watershed raster (I have surely missed something here...), etc.
I am surely not an hydrology expert, but I am convinced that we could
create a full processing model wich let humble users do the job.
Any pointers to documentation or examples would be apreciated if anyone
know some (I searched grass catchment basin or other keywords and could
not find a step by step procedure adapted to beginners)

Michael


2013/11/25 Alexander Bruy alexander.b...@gmail.com

 Hi Rob,

 you can try to do this with Processing framework. There is
 at least three different providers that have watershed analysis
 tools: GRASS, SAGA and TauDEM

 2013/11/24 Rob Stewart rstew...@hydrologyandwater.com.au:
  Hi,
  What's the best way to do a simple watershed analysis on a raster grid?
  I'm
  wanting to generate rainfall/runoff sub-catchment polygons.
  Rob
 
 
  ___
  Qgis-user mailing list
  Qgis-user@lists.osgeo.org
  http://lists.osgeo.org/mailman/listinfo/qgis-user



 --
 Alexander Bruy
 ___
 Qgis-user mailing list
 Qgis-user@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/qgis-user

___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user

[Qgis-user] Corrupted Files

2013-11-26 Thread Pete Cimbolic
I am running QGIS 1.8 and 2.0 on Parallels on a Mac. I am starting to have a 
problem when I go to open previous projects. The error says: 

Project file read error: error occurred while parsing element at line 1891 
column 27 for file C:/Documents 

It does not happen all the time, and luckily, I have good back-up of most 
files, so I can go back to a previously stored version. However, I lose a lot 
of work when I have to do this. has anyone encountered this? Any suggestions?

Pete Cimbolic
cimbo...@aclu-md.org




___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Distinct Colors for American Map

2013-11-26 Thread Lee Hachadoorian


On 11/16/2013 03:43 PM, Dan Dittmann wrote:


On Nov 15, 2013, at 7:09 PM, Sasa Sullivan wrote:

I am learning QGIS and know the general instructions on how to color 
code areas through the Style feature but am not able to get a 
distinct color per state for a map of the USA, maybe it is my source 
as I don't see one listed that encompasses the state shape only.
Also I only need the state, city and county boundaries, if someone 
has a scaled down Open Source shape files for the USA it would be 
helpful as I don't have unlimited hard drive space for the ones I 
have found


Sasa
___



Hello Sasa,

Without knowing where your data was obtained, I cannot speculate on 
the trouble encountered. The instructions below assume QGIS 2.01 is 
used and should be usable with adjustments on older versions as well.


First lets get some data. The National Atlas website has numerous 
shape files available for download. Most of what you are looking for 
should be available 
fromhttp://nationalatlas.gov/atlasftp.html?openChapters=%2Cchpbound#chpbound. 



In this demo, I will be using the State Boundaries, One Million-Scale 
layer available for download at 
http://dds.cr.usgs.gov/pub/data/nationalatlas/statep010_nt00798.tar.gz.


- Extract the archive and import the file statep010.shp into QGIS.
- Open the Properties dialog for the imported layer.
- Click Style from the column on the left.
- Locate the menu Single Symbol and change that to Categorized.
- Change the Column menu to State Click the Classify button.
- Click OK.

You now have a basic US Map with each state colored with a unique color.

Dan


Sasa,

The Census provides generalized shapes at 
http://www.census.gov/geo/maps-data/data/tiger-cart-boundary.html, in 
addition to the high-precision TIGER/Line files.


I would also look at Natural Earth which is a dataset designed for 
cartography at different scales. Their Admin 1 - States Provinces 
dataset will include the US and other countries' subnational units. 
Their data also includes various mapcolorX columns so that you can use 
a categorical theme as described by Dan to style your map with X colors, 
with no states touching another state styled with the same color.


Best,
--Lee
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user


[Qgis-user] In lieu of a QGIS 2.0 Homebrew formula ...

2013-11-26 Thread Robert Nix
Here's a link to a Gist i wrote today to build QGIS 2 from source against
Homebrew-only packages.

https://plus.google.com/+nicerobot/posts/cvAUMoSVVWN

ref: https://gist.github.com/nicerobot/7664605
ref: http://lists.osgeo.org/pipermail/qgis-user/2013-September/024129.html

Hope you find it useful ... and working :)
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] In lieu of a QGIS 2.0 Homebrew formula ...

2013-11-26 Thread Larry Shaffer
Hi Robert,

Nice work on that! Concerning the Homebrew QGIS formula, I have been
working on a major update. I've added several new formula as well, to
achieve a *complete and stable* working environ for the user, as well as
PyQGIS and QGIS developers.

Notably, there is now support for:

* QGIS Server
* Globe plugin (with latest osgEarth 2.5)
* Many of the Processing extras (R, OrfeoToolbox, Saga)
* Spatialite access in DB Manager
* Required Python modules
* Local API doc generation
* Debug output builds for master branch (HEAD)
* Current PostgreSQL access client
* GPSBabel, for GPS Tools plugin
* Separate Lwgeom library/formula for third-party Processing plugin

From scratch, the entire formula, with all options, will take several hours
or more to compile on a fast Mac. The build can be in the normal Homebrew
prefix of `/usr/local` as well as custom prefixes.

Currently the work is in a 'tap' here [0]. Some of the new formula have
been accepted as pull requests, while others are in pull request limbo.
Until many of the base formulae are committed (maybe) upstream, any formula
in my tap will do the trick. There are duplicates of `gdal` and `grass`
that will be *ignored* when updating the tap. I'm currently keeping them in
sync with the main Homebrew tap while we work out the 10.9 upgrade bugs.
You can manually use them if you are familiar with editing formulae and
managing your local Homebrew git repository on the main tap.

The QGIS 2.0 formula [1] is in a 'beta' state, and requires a good
understanding of Homebrew to tinker with right now. It is about 85%
complete, though does currently compile fine on OS X 10.7-8, while 10.9 is
a work-in-progress and 10.6 is completely untested.

Any help or testing, or pull requests to my tap's repo, would be gladly
appreciated. Thanks to John Tull for his help on this and for his many pull
requests to the upstream Homebrew project. Feel free to contact me for help
if you embark on using the formula in the tap.

[0] https://github.com/dakcarto/homebrew-osgeo4mac
[1]
https://github.com/dakcarto/homebrew-osgeo4mac/blob/master/Formula/qgis-20.rb

Regards,

Larry Shaffer
Dakota Cartography
Black Hills, South Dakota


On Tue, Nov 26, 2013 at 8:08 PM, Robert Nix rob...@urban4m.com wrote:

 Here's a link to a Gist i wrote today to build QGIS 2 from source against
 Homebrew-only packages.

 https://plus.google.com/+nicerobot/posts/cvAUMoSVVWN

 ref: https://gist.github.com/nicerobot/7664605
 ref: http://lists.osgeo.org/pipermail/qgis-user/2013-September/024129.html

 Hope you find it useful ... and working :)


 ___
 Qgis-user mailing list
 Qgis-user@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/qgis-user

___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user

[Qgis-user] Field comparision

2013-11-26 Thread Jorge Tornero - Listas

Hi list,

I'm developing a Python plugin for QGIS and one of the features of this 
plugin is that the user can choose to create a new layer to store the 
points generated by the plugin or store them in a existing point layer.


Every point has an associated information (attributes or fields), and in 
the case of new layer creation, it's easy to create the new layer with 
those attributes (say, for instance, name, number and temperature).


But in the case of using a existing layer to store the points, I want 
first to check if the destination layer already has those fields; in 
that case i'll use them directly but if the fields doesn't exist in the 
layer, I'll give the user the chance to add it to the layer. This is 
pretty simple, too.


But my approach to check for existing fields, consists in creating some 
QgsFields with the desired specs and check for equality against the 
layer fields.


The problem is that the operator == of the class QgsField doesn't work 
properly, because it looks like when the fields are not of the string 
type, the comparision is bad. Seems that default construction of 
QgsFields of the type integer or double is different than the default 
construction of these fields when creating a layer with:


QgsVectorLayer(
Point?field=id:integerfield=survey:string(20)field=station:string(5)field=stnnum:integerfield=stnlat:doublefield=stnlon:doublefield=stnobs:string(255)index=yes,
  newLayer,
  memory)

In the latter case, the field stnnum has:

name=stnnum
type=2
typeName=integer
length=10
precision=0

while if you create the ssame field with:

stnnumField=QgsField(name='stnnum',type=2,typeName='integer')

name=stnnum
type=2
typeName=integer
length=0
precision=0

And that's why == doesn't work as expected (for me, of course)

So maybe this approach is not very good.

Any ideas to override this behaviour or just check for existing fields?


Best regards,

Jorge Tornero




___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user