Friday, October 17, 2014

Spatial reference systems and transformations in Austria

Transforming data from Austrian local coordinate system to WGS84 should be a no brainer but this is GIS stuff we are talking about and therefor it isn't :)

First I am posting some great references for my own sanity that I find it again and that other GIS, Geoinformatik students find some help.

Link to epsg codes for Austria ESRI Synergis: http://www.esri-austria.at/downloads/coords_at.html
  • Für Datumsübergänge von MGI nach WGS 1984 sollte, falls keine genauen Werte für die 7 Parameter Transformation vorliegen, jene der ÖK 50 vom BEV verwendet werden - dies entspricht MGI_To_WGS_1984_3 (EPSG-code 1618).

Link 1: We in Austria DO have a Datum shift in order to move from a Projected Coordinate System to Geographic Coordinate system and the two magic code numbers are in this file below (1618(the rest of us in Austria and 1194(for Steirmark))

BIG NOTE on PROJ4 taken from the homepage:
OTHER PROGRAMS
       The  proj  program  is  limited  to   converting
       between  geographic  and  projection coordinates
       within one datum.

       The cs2cs program operates similarly, but allows
       translation  between any pair of definable coor‐
       dinate  systems,  including  support  for  datum
       translation.
How to call this from Python using the python implementatino of Proj4 library (code taken from the source code of pyProj4 library) and simplified for your reading pleasure.



This github gist is here https://gist.github.com/da5a72f894aa72a28032.git

Have fun playing with projections!



http://epsg.io/
http://www.gomogi.com





Wednesday, September 17, 2014

arcpy write a list of feature datasets from a geodatabase to a csv file

Lets be a little more specific as to what we want to do so I will reformulate the title now:

How to write to a CSV file a list of ESRI ArcGIS personal geodatabase feature classes and feature sets using arcpy?

As usual here is the code first since we are all impatient :)

code is on Github
most of it is self explanatory but who knows.  We assume you have a running copy of ArcGIS 10.2 in this case with on my machine I have ArcGIS10.2 installed and the python interpreter is located here c:\arcgis\Python27\ArcGIS10.2\python.exe

I think only a few lines might need explaining

line 27  wr.writerow(each_fs.split(","))

The .split(",") prevents our CSV from spitting out "f", "c", "_","n","a","m","e", "F","o","o.......
  where our list is  fcList= ["fc_nameFoo","fc_nameFee"]

If you want to write this all to one single line in the csv you can uncomment the section in the first for loop located at line25

Other wise the script will output every feature class name to one line in the new CSV file.

Hope that helps.

cheers
Michael

Thursday, July 3, 2014

Geoserver SLD variable substitution based on attribute

SLD (Styled Layer Description) is a beast of XML rules, filters and other stuff with tons of power.

The question at hand is how do I pass a color value to a certain attribute value in a WMS call to Geoserver? The documentation to read is http://docs.geoserver.org/latest/en/user/styling/sld-extensions/substitution.html


lets start with the SLD

Here there are two rules, the first rule sets the default color for the column "zone_name" with the value equal to "a" to a default color of "FF0000".  The second rule is defined to set the color for the column "zone_name" that is equal to value "b" and sets the default color to "0000ff".

Now for the dynamic part.  In your WMS call simply add this to the url

&env=a:6666ff;b:ff6666

this means  set the "a" zone to the new color "6666ff  and set the "b" zone to new color "ff6666" when the wms call is made.

Now you can do whatever backend magic your heart desires to dynamically create a WMS call with these 2 parameters.

cheers
Michael

Tuesday, May 20, 2014

Install pgRouting extension with postgresql 9.3

Installing cutting edge software is always fun.  So my journey was to install pgrouting 2.0.0.2 with postgresql 9.3 and postgis 2.1.2 on  a Ubuntu 12.04 machine for some testing.

As it looks this was not so strait forward I had to use some debian packages which are thankfully easy to install.  Visit each of theses sites then scroll WAY down to the bottom, select your system architecture then click the link to download

https://packages.debian.org/sid/postgresql-9.3-pgrouting

plus: (update 20.08.2014 now using libboost-thread1.55.0 and libboost-system1.55.0)
    https://packages.debian.org/sid/libcgal10
    https://packages.debian.org/sid/libboost-thread1.55.0
    https://packages.debian.org/sid/libboost-system1.55.0/

Now how to install pgrouting begins with viewing each page and scrolling down on each page then select a server to download then simply download and you should have the following .deb install files in your downloads folder. (if you are using AMD64 architecture)

  1. libboost-system1.55.0_1.55.0+dfsg-2_amd64.deb
  2. libboost-thread1.55.0_1.55.0+dfsg-2_amd64.deb
  3. libcgal10_4.4-1+b1_amd64.deb
  4. postgresql-9.3-pgrouting_2.0.0-2+b1_amd64.deb

Now finally to the installation part, simply double click each .deb in your Nautilus explorer then the package installer should automatically open.  Important install each in the same order as I have listed above to meet the dependencies of the pgrouting .deb installer.

Now you can open up your pgAdmin and be able to use the super easy install extension.  Or for you command line guys / gals out there you can login to
sudo -u postgres psql
CREATE EXTENSION pgrouting;
\q
Well I hope that helps you out.   If you need any help you can find me at http://gomogi.com/about/contact

cheereo
Michael

Monday, May 12, 2014

ogr2ogr upload shapefile to postgis

Simple quick upload a shapefile to an existing postgis database into an existing schema called "geodata"

upload shapefile to postgis with ogr2ogr:
# upload shapefile into postgis schema and automatically create the table named "test C:\OSGeo4W\bin\ogr2ogr.exe -lco GEOMETRY_NAME=geom -append -lco SCHEMA=geodata -f "PostgreSQL" PG:"host=domainName port=5432 user=username dbname=dbName password=secretpasswrd" -a_srs "EPSG:3785" C:/somepath/myshapefile.shp -nln NewTableName )

Tuesday, February 25, 2014

Why indoor maps are important.

Asking a tough question "why are indoor maps important?".  The answer is simply the same reason as to why any map is important.

Maps guide us in many ways, present us huge amounts of information in a simple manner.

Here is a top 5 list of why indoor maps are important:

  1. Transfer information fast
    • Images share more information than words hands down. Complex building structures are literally a maze of ways and paths.  Indoor maps show floor plans, furniture and other features to identify your way.
  2. Allow to check our progress
    • You can locate where you are and how much further you have to go.  Indoor floor plans with routing can show you your way from point A to B and see where you are.
  3. Ease communication
    • Trying to explain where some thing is located is not an easy task.  Whenever you want to show someone where something is located you want a "map".  Indoor maps show you the floor plan and floors for complex buildings in a familar way.
  4. Reduce stress
    • Do you feel stress when you are lost?  Well most people do and the stress escalates very fast when you are about to be late for a meeting or appointment.  Having an indoor map helps you plan and prepare for your trip, therefore reducing your anxiety of the possibility of getting lost.
  5. Chart out what is where
    • Providing information about the indoor environment is as important as our outdoor environment. We spend more hours indoors than we do outdoors and that is why indoor maps are needed in as many places as possible.

Tuesday, February 18, 2014

Ubuntu Linux secure copy to / from server

This post is more of a note to my self this is all running on a Ubuntu 12.04 machine.  You can do all of this from your local Ubuntu machine and do not need to login on remote server via ssh.

Copy folder FROM server TO local machine using command line 


Remote folder :  /var/www/someRemoteFolderName
destination folder on local machine: /var/www/localFolderName
username:  bob
ip or dns: mydomainName

Command is :

root@mdiener-VirtualBox:# scp -r bob@mydomainName://var/www/someRemoteFolderName/ /var/www/localFolderName 

then enter password at the prompt


Copy folder TO server FROM local machine using command line

Remote folder is :  /var/www/someRemoteFolderName
destination folder on local machine: /var/www/localFolderName
username:  bob
ip or dns: mydomainName

Command is :

root@mdiener-VirtualBox:# scp -r /var/www/localFolderName bob@mydomainName://var/www/someRemoteFolderName/ 

then enter password at the prompt

This is simply the reverse of the first one.

Well that was easy !  Linux is great

Tuesday, February 11, 2014

Open Geo Data in Austria

More and more data is constantly available on the web here in Austria.  I found it now time to write a little post summarizing where you can get data about Austria from Austria.

http://www.data.gv.at/  (all of Austria)
http://data.statistik.gv.at/  (Statistic Austria)
http://data.ktn.gv.at/   (Kärnten)
https://www.tirol.gv.at/data/datenkatalog/  (Tirol)
https://open.wien.at/site/datenkatalog/  (Wien)
http://data.noe.gv.at/Open-Government-Data.html   (Niederösterreich)
http://data.steiermark.at/  (Steirmark)
http://data.vorarlberg.gv.at/ (Vorarlberg)
http://data.linz.gv.at/  (Stadt Linz)
http://www.data.gv.at (Salzburg all data in Data.gv.at)
Oberösterreich  (links is really long)
http://geodaten.bgld.gv.at/de/ogd.html  (Burgenland)


To round out the list of prominent open data around us
http://opendata.admin.ch/en   (our swiss neigbours)
Bundesamt für Kartographie  (Germany)
Italy  open data ( if you can read Italian)
EU data (publicdata.eu since we are a part of it)
European Union Open Data Portal  (https://open-data.europa.eu/en/data)


Last but not least a quick note on how open data is being published.  CKAN.ORG http://ckan.org/  is a portal platform to publish your data online geo or not.  I also like to plug the great open source project GEONODE   www.geonode.org  for map, layer data management and sharing.

have fun with your newly found data :)   and if you need more info please check out our webpage:
www.gomogi.com