Thinking in GIS

a blog about GIS from a urban geogeek living at the countryside

Feed, Categories, Archives


Geocoding in web applications: OpenLayers and geoPy to the rescue!

Posted: September 17, 2010
Categories: jQuery, GIS, Python, Django, OpenLayers, Tutorials, geopy, Uncategorized
Feedback: View Comments

In many situations, in your web applications, you will need a feature for geocoding an address, a city, a country...A possible approach is to use the Javascript API of the main geocoding services (Google Maps, Yahoo! Maps, GeoNames...).But as I have showed in a previous post, if you are using Python, there is an excellent API that will take care of this, without Javascript headaches: GeoPy.In this post I will show how to use geoPy, OpenLayers and a bit of JQuery to assemble a simple but nice tool for geocoding within OpenLayers.In my server code I will use Django but...
Read the full post

The Pinax Tutorial #5: Adding a comment system

Posted: December 21, 2009
Categories: Python, Django, devs, The Pinax Tutorial, Pinax, Tutorials, Uncategorized
Feedback: View Comments

In this part we will improve the Bookstore application: what I am going to show is how easy it is to add support for enabling comments for a book without writing from scratch another comment system (as you may already now, avoid rewriting things is the core philosophy of Pinax and Django).Basically, you could add this feature by using one of these two approaches (there may be other ones, but these are the most common):Django comments frameworkthe django-threadedcomments system, that - as suggested by its name - it offers support for comments in a threaded fashionYou will implement a commenting...
Read the full post

The Pinax Tutorial #4: Using avatars, pagination and profiles

Posted: December 19, 2009
Categories: Python, Django, devs, The Pinax Tutorial, Pinax, Tutorials, Uncategorized
Feedback: View Comments

In this part we will improve the Bookstore application and we will see how easy it is to add support for three core features that any web 2.0 sites is supposed to offer:support for avatarssupport for paginationsupport for user profilesIn Pinax you may use two kind of avatars for your users (in both case you may manage them from the Avatar page: http://localhost:8000/avatar/change/):gravatarscustom avatarsIn the first case Pinax will render your avatar using the gravatar you have associated to your email from the Gravatar web service. In the latter Pinax will use a custom avatar you have uploaded to the...
Read the full post

The Pinax Tutorial #3: Internationalization of the application

Posted: December 18, 2009
Categories: Python, Django, devs, The Pinax Tutorial, Pinax, Tutorials, Uncategorized
Feedback: View Comments

(Note that, if you completed the other parts of this tutorial before the date of this post, you need to move the PROJECT_ROOT/templates/bookstore directory in PROJECT_ROOT/bookstore/templates: so now you will have a PROJECT_ROOT/bookstore/templates/bookstore directory. I did so for a better deployment experience, and doing so I am following the Django best practices. If you are reading the pdf version of the tutorial or the REST documentation, then this documentation is already updated with the templates directory in the right place).In this part of the tutorial I will show how easy it is to enable your application for internationalization with Pinax.Enabling...
Read the full post

The Pinax Tutorial #2: Developing the basic application and plugging it in Pinax

Posted: November 29, 2009
Categories: Python, Django, devs, The Pinax Tutorial, Pinax, Tutorials, Uncategorized
Feedback: View Comments

In this part of the tutorial you are going to create the core of the bookstore application, with all the pages that gives access to the CRUD (Create, Read, Update, Delete) features. And you are goint to plugin this basic application into Pinax.After finishing with this part you will have the core of the bookstore application working as desired. You will be able to:see a list with all the books in the bookstoreadd a new bookupdate and delete your bookssee a list of all books added by yousee a list of all books added by a userIn the following parts...
Read the full post

The Pinax Tutorial #1: Installing Pinax and making basic customisation

Posted: October 10, 2009
Categories: Python, Django, devs, The Pinax Tutorial, Pinax, Tutorials, Uncategorized
Feedback: View Comments

I will assume you are installing Pinax v0.7 on a Ubuntu 9.04 box, but this procedure - with a few modifications, should work well on every Linux box. For Windows please refer to the Pinax official site or - rather I highly reccomend to use VirtualBox, and to create an Ubuntu 9.04 Virtual Machine, so you will be able to follow step by step this tutorial.There are ready images like this one, to make things even easier.As suggested from the official installation procedure, the release bundle has everything you need for running Pinax.What is not included is:Python;Python Imaging Library (PIL);SQLite.Ubuntu...
Read the full post

The Pinax Tutorial, Introduction for Web Designers

Posted: October 03, 2009
Categories: Python, Django, devs, The Pinax Tutorial, Pinax, Tutorials, Uncategorized
Feedback: View Comments

In the last weeks I was studing Pinax , an Open Source platform for building Django applications. While I enjoyed a lot learning how to develop software with this framework, and I am going to happily use it for a series of projects, I found a bit difficult to get documentation about it, if not reading the source code and the (few - at this time) documentation on the project web site.When I started, I decided to write a test application for understanding the Pinax philosophy before going for real development projects. I thought it would be very useful for...
Read the full post

A day with TileCache: generating KML Super-Overlays

Posted: August 06, 2008
Categories: TMS, GIS, SharpMap, WMS, Python, MetaCarta, kml, FeatureServer, devs, Apache, MapServer, TileCache, OpenLayers, GeoServer, Tutorials, GDAL, Uncategorized
Feedback: View Comments

My friend Diego Guidi is the smartest GIS/.NET developer I personally know here in Italy. He is the developer of NetTopologySuite, the port in the .NET world of the popular Java's JTS Topology Suite from VIVID Solutions. I wanted, sooner or later, write some stuff here about WMS and TMS, and now I am very happy that Diego asked me to publish this brilliant article about this topic.First of all, let me thanks Paolo for hosting this post! I hope that this article can be interesting and useful like other stuff that you can find here...IntroductionThere are a lot of...
Read the full post

Do you get errors in the mapscript c# tutorial?...

Posted: February 29, 2008
Categories: GIS, Windows, .NET, PostGIS, devs, MapServer, Tutorials
Feedback: View Comments

...well, this is the solution to your problems (at least I hope so).I am continuing receiving emails from people in despair that cannot successfully use this tutorial. I am sorry but I cannot answer to all this emails, so I thought to write this post in order to allow people to configure it correctly.BTW, this demo is still working since 2 years without any problems, and the code there is just the same you can download from this blog. So it must work also for you ;-)So if you just cannot use it, this is a check list:If you receive...
Read the full post

Writing the Domain Model classes: coding time (Castle MonoRail and ActiveRecord Tutorial - Part 5)

Posted: September 13, 2007
Categories: devs, Tutorials, .NET, CastleProject
Feedback: View Comments

This is the fifth post of a series started with this post about a MonoRail and ActiveRecord tutorial.With this post we will finally start to write code for our MonoRail and ActiveRecord tutorial. Here we will go on writing the model classes, and from them we will autogenerate the database schema (alternatively you could first create the database schema and then generate the classes using the generator).We need to write 5 classes for our 5 models (Album, AlbumGenre, Artist, Genre, Support). As we discussed the convention is to place them under the Models folder of our CastleProject solution.So let's create...
Read the full post

Writing the Domain Model classes: implementing Relationships (Castle MonoRail and ActiveRecord Tutorial - Part 4)

Posted: August 30, 2007
Categories: devs, Tutorials, .NET, CastleProject
Feedback: View Comments

This is the fourth post of a series started with this post about a MonoRail and ActiveRecord tutorial.Last time we wrote the Album class and we have seen how to implement the primary key mapping and simple properties mapping.With simple properties mapping I mean the class properties that will go to map simple data type in the database. Instead with complex properties I will mean the class properties that will go to map a relationship with another table in the database.For the album class there are simple properties (ID, Name and Year) and complex properties (Support, Artists and Genres).The simple...
Read the full post

MonoRail and ActiveRecord configuration (Castle MonoRail and ActiveRecord Tutorial - Part 2)

Posted: May 27, 2007
Categories: devs, Tutorials, .NET, OOAD, CastleProject
Feedback: View Comments

This is the second post of a serie started with this post about a MonoRail and ActiveRecord tutorial.Let's start developing our sample application. The first thing we need to do is to create a .NET project configured for using the CastleProject stuff. You can go in two ways:Create a Visual Studio project with the MonoRail project wizard.The wizard will create for you the MonoRail project structure, generate the configuration elements in the web.config file and add all the necessary references to the project. You will be prompted to choose a view engine (NVelocity, Brail or ASP .Net Web Forms), if...
Read the full post

Castle MonoRail and ActiveRecord Tutorial (Part 1)

Posted: May 22, 2007
Categories: devs, Tutorials, .NET, CastleProject
Feedback: View Comments

In the last 2-3 years there were a lot of talking about agile and high-productivity development with an outstanding framework that is already in the legend, like happened to Java in the late 90s: Ruby on Rails.Given its success, many other project in the Open Source community were born trying to reproduce the beauty of the Ruby on Rails rapid and agile development framework for other environments. Just to name a few: Turbogears for Python and Grails for Java.The main features of these rapid development framework generally are:Convention over configuration PatternMVC PatternInversion of Control Containers and the Dependency Injection PatternAn...
Read the full post

Cuyahoga: "Hello World" sample module tutorial

Posted: April 30, 2007
Categories: Cuyahoga, .NET, devs, OOAD, Tutorials, CMS
Feedback: View Comments

Cuyahoga is an impressive Open Source web site framework (and CMS) with many impressive features like:RDMBS indipendency via NhibernateEnterprise architecturePlug-in architectureDeployable, using Mono, to platforms different from Windows, like Linux, Mac OS X, Solaris, unlike other popular .NET CMSSearch engine based on dotLuceneFull ASP .NET 2.0 enginelogging system via log4net (the same logging engine in zigGIS)People willing to deeply dig in Cuyahoga may download the latest release (1.5.0) source code and this basic tutorial for developing Cuyahoga modules.The problem with this tutorial is that is a bit out of date (is based on VS 2003 and on a old release...
Read the full post

MapServer Tutorial for C# mapscript (ASP .NET)

Posted: September 20, 2006
Categories: GIS, .NET, PostGIS, devs, MapServer, Tutorials, Uncategorized
Feedback: View Comments

This tutorial will try to guide you step by step in implementing a GIS (Geographic Information Systems) web solution, based on Open Source software (MapServer), within the .NET Framework.The tutorial is designed to work with Visual Studio 2003 and .NET 1.1, but you will easily be able to perform all the necessary steps to complete it using another version of Visual Studio (ie: Visual Studio 2005) or other IDEs (like Visual Web Developer 2005 Express Edition or even the notepad). It will work also using .NET 2 as c# mapscript is .NET 2 compatible.The tutorial is focused to people with...
Read the full post

Adapting C# code to work indifferently with shapefile or PostGIS layers (c# mapscript tutorial, part 8)

Posted: September 14, 2006
Categories: GIS, .NET, PostGIS, devs, MapServer, Tutorials
Feedback: View Comments

In this section we will adapt the ASP .Net Tutorial to work both with shapefiles or with PostGIS layers.The only c# code that needs to be modified is only the code that updates the point layer.The tutorial is composed of basically 2 methods that update a point layer:the first method adds a point and its attributes to the point layer (AddPoint method)the second method delete all the points from the point layer (butClear_Click)After you will terminate this step the tutorial will work both with shapefiles and PostGIS layers.Adding a reference to PostgreSQL .NET dll to the Visual Studio solutionYou will...
Read the full post

Connection MapFile layer to PostGIS (c# mapscript tutorial, part 7)

Posted: August 01, 2006
Categories: GIS, .NET, PostGIS, devs, MapServer, Tutorials
Feedback: View Comments

First I am going to show the difference between connecting the MapFile to a Shapefile layer and to a PostGIS layer, then I will show how to adapt your MapFile to work with PostGIS.Shapefile ConnectionHere is a sample connection from MapFile to a shapefile called "compfun".First you need to declare the path to the shape data (SHAPEPATH).Then for each shapefile layer you have to set the shapefile's data source (DATA) that is the name of the shapefile.Here the shapefile is named compfun.shp so DATA is set to "compfun".Note that NAME can be anything, it means how in your MapFile want...
Read the full post

Migrating shapefiles to PostGIS (c# mapscript tutorial, part 6)

Posted: July 27, 2006
Categories: GIS, .NET, PostGIS, devs, MapServer, Tutorials
Feedback: View Comments

What is PostGISPostGIS is an extension for PostgreSQL RDBMS that spatially enables it for storing GIS content.It could be considered something similiar to Esri ArcSDE or Oracle Spatial.In fact PostGIS is for PostgreSQL what is Esri ArcSDE for Oracle, MS SQL Server, Informix, DB2.PostGIS is OGC compliant and is Open Source, released under the GNU General Public License.For more info about PostGIS you can take a look here.PostGIS InstallationFirst, if it is not on your RDBMS Server, you have to download and install PostgreSQL. Refer to the PostgreSQL's Web Site for doing so.After you have succesfully installed PostgreSQL, you...
Read the full post

Implementing the C# mapscript code (c# mapscript tutorial, part 5)

Posted: July 26, 2006
Categories: GIS, .NET, PostGIS, devs, MapServer, Tutorials
Feedback: View Comments

Add reference to mapscriptAdd the reference to mapscript_csharp.dll (browse to the mapscrip installation folder, for example C:ms4wApachecgi-binmapscriptcsharp):{{:MapServer:tutorial:add_reference.jpg|:mapserver:tutorial:add_reference.jpg}}Remember that if you didn't set PATH environment variable to the MapServer dlls you will need to manually copy them under the bin folder of this ASP .NET application.moreThe c# code for Default.aspx pageThis is the complete code to add for the Default.aspx page:using System;using System.Collections;using System.ComponentModel;using System.Data;using System.Drawing;using System.Web;using System.Web.SessionState;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.HtmlControls;using System.Data.OleDb; //for dbf connectionusing System.IO; //for copying the point shapefilenamespace TutorialMapServer{ /// /// User Interface for c# MapServer Tutorial ///...
Read the full post

Designing the tutorial user interface (c# mapscript tutorial, part 4)

Posted: July 26, 2006
Categories: GIS, .NET, PostGIS, devs, MapServer, Tutorials
Feedback: View Comments

Create an ASP .NET C# ProjectOpen Visual Studio, create a new ASP .NET C# Project called TutorialMapServer:Insert application key value in web.configOpen web.config and add the following appSettings section under configuration section:<configuration> <appSettings> <!-- Path to MapFile --> <add key="mapFilePath" value = " C:\training\mapServerTutorial\data\csharptutorial.map" /> </appSettings> <!-- ........ --></configuration>For the key mapFilePath be sure to put the right path to the map file (also a relative path is valid).Create the main web formAdd a WebForm called...
Read the full post

Creating the MapFile and data configuration (c# mapscript tutorial, part 3)

Posted: July 03, 2006
Categories: GIS, .NET, PostGIS, devs, MapServer, Tutorials
Feedback: View Comments

Creating the MapFileFor what is a MapFile and a reference about it you can view the MapFile Reference at MapServer web site. Here you can download the data, map file and fonts needed for this tutorial. Extract data.zip wherever you think in your hard disk, for example at c:trainingmapserverTutorialdata. Open the map file named csharp_tutorial.map: MAPNAME "Zone Samples"SHAPEPATH "C:\training\mapServerTutorial\data"SIZE 400 400STATUS ONEXTENT 1143759 4417539 1146436 4420390UNITS METERS FONTSET "fonts\fonts.list" WEB IMAGEPATH "C:\Inetpub\wwwroot\temp" IMAGEURL "C:\Inetpub\wwwroot\temp"ENDSYMBOL NAME "circle" TYPE ellipse FILLED true POINTS 1 1 ENDENDLAYER NAME "compfun" TYPE...
Read the full post

Installing MapServer (c# mapscript tutorial, part 2)

Posted: July 03, 2006
Categories: GIS, .NET, PostGIS, devs, MapServer, Tutorials
Feedback: View Comments

Download MapServerDownload precompiled binaries here. For the purpose of this tutorial is indifferent if you download the MS4W for PHP4 or PHP5. (As an alternative you could download an installation toolkit like this and compile yourself MapServer, but it is more difficult).InstallationAll you need to do is to extract the zip file, for example at: C:ms4w.Here we will not mention how to install cgi MapServer, because we are using the other modality (MapScript).After doing that take a look at the structures of the directories created under C:ms4w. All the references we need in our C# ASP .NET (or Windows) application...
Read the full post

Introduction to MapServer Web GIS development environment (c# mapscript tutorial, part 1)

Posted: July 02, 2006
Categories: GIS, .NET, PostGIS, devs, MapServer, Tutorials
Feedback: View Comments

What is MapServer?According to MapServer official site:MapServer is an Open Source development environment for building spatially-enabled internet applications. MapServer is not a full-featured GIS system, nor does it aspire to be. Instead, MapServer excels at rendering spatial data (maps, images, and vector data) for the web.MapServer was originally developed by the University of Minnesota (UMN) ForNet project in cooperation with NASA and the Minnesota Department of Natural Resources (MNDNR). Presently, the MapServer project is hosted by the TerraSIP project, a NASA sponsored project between the UMN and consortium of land management interests.The software is maintained by a growing number of...
Read the full post

MapScript C# Tutorial - Programming MapServer in the ASP .NET Framework

Posted: July 01, 2006
Categories: GIS, .NET, PostGIS, devs, MapServer, Tutorials, Uncategorized
Feedback: View Comments

In the next stops I will write a tutorial about programming MapServer with .NET c#.This tutorial will try to guide you step by step in implementing a GIS (Geographic Information Systems) web solution, based on Open Source software (MapServer and PostGIS), within the .NET Framework.How to download the tutorialThe tutorial's data needed to complete this tutorial are downloadable here. In any case the tutorial is made in a way that you can easily adapt to use your own data (shapefiles).Here you can find a complete working Visual Studio 2003 solution (ASP .NET 1.1) with the whole tutorial's solution. moreTake...
Read the full post