Re: [Qgis-user] zoomtopoint.py

2014-09-02 Thread Vincent Schut

On 09/02/2014 09:41 AM, Jukka Rahkonen wrote:

Vincent Schut  writes:


Hi Mike,

I'm not familiar with this zoomtopoint.py, however, your coordinates do
not seem to match your projection. EPSG 4326 is geographic lon, lat in
degrees, so its range is from -180 to 180 (x) and -90 to 90 (y). The
numbers you put as X and Y seem more appropriate for a meters based
projection. Maybe try some real coordinates in degrees, or change your
projection...

You can familiarize yourself with the script by reading the link
http://www.qgis.nl/2014/07/10/qgis-processing-scripts-gebruiken/?lang=en
that was a little bit farther in the question.


Right, I just did, and I think my original comment still holds... :-)
The script will zoom to the point which you give in the specified 
projection, in this case epsg:4326 which is geographic lat/lon in 
degrees. It then transforms this coordinate to the crs of the canvas and 
zooms to there. So you'll need to give your x and y in valid coordinates 
for the projection you specify, in this case epsg:4326, so between -180 
and 180 and -90 and 90.


Vincent.


-Jukka Rahkonen-


Best regards,
Vincent.





___
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] Random styling from two attributes - How?

2014-09-02 Thread Calvin Hamilton
I was wondering if it is possible to style a map based off of two attributes.
For example use the Natural Earth admin 1 data and use the country
(sr_adm0_a3) to generate a random hue from each unique value, and then use
another attribute to generate random shades of that color. I assume that if
this can be done, Rule-based styling would need to be used, but I have no
idea how to create those rules.

Thanks!




--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Random-styling-from-two-attributes-How-tp5159710.html
Sent from the Quantum GIS - User mailing list archive at Nabble.com.
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user


[Qgis-user] kmz export sed script

2014-09-02 Thread José G Moya Y .
Hi!

As I said in a previous message, I use qgis to put together many geographic
information sources prior to downloading the data as kmz to my mobile.

That's the reason I wrote a small script to generate kmz icons from a
qgis-generated kml.

That script is a "sed" script, meaning it has to be processed with the
"sed" utility included in Linux. If you have a Windows version of qgis
bundled with Msys (such as osgeo4win), you could probably execute it from
the msys command line.

Someone could try to adapt it to python, but I don't know how to make
python scripts.

Please note: Lines are long and they could be wrapped when sendind as
email. I will use an empty line (two carriage returns) to mark new line.


---
SCRIPT 1  Generate icons from "name" field

This script takes a qgis-generated kml file, and adds an icon (called
"Cueva.png") to every feature with a name containing "Cueva" or "Sima",
another icon (called ."Icnitas.png") to every feature with a name
containing "icnita" or "Icnita",
another icon (called "Fosil.png") to every feature with a name like
"Fosil", "Fósil", "fosil" or "fósil", and another icon (called "Mina.png")
to every feature with a name containing "Mina".

The icons should be placed in a folder called "images", and zipped along
with the modified kml file in a file with kmz extension.

The script should be invoked like this:

sed mykmlfile.kml -f kmzfromname.sed > newkmlfile.kml

After that, you should use your preferred zip manager to zip together the
files. I use this:

7z -a -tzip newkmlfile.kmz newkmlfilekml images/*.png

but the syntax would be different if you use a different zip manager.

kmziconfromname.sed--CUT
HERE--
#!/bin/sed

#Replace name tag with Cueva or cueva with icon and name tag

/name>[^>]*[Cc]ueva/{;s//images\/Cueva.png<\/href><\/icon>/;};

#Replace name tag with Sima or sima with icon and name tag

/name>[^>]*[Ss]ima/{;s//images\/Cueva.png<\/href><\/icon>/;};

#Replace name tag with Icnita or icnita with icon and name tag

/name>[^>]*[Ii]cnita/{;s//images\/Icnitas.png<\/href><\/icon>/;}

#Replace name tag with F?sil or f?sil (probably, fosil or fósil) with icon
and name tag

/name>[^>]*[Ff].sil/{;s//images\/Fosil.png<\/href><\/icon>/;}

#Replace name tag with Mina or mina with icon and name tag

/name>[^>]*[Mm]ina/{;s//images\/Mina.png<\/href><\/icon>/;}

#Previous code for icons was a pseudocode. Replace it with the real code.

s!!1.0!;

s!!1.01,0!

#I don't know why, but replacing folder with document allows oruxmaps put a
name (instead of a date) to this layer.

s!Folder>!Document>!

kmziconfromname.sed---END OF
FILE---


SCRIPT 2 - Generate icons from a custom field (not "name")

This is a skeleton script. In the previous sample, I used the name to
detect the class of each feature, but my kml file has a field caled
T006_006_C that stores the actual feature class.

So I could use that field instead.

But, in order to do that, I have to read the field inside the
 tag and, after that, put a new flag outside that tag.

Doing that with SED is tricky, because SED uses to read one line at a time.
We have to tell it to group the whole  group in a single line.

Please notice you should adapt this script to your needs, i.e., replace
T006_006_C with the field name you want, add code to replace the  tags with your preferred icon, and so on.

The usage would be again,

sed mykmlfile.kml -f kmzfromfield.sed > newkmlfile.kml

After that, you should use your preferred zip manager to zip together the
files. I use this:

7z -a -tzip newkmlfile.kmz newkmlfilekml images/*.png

but the syntax would be different if you use a different zip manager.

---kmziconfromfield.sed--CUT
HERE--
#!/usr/bin/sed

#Example: how to make icon from field using SED

#Replace T006_006_C with fieldname

:a

N

#Do not put spaces after the backslash in the next line:

s/\
/ /g


/\/ExtendedData/!ba

s/\(\)\([^<]*\)\(.*<\/ExtendedData>\)/\1\2\3/

#Step 2: Replace  with code for icon
(/Cueva.png<\/icon>/

#Now we change  pseudocode with real icon code.

s!!