Showing posts from 2012

Quantum GIS copy paste geom and attributes into Postgis

Problem: I have a shapefile with 5000 points and I have a Postgis table that I want to add data to from the shapefile.  I want to select 1500 points from the shapefile and use copy paste into the Postgis table. process: open qgis add the shapefile layer add the postgis layer start editing the postgis layer (this is where the new data is going) select the 1500 points using the table editor based on criteria select copy select the postgis layer from the layers menu on the left select paste data is pasted save ERROR Änderungen am Layer poi konnten nicht gespeichert werden Fehler: FEHLER: 14 Objekte nicht hinzugefügt. Datenlieferantenfehler: PostGIS-Fehler beim Attributhinzufügen: ERROR: duplicate key value violates unique constraint "poi_pkey" DETAIL: Key (id)=(0) already exists. What to do? open attribute table of postgis layer and you should see the data selected and make sure you only see the selected data click field calculator select edit exist

Geoserver batch create layers from Postgis

Goal: Goal is to automatically slurp up all tables in the Postgresql Postgis database in the schema "geodata" and create the geoserver layers.  Then we want to assign a SLD to the layer. Finally create a l ayer g r oup. Prerequisites: Postgresql PostGIS database exists Geoserver Workspace exists (demo_wrkspc) Geoserver Datastore exists (temp_datastore) Text file list of all table names (tablelist.txt) curl is installed SLD style is created and located in a workspace OS: ran on CentOS 6.3  Code: my bash script saved as while read p; do   curl -u username:password -v -XPOST -H 'Content-Type:text/xml' -d '<featureType><name>'$p'</name></featureType>' http://localhost:8080/geoserver/rest/workspaces/demo_wrkspc/datastores/temp_datastore/featuretypes; done < tablelist.txt tablelist.txt is a list of the table names in my database here are 3 tables i have in my list.  (originally i had 75 tables)

How to batch define projections with arcpy ArcGIS 10

ArcGIS 9.3 had a nice batch define tool in the toolbox that was removed in ArcGIS 10.  ArcGIS 10 has python 2.6.3 for the geoprocessing and well all kinds of fun stuff can be done with arcpy. So how to batch define the projection for a folder full of shapefiles is the problem at hand. For those who can't wait I posted the code here first and the explanation comes after. Python Code # Name: # Description: Records the coordinate system information for the specified input dataset or feature class # Author: ESRI # import system modules import arcpy from arcpy import env import os # set workspace environment where the shapefiles are located env.workspace = "C:\\BaseFolderName\\FolderOfShapefiles" # creates a list of feature classes or shapefiles in the current workspace fcs = arcpy.ListFeatureClasses('*') # set local variables try: for file in fcs: inData = file coordinateSystem = "PROJCS[\"MGI_Austria_GK_

Golf and Country Club Zürich with GOLFGIS Pin position module

Golf and Country Club Zürich hosted the Omnium Championship from 27.07 until 29.07.2012 using the pin position module to deliver day to day pin position maps for the players. Feedback from the tournament organization was great.  Lahcen Jabrane (Head Greenkeeper) said "Working with Michael was a great pleasure and having the ability to update the pin positions live on my iPhone on the course saved us a huge amount of time."  The secretary could access Lahcen's updates live on his computer and print out the formated PDF files immediately after the new positions were placed on the course. Timing is of great importance because the holes are re-located early in the morning depending on the weather and the team needed to be able to change and print the new pin position maps on the fly. Using the pin position module for mobile and web provided by is a great way for the administration, secretary, tournament referee, team captain and greens kee

Pin Position Management

GOLFGIS  module  Pin Position Management Using GIS for the last 15 years or so has lead me into many diverse uses of GIS.  Now recently our GOLFGIS product has taken on the task of managing pin positions. I thought hey this can't be so difficult, just load a DEM (digital elevation model) map the contours and volla you have a surface model, flow model of how the ball would roll and immediate display of where you can place the pin.  But as the GIS veteran that I am I knew this would be harder. Lets start with where do I get a DEM or map of the green?  it needs to be like millimeter accurate to be of any use to a golfer.   Laser scan data?  When available super, when not too costly to produce for a normal course budget Map it yourself. We use option 2.  Map it yourself. Using my mapping skills by hand technique learned at University I was quickly up and running mapping, slope, break lines and contours. Now we need to follow the golf rules for pin position placem

Geonode to share golf data

We recently installed a Geonode instance on one of our servers to host golf data here at .  The purpose is to share golf maps and golf specific data. What is golf specific data? Fairways Greens Tee Areas Bunkers Water Hazards Trees Cart Paths Buildings Playing Lines Markers out-of-bounds water-hazard-front water-hazard-side 100m to green front 150m to green front 200m to green front Biotop posts Semi-rough Rough and more... Now the geometry alone provides valuable information like square meters and perimeter values for each area that the Greenkeeper can use for calculating fertilizer amounts per m2. Geonode is still a new project based on several open source software projects: Geoserver , Geonetwork , Postgresql , PostGIS, OpenLayers and GeoExt plus Django. Lots of configuration goodness to get it all play nice together but it works.  Now we are busy making it work better for all the non GIS folk who are going to use this portal t