Welcome to Planet PostGIS

May 24, 2013

CartoDB

Mapping Cities with Open Data Using CartoDB

Hi, community! Will any of you be available to come meet us this Thursday May 30th in San Francisco for an awesome GIS demonstration? We’ll be showing with a local developer team, Daniell Hebert and Steph Tryphonas of Lab228, how to build applications using open city data. The results for San Francisco are pretty cool!

Come join us — and bring your questions and suggestions. We’ll be at the San Francisco Department of Technology (1 South Van Ness Ave., 2nd floor) on Thurs. at 10.30am. Register for the free event here.

We will be in SF the entire week in different events, so if you want to meet to talk about CartoDB let us know. But we look forward to seeing you Thursday!

May 24, 2013 09:48 PM

May 23, 2013

CartoDB

How CartoDB Powers Data Journalism

From its beginning, CartoDB been a powerful tool for journalists because it’s easy, flexible, scalable and open source. With this simple-to-use tool journalists everywhere are discovering the immense power data visualization gives them for research and telling stories.Political Moneyball by The WSJToday more than 150 media organizations, many of the world’s most respected and widely-followed, use CartoDB in their online reporting.

Journalist Alexandre Léchenet at lemonde.fr has used CartoDB to illustrate reports ranging from the housing travails of Roma groups in France to the different ways French cities have adjusted their students academic year. L’chenet explains why he likes CartoDB:

“I love CartoDB most because it’s a simple and clean way to rapidly highlight geographical data. Geocoding is easy. The ability to really control the markers and colors with something as simple as CartoCSS makes it the best friend of cartography for data-journalism. And it’s open-source!”

Daniel Bramatti and his team from Brazil’s Estadao Dados uses CartoDB a lot in their data blog. He says:

“Last year CartoDB was our platform of choice to visualize election maps. We like CartoDB because it is a very powerful tool, yet very easy to use. It just takes a few clicks and we have a beautiful and fully customizable map to publish in the web or to export to our infographics department.”

And this is what Simon Rogers — formerly of The Guardian, now working at Twitter, says about the platform:

“CartoDB is unique in combining ambitious, elegant mapping with the accessibility of free tools. If you want to show complex geo data - in an accessible, shareable way - for most people CartoDB will be the best solution.”

Repeatedly journalists are expressing delight at how the simple user interface of CartoDB makes their work easier, as well as, in some cases, more imaginative. Some stories are now more possible to tell in a way that an audience will immediately understand.

Last year the Online News Association (ONA) recognized CartoDB’s contribution to the practice of online journalism by naming it a finalist for an award in Technical Innovation in the Service of Digital Journalism. This February, the public named CartoDB a winner in the Publishing Startup Showcase at the O’Reilly Tools of Change for Publishing Conference>.

 

You don’t want your maps to be like others

Now let’s get into the specifics of why CartoDB-generated maps are especially good for data journalists. First, using CartoDB, you can make gorgeous maps in your own distinctive style in at least two ways.

On the one hand, you have the basemaps. You can choose between the existing styles or just add your own. On the other, you have the wizards. These let you style your maps in lots of different ways without having to write a single line of code. Intensity maps, choropleth maps or bubble maps are just some of the wizards implemented in the UI.Map wizards in the CartoDB UIThe idea with all of these methods is that they give instant data visualization power to users with zero coding skills. Of course, users who want, can always use the wizard results as a starting point and modify further for even more map customization.

 

Merge your datasets and use our filters to discover new relations

One of the most popular features on CartoDB is the Visual Merge. By using this wizard, you can merge two existing tables into a single one. This function is really helpful when creating thematic maps, since it will save you from creating complex SQL queries.

Once you have your data ready, you can analyze and explore it using our brand new filters. These will give you a quick view of how your data looks and allow you to explore it with a higher level of detail. You can even use them as a SQL learning tool, since the result of the filters is plain SQL and can be always edited in your SQL window.New brand filters in the CartoDB UIThis feature and the new ones coming in the 2.1 version will make your maps an awesome piece of information and storytelling.

 

Your maps always available

We know that media organizations have very specific requirements when working with maps. In most cases, the maps you create will have huge traffic during the first days, but then, the visit counter will go down. So having a platform that scales is important, as is a pricing model that won’t ruin you.

CartoDB uses different Content Delivery Networks in order to keep your map tiles always available and distribute them as fast as possible in the different regions. So data handling, of any volume, is efficient. At the same time, the pricing model is based in two things:  amount of data and number of mapviews. This basically means you only pay for what you use. And if your maps are viewed much more than anticipated you will pay more only if you exceed the number of mapviews included in your plan.

 

Meet @CartoDB this weekend at Barcelona during the first Open Knowledge Foundation Data Journalism Conference.

For an in-depth illustration of all these data journalism features come meet us this weekend in Barcelona! At the first Data Journalism Conference, organized by the Open Knowledge Foundation, @saleiva will be giving a presentation on Visualizing Data that we promise will tickle your minds (Friday 24th, at 20:00). Join @CartoDB this Saturday the 25th at 18:30, for a hands-on session. Check out the whole event program here.

And we’ll also be giving away a free annual John Snow subscription to the best map application developed during the hackathon, so…. Good luck mapping your data! We can’t wait to see what you come up with.

May 23, 2013 09:45 AM

Bill Dollins

Open-Source GIS Bootcamp at Salisbury University

Thanks to LinkedIn, I saw that Dr. Art Lembo of Salisbury (Maryland) University is leading an "Open Source/Enterprise GIS Summer Bootcamp" at the university from June 3 - 7, 2013. All of the salient details, including contact information, can be found here (PDF).

Having seen Dr. Lembo and his team in action for an afternoon at TUGIS, I think this will be a good way for those who have been wanting to take the leap with open-source GIS tools to get some hands-on experience with core tools like QGIS and PostGIS. It's also a great time of year to be on Maryland's Eastern Shore. The LinkedIn discussion says there are still spaces available but the date is coming up soon so you'll want to move quickly if you're interested.

May 23, 2013 09:33 AM

May 22, 2013

Postgres OnLine Journal (Leo Hsu, Regina Obe)

KNN GIST with a Lateral twist: Coming soon to a database near you

One of the things that really frustrated me about the KNN GIST distance box box centroid operators that came in PostgreSQL 9.1 and PostGIS 2.0 was the fact that one of the elements needed to be constant to take advantage of the index. In PostGIS speak, this meant you couldn't put it in the FROM clause and could only enjoy it in one of two ways.


Continue reading "KNN GIST with a Lateral twist: Coming soon to a database near you"

by Leo Hsu and Regina Obe (nospam@example.com) at May 22, 2013 12:35 AM

May 21, 2013

CartoDB

PGCon: The-most-advanced-database-in-the-world Conference

image

Did you know that CartoDB runs atop PostgreSQL, the most advanced database in the world? Which also happens to be open source? And the fastest growing database in the market?

We actually contribute extensively to our favorite extension of it, PostGIS.

A lot of what is possible in CartoDB is thanks to this flexibility and extensibility of PostgreSQL. (And it still amazes us, all the cool things that can be done in just good, old, plain SQL (size sorting, distance queries, or digging into data).

PostgreSQL has some of the most advanced and replicated technologies, with extremely powerful extensions and analysis SQL. But even more importantly for us at CartoDB, with PostGIS, PostgreSQL offers exceptional geospatial support. PostGIS performs better and with superior functionalities than Oracle, MongoDB, SQL Server, and well, any other database out there. And the fact that PostGIS is just an extension to PostgreSQL demonstrates how extensible and powerful that database is.

Every year the PostgreSQL community gathers together to discuss the future of our favorite database and share ideas. This event is called PGCon, and it happens in Ottawa this week! Our CEO Javier de la Torre will be there to hear from others and share some of CartoDB’s experiences.

Or,  if you ever want to talk about maps and PostGIS in general please ping us. We’d love to show you CartoDB, talk about maps with millions of records, hosted PostgreSQL services, etc.

But hopefully — see you in Ottawa!

 

May 21, 2013 02:50 PM

May 20, 2013

CartoDB

The open source geospatial community comes together again at FOSS4GNA

image

The open source geospatial community has some of the best people and the most exciting ideas. That’s why we are always excited to take part in one of a few conferences that bring so many of those great people and amazing ideas into the same place for a few days. This Wednesday marks the start of FOSS4G-NA, a fairly new meeting meant to give the North American FOSS4G community an additional and slightly easier way to get together outside of the big FOSS4G conference. It has been a great addition.

Right now, we are putting the finishing touches on a couple of presentations we will be giving at the conference. The first presentation is a lightning talk titled, The future of geospatial data formats at CartoDB. In that talk, we want to show you some of the ways we are using novel formats and the modern web to push geospatial data visualization. The second is titled, Building Geospatial Applications that can read and write data to CartoDB without proxy. In that presentation, we are showing how CartoDB can be used without any additional backend infrastructure to do some interesting things on the web.

If you can’t make it, be sure to follow the conversation on Twitter. If you can make it, find us (@CartoDB or @andrewxhill) and let us know what you are up to using CartoDB or ask us any questions you are dying to get answered. Looking forward to seeing everyone there!

May 20, 2013 02:06 PM

May 17, 2013

CartoDB

Make maps from data you collect in Google Forms

While many CartoDB users arrive to the service with data on hand others look to use CartoDB to host and map data from ongoing collection. For those users, we offer a number of useful client libraries and tutorials for using our APIs. For businesses, scientists, and students that still want a little easier way to collect data, we thought we would put together this tutorial covering how to collect data with Google Forms and have it inserted directly into a CartoDB table.

In our example, we create a simple form to collect people’s favorite color and their location in the world. Using Google Forms plus a small Google App Script, we then insert those results into our CartoDB table where we have a live map that shows the latest and greatest results to the world. Be sure to fill the form out yourself and see your vote show up on the map!

We have included all the code plus the screencast for you to create your own forms for data collection. It only takes about 5 minutes! Have fun and remember to share the cool things you come up with!

May 17, 2013 02:27 PM

May 16, 2013

CartoDB

The versatility of retreiving and rendering geospatial data with CartoDB

We have been discussing a lot lately how we can summarize CartoDB in a short and sweet sentence. A lot of adjectives have been tested. One of the options we have liked the most is, CartoDB allows you to render your data on a map. As simple as the phrase sounds, it packs a lot of meaning. Let us explain…


How CartoDB serves geospatial data, the common

At its core, CartoDB gets the data from a database and renders it to tiles. Tiles are a clever solution where images of data instead of complete datasets are transferred over the internet, saving a lot of bandwidth. They also are created on a regular grid that makes them perfect for caching. Once delivered to the browser, those tiles are rendered by any client side API of your liking (e.g. Leaflet, Google Maps, OpenLayers, ModestMaps). Besides being a clever solution to displaying large-scale data on the web, rendering tiles is fast and compatible with old browsers and mobile devices.

Tiles are not a magic bullet for maps on the web. Most obviously, when we don’t have a lot of data there isn’t much gain from tiles versus sending the real data itself. For example, if you need to render 100 points, you will need 100*4*2 (4 bytes per float, latitude and longitude), 800 bytes. It is very likely that the tile or tiles you would need to render these points would take much more than 800 bytes. You also get all the benefits of dynamically changing your data (e.g. adding, removing, or moving points) and you can add things like hover effects that can not be done with tiles alone.

Luckily, CartoDB is way more than just tiles.


How CartoDB serves geospatial data, the non-tile way

CartoDB has a nice API to access to the data, the SQL API. It takes a SQL statement and returns the resulting data. You could use it for simple things like, get the points in your table, to complex things like we do with Torque. Torque is built around the idea that a powerful SQL function can be run to turn any CartoDB table with temporal geometry into a moving visualization in the browser. That can’t be done with tiles.

The SQL API also gives developers a few options for data formats, those include a flat JSON format, TopoJSON and GeoJSON. The GeoJSON format is meant for us mappers, it allows you to transfer geographic information (including metadata) using JSON as container, but in a predictable schema that many of your client side mapping libraries already know. Sounds good, eh?

Getting the data from your cartodb account to your JavaScript application can be done really easily using CartoDB.js. Here is an example of the JavaScript API:


Rendering vector data using Leaflet

Using Leaflet as an example, we render that GeoJSON data on our map with just two more lines of code:

You can see it running here.


Rendering vector data using Google Maps

Google Maps does not support GeoJSON natively but there is a library that fills the void, GeoJSON-to-Google-Maps. The library works in a different way than Leaflet and takes a few more lines of code. You can see a simple example with source code here.


CartoDB is built for your dynamic data

Okay, that was fun but the best thing is yet to come. CartoDB is a dynamic service and that means you have some powerful flexibility in how you retrieve your data for the web. You could execute queries to only get a subset of your data. Or you could query for only the latests data inserted into your tables. You could optimize your maps by changing the quality of the data depending the device your viewers are using. Or you could animate your data if it is linestrings or points with timestamps. This is where the SQL API really gets powerful.

Filtering the data

Imagine you want to get the countries of a particular size, say 1,000,000 Sq Km. Here, we’ll use the SQL API with a little bit of geospatial filtering (ST_Area is going to return meters, so we divide by 1 Sq Km):

Here, we can query for only the points close to known location, specifically the wifi hotspots nearest a viewer.

See the complete example with custom point markers.

(Click anywhere in Manhattan below to see the closest WiFi locations)


Simplify geometries

Sometimes geometries, such as country borders, are really complex, meaning they also make for large files to transfer over the web. We can fix this easily with CartoDB and on-demand geometry simplification over the SQL API:

This can be really useful for developing mobile applications, where data transferred is a very important consideration.


Hover effects

Now that we are rendering data directly in the browser, hover effects are as simple as changing the style of the target:

See the hover example for a full example.


Advanced usage

Apart of these simple examples you can go a lot further and do animations, add effects using D3, draw on canvas, or integrate your geospatial data with other web technologies. For inspiration, take a look at this animated visualization showing the earthquakes using D3 or Torque, our library to create animations using canvas.


Conclusions

Now you’ve seen how CartoDB can dynamically filter data based on user actions and can provide vector layers to display right on Leaflet and Google Maps.  This is one of the key advantages of CartoDB, it allows you to show your dynamic data. Not only based on changes to your request, but as soon as you add or update data in your table, you will see it realtime on the map. This is true whether you choose to to use vector data or tiles! And not even that, CartoDB provides all the infraestructure to support millions of map views, see eRepublik’s dynamic maps use case.

If you have ever been curious about why you would choose CartoDB, we hope this helps you make the decision!

May 16, 2013 09:15 AM

May 12, 2013

Postgres OnLine Journal (Leo Hsu, Regina Obe)

PostGIS 2.1.0 beta2 is out and windows binaries available

PostGIS 2.1.0 beta2 is out. Details on what's new in it are in official news release: http://postgis.net/2013/05/11/postgis-2-1-0beta2. This is the first version of PostGIS to work with PostgreSQL 9.3, so if you are planning to experiment with PostgreSQL 9.3 coming out soon, use this one. Also check out the documentation in new ePUB offering format if you have an ereader and let us know how it looks. It seems to vary alot depending on what ePub reader used.

For windows users, we've got binary builds available compiled against PostgreSQL 9.3beta1 (and also available for 9.2 9x32,64) and 9.0,9.1 (x64). Details on windows PostGIS downloads page: http://postgis.net/windows_downloads. It does not yet have the new Advanced 3D offering (provided by SFCGAL https://github.com/Oslandia/SFCGAL), but we hope to have that compiled and packaged with the binaries before release time.

by Leo Hsu and Regina Obe (nospam@example.com) at May 12, 2013 10:38 PM

May 09, 2013

CartoDB

Did you know you can do dynamic graphs with CartoDB? The Policy Climate Interactive project

Even though our blog gives a lot of attention to maps, CartoDB is a great tool for a lot more than just maps. We have seen in the past how the CartoDB APIs can do all sorts of dynamic queries to CartoDB hosted data. While dynamic queries CartoDB can be geospatial in nature, even returning GeoJSON formatted results, we haven’t spent much time highlighting the fact that they don’t have to be geospatial. That is why we are excited by the latest project released by the Climate Policy Initiative, the Policy Climate Interactive.

The Policy Climate Interactive is an online tool, focused on the key economies driving both climate change and climate policy in the world. The report highlights both the good and the bad through the use of interactive data visualization driven by the CartoDB APIs. No other platform available gives the flexibility to dynamically query hosted data in a way that you can create client side visualizations so simply.

In this case, the D3 framework was used to build some really beautiful graphs of the data underlying global climate policy. We were really impressed to see how beautifully CartoDB works with D3 for doing these data visualizations without any maps! This project highlights how powerful CartoDB can be even for non-map based data visualization. Take a look through some of the results,

The way the project uses the D3 library and data coming directly from CartoDB is cool for many reasons. A clear one is the data curation and management flexibility it give the project administrators. Administrators can easily add and modify the source data on CartoDB and the results will immediately appear in the graphs online! CartoDB also gives users the ability to create download links for particular subsets of data, by adding a link to the API query with and indicating the export format (e.g. CSV, Excel, etc).

We are excited to share this project and are honored to have CartoDB be part of such an important project. Congratulations to [Climate Policy Initiative](http://climatepolicyinitiative.org/) for delivering such a forward thinking website and data publishing platform.


May 09, 2013 05:26 PM

Boston GIS (Regina Obe, Leo Hsu)

Chopping rasters with gdal_translate

We had this big raster that we needed to chop up into tiles and only extract a portion of for load into PostGIS. raster2pgsql doesn't currently have an option to pull just a portion of a raster and also we don't have the windows raster2pgsql compiled with MrSID support. Luckily GDAL commandline gdal_translate has this switch that allows you to specify a chunk of a raster to grab based on a projected or unprojected box window. We wanted to grab just that portion that is part of boston and chunk it into bite size pieces. What we needed was a grid generator similar to what we described a while back in Map Dicing and other stuff that would chop our neighborhood into bite sized tiles we could then use to generate the relevant gdal_translate command. Instead of using temp tables and all that stuff, we decided to try with the ST_Tile raster function. Creating an empty raster and then tiling it.

Note the repurposing: Creating a raster with no bands to accomplish a task that has nothing to do with rasters, so that we can then apply it to something to do with rasters. Gridding is a surprisingly common step in a lot of spatial processing workflows.

Here is the SQL to do it and we'll explain in a separate article in more detail.

In a nutshell, we're using PostGIS raster technology (ST_Tile function introduced in PostGIS 2.1) that we demonstrated in Waiting for PostGIS 2.1 ST_Tile to create a grid because PostGIS geometry doesn't have cool gridding function like SpatiaLite has :). SpatialLite tesselation. Perhaps in PostGIS 2.2 we'll see some of these SpatiaLite niceties. However ST_Tile does the trick fairly nicely and quickly. For this example took under 600 ms to generate 1524 rows of GDAL commands.


Continue reading "Chopping rasters with gdal_translate"

by Regina Obe (nospam@example.com) at May 09, 2013 08:21 AM

May 06, 2013

Nicklas Avén

A few questions and answers about the last posts

I have had a few questions about TWKB and the websocket DEMO

When does the geoemtries actually load?
It is not obvious when the geoemtries actually gets loaded from the server to the browser.

That happens first time you click a layer. Then the geometries are streamed row by row via websocket to the browser which parses the geometry and adds it to the map, also geometry by geometry. Then if you switch off a layer and back again it is just loaded from Leaflet internally.

Can TWKB handle more than 2 dimmensions
Yes, TWKB can handle up to 7 dimmensions.

Can this websocket approach be used for writing back to the database?
Yes that is easy to implement. Just send the geometry back to nodejs with ws.send(), and insert it to the database. There is no function to import from TWKB into PostGIS. That is no big thing to write, but I don’t think there is the same performance need when posting back to the database, since that will be one or two geometries, not thousands of them. So the easiest is to just send it back as WKT and use ST_Geomfromtext to get it in the database.

by Nicklas Avén at May 06, 2013 10:13 AM

May 05, 2013

Boston GIS (Regina Obe, Leo Hsu)

PostGIS 2.1 Manual in EPUB format

Following PostgreSQL's lead, I thought it would be nice to provide PostGIS manual in ePub format. It turned out not to be a lot of work, but probably a lot more to fine tune it. I've changed Debbie (a PostGIS build-bot) to build this format and publish to PostGIS site whenever a change to PostGIS 2.1. You can download from http://postgis.net/documentation. The link next to EPUB.

I would appreciate if people could try it out on their eReader devices. On my Android tablet it looks pretty good, and had the nice feature of when I clicked on the epub link to download it, it added it to my library. I can't figure out how to click on the links (probably because I just use my desktop). and table of contents seems to crash the reader. On my windows firefox ePub viewer, it looks pretty yucky but much easier to navigate. I guess there are a LOT of differences with ePub readers.

by Regina Obe (nospam@example.com) at May 05, 2013 06:10 PM

Nicklas Avén

Mapservice from Websocket with TWKB

For those who don’t know what I am talking about TWKB is a compressed binary export format from PostGIS described here, and here.

It is just in the experimental stadium. The source for the PostGIS part can be found here

The Mapservice
What I find maybe most interesting is the websocket thing. I haven’t played with that before. Maybe this is old news for all of you out there. But websockets works cross-domain. So, a websocket can be approached from a page on my webserver or from a page on your desktop. That makes no difference.

You can download the index.htm from the demo:
The DEMO
put it someone on your computer, open it with a browser and it should load the maps.

You can also put this in a javascript:

var ws = new WebSocket('ws://178.79.156.122:8088');
ws.send(JSON.stringify({"nr":nr,"map_name":map_name}));

and you should get a reply if you use one of the map names that my “service” has.

If you don’t know the map names you can send:

ws.send(JSON.stringify({"request":"getcapabilities"}));

and you will get back a json-object with some metadata (That is demonstrated in the demo too)

All this is very unfinished, but it shows the idea.

Test it in OpenLayers too
The demo I have written is in Leaflet. That is just because it seemed easier to get started to test this in Leaflet. But it would be very interesting if someone took TWKB for a ride with OpenLayers (3). Since OpenLayers 3 promises webGL support a compressed binary format ought to be interesting.

What parameters the websocket takes
This is not even tested all of it, but here is what you can send to the wesocket:

map_name
srid (if not passed the srid of the table will be used, which can be found as default_srid in with getcapabilities)
precision how many decimals the coordinates shall have. Consider what unit your srid has. If not set the default value will be used
center.x & center.y Those coordinates gives the point that the result is ordered from. The idea is to get it order from the middle of the map, which makes sence if you are zoomed in and don’t see the whole map
inverted_lat_lng, boolean

As showed here it can be used directly from the websocket. Then there is not even any compiling involved.

I will, as I have said come up with a post about the technical aspects of the format, but I am afraid that will take some time. Meanwhile I will gladly answer any questions to make it easier getting started.

by Nicklas Avén at May 05, 2013 12:03 AM

May 04, 2013

Jorge Arévalo

GDAL 1.10 released

GDAL 1.10 was released past April. It includes, among others, the last improvements to PostGIS Raster driver, taking advantage of VRT and MEM drivers. Check PostGIS Raster driver page for further information.

I’m currently working on further improvements to the driver, thanks to Rapideye support and feedback. Apart from that, I’m collaborating with gvSIG CE and QGIS projects. So, upcoming news soon.


by Jorge Arévalo at May 04, 2013 01:42 PM

May 02, 2013

CartoDB

eRepublik Brings CartoDB’s Dynamic Mapping to Online Gaming

For years we at CartoDB have been dedicated to visualizing geospecific data to gain analytic insight and tell compelling stories. Our real-time rendering and time-lapse technologies have helped illustrate phenomena all over the earth from Barcelona traffic to Kenyan elephant movements to the history of meteorite strikes on the planet. Now for the first time CartoDB’s power of dynamic mapping is also enhancing a virtual world with massively multiplayer online game eRepublik.

eRepublik is a popular free-to-play strategy game with hundreds of thousands of users globally. Players in eRepublik’s New World claim allegiance to a specific country, for which they build companies, develop diplomatic strategies, and fight on battlefields for more territory. While maps are an especially apt visualization for this kind of gaming application, eRepublik had a hard time to provide them for so many players with any useful accuracy. The game’s very popularity and the volume of rapidly changing content posed the greatest obstacle to successful mapping. CartoDB, however, gives eRepublik a means of producing accurate maps for their many users for a fraction of the cost charged by other SaaS mapping companies.

CartoDB, unlike other mapping platforms, is in fact designed to handle dynamic content at large scales efficiently. With our API eRepublik no longer needs to generate new maps after each player’s action. Instead, as the game progresses eRepublik simply modifies the map data, and the platform renders the changes automatically. Map content gets updated at least once every twenty minutes and players are able to see a visual representation of the game’s current state with practically real-time accuracy. CartoDB handles approximately two million map views in eRepublik daily.

We’re pleased at CartoDB to share this use of our platform by eRepublik both because we’re proud of how it showcases our exceptional dynamic rendering and scaling capabilities, and because for us it’s new territory. Games like eRepublik demonstrate that not every community organizes around real space, and geospatial data is not the only kind that produces interesting map stories.

Let us know if you have more ideas for alternative-space uses of CartoDB, and as always, don’t be shy about sharing your own map stories!

May 02, 2013 01:37 PM

April 30, 2013

Postgres OnLine Journal (Leo Hsu, Regina Obe)

Which PostGIS should you use with PostgreSQL 9.3

PostgreSQL 9.3 will be coming out in beta soon and with that, some who want to experiment with both PostGIS and PostgreSQL 9.3 have asked if they can use PostGIS 2.0. The answer is NO. A lot of major changes happened in PostgreSQL 9.3 that required us to patch up upcoming PostGIS 2.1. These changes were not backported to 2.0 and I personally do not plan to back-port them unless lightning strikes me and I escape unscathed, a big wad of cash falls from the sky, or for some reason we can't make the 2.1 cut before 9.3 comes out. So if you are planning to experiment with PostgreSQL 9.3, PLEASE use PostGIS 2.1 development branch. I will try to make sure we release 2.1 before PostgreSQL 9.3 comes out even if I have to resort to hitting some people over the head with a rubber bat :).

If ever in doubt what versions of PostGIS works with what versions of PostgreSQL /GEOS / GDAL, please refer to the matrix that we try to keep up to date. http://trac.osgeo.org/postgis/wiki/UsersWikiPostgreSQLPostGIS.

Now some people might say "Isn't it cruel not to support PostGIS 2.0 for 9.3", and my answer is "it's crueler to". The reason is simple. We have limited bandwidth for testing permutations of things and the more permutations of things we support, the dirtier our code base becomes making it harder to maintain and also the less time we can devote to properly testing each permutation. I'd rather say we don't support something than to do a half-hearted job of supporting all. On a slightly different, but also pragmatic note, package maintainers (except for windows maintainers :)) generally only carry one version of PostGIS per version of PostgreSQL, and I'd rather users getting from packages see our best foot than a two year old aging foot.

Note: that going from PostGIS 2.0 to 2.1 is a soft upgrade so you can install 2.1 on your existing PostgreSQL 9.2 without dump restore and then you should be able to pg_upgrade over to 9.3 if your database is too big to dump restore.

by Leo Hsu and Regina Obe (nospam@example.com) at April 30, 2013 04:30 AM

April 28, 2013

Nicklas Avén

Nodejs, Websockets and TWKB

A short update about twkb, described in this earlier post

I have been doing some testing, sending the geometries from PostGIS to the client as twkb through a websocket.

This is the first time I have been playing with nodejs and websockets. It is really nice things.

Here is the demo:

http://178.79.156.122/twkb_node/

Wait till the page is properly loaded, and click “Municipalities” or “Areal types”. then you should see the geometries start showing. It should start showing in the middle of the map and going outwards. The neat thing about that is that when you are zoomed in at any place in the map and click “Areal types” for instance, you will almost at once get the geometries where you are zoomed in.

But if you click Municipalities before the “Areal types” are finished, you will have to wait a few seconds. That is because all geometries of the first layer is already queued at the client, and I haven’t found any way to manipulate that queue.

To get the stream ordered by distance to the center of the map is only possible because the geometries is taken directly from the database.
The query for the Municipalities layer looks something like this:

SELECT kommunenr, ST_Astwkb(geom,3,kommunenr,'NDR') geom
FROM kom_geom
ORDER BY ST_Setsrid(ST_Point($1,$2),4326) geom;

where $1 and $2 is lat long from the center of the map.

I think it works pretty fast. Municipalities layer has 435 geometries and 149363 vertex-points in total, and the Areal types layer has 3553 geometries and 179025 vertex-points.

by Nicklas Avén at April 28, 2013 11:04 PM

GIS professionals in Iran

‫امکانات جدید در PostGIS 2.0‬

ورژن ۲ از پایگاه داده مکانی PostGIS در سال ۲۰۱۲ متولد شده است. این نسخه جدید همراه با بسیاری از تغییرات اصلی و ویژگی های اضافی عرضه شده است. پشتیبانی از رستر در پایگاه داده یکی از ویژگی هایی است که مدتها انتظار می رفت و اکنون در نسخه ۲٫۰ وجود دارد. در باب توپولوژی [...]

نوشته امکانات جدید در PostGIS 2.0 اولین بار در سایت تخصصی جی.آی.اس پدیدار شد.

by ‫ادمین‬ at April 28, 2013 04:51 AM

April 22, 2013

Postgres OnLine Journal (Leo Hsu, Regina Obe)

Word Play with Spatial SQL

In Happy Valentine PostGIS we demonstrated how to use PostGIS raster to decipher letters from a raster, vectorize them and then reuse this vectorized letters to form new words. Admittedly the letters were a bit grainy since they were vectorizations of low res rasters and I didn't bother smoothing them. Bruce Rindahl offered a script to SVG to PostGIS geometry and using Batik to convert a font file to SVG format and gave me a hi-res converted kankin fontset. I still haven't figured out how his script works.

Bborie Park thought that was all too complicated and thought (as I have always) that we need an ST_GeomFromSVG function for PostGIS of which he is on a mission to create when he's less busy. He also suggested I wrap my letter writer function as an extension. Taking all these ideas, I formulated an extension you install with

CREATE EXTENSION postgis_letters;

postgis_letters (http://www.bostongis.com/postgisstuff/postgis_letters_extension.zip) is an sql / data extension containing mostly data, but as the name suggests relying on PostGIS. The data are geometry vectors of the kankin font. I plan to add in more free fonts later once I figure out how to use Bruce's script or Bborie comes up with a better way and also more positioning logic and handling of spaces. So its a little rough at the moment. The purpose of the extension is so I can write words on my images in reports e.g. state names or overlay labels on geometry features like roads and land. Using the power of both geometry/raster you can have a fully functioning report image writer that would return a fully formed image for use in LibreOffice (or for my ASP.NET web apps Active Reports.NET). This wouldn't rely on any mapping server to draw images (just pure PostGIS/PostgreSQL). Hopefully with new and improved binary features coming in PSQL for (looks like 9.4), outputting these raster images from psql will also be trivial. While on my mission to do something useful, I got distracted by something more entertaining: describing spatial processes with words. Here it goes.


Continue reading "Word Play with Spatial SQL"

by Leo Hsu and Regina Obe (nospam@example.com) at April 22, 2013 12:44 AM

April 13, 2013

Postgres OnLine Journal (Leo Hsu, Regina Obe)

Determine which version of PostGIS each database is running

One of the features of PostGIS (pain to some however you look at it), is that PostGIS library file is versioned by minor version. The library will have for example a postgis-2.0 or postgis-1.5.dll / .so to denote the version. Each version of PostGIS can be compiled to run on usually about 3 or 4 versions of PostgreSQL.

Since PostGIS is not part of PostgreSQL proper and has to be installed separately, it is possible to run a different version of PostGIS in each database of a cluster. While this is a great feature for PostGIS developers and also great for users who want to keep their old legacy PostGIS apps, while testing or creating new apps with the PostGIS 2.0 or experiment with 2.1 development series, it does pose some obvious challenges.

For example you can't simply just upgrade your cluster to a new version of PostgreSQL. You need to make sure the new cluster has the various versions of PostGIS compiled and available. One step to that end is figuring out exactly what version of PostGIS each database in your cluster is running. Here is a quick psql script I wrote up to help with that.


Continue reading "Determine which version of PostGIS each database is running"

by Leo Hsu and Regina Obe (nospam@example.com) at April 13, 2013 10:32 PM

April 12, 2013

Boston GIS (Regina Obe, Leo Hsu)

pgRouting Tutorials: Part 1

As mentioned in prior article we have windows binaries available for upcoming pgRouting. When we get new things, we like to take them for a test drive. So we've put up our first tutorial ever on pgRouting: pgRouting: Loading OpenStreetMap with Osm2Po and route querying. The OSM2PO pgRouting loading content we borrowed from Anita Graser's An osm2po Quickstart, but put a Boston spin to it.

We hope to use this tutorial series as a springboard for testing the radical changes in pgRouting currently going on.

by Regina Obe (nospam@example.com) at April 12, 2013 02:55 AM

April 10, 2013

LInfiniti (Tim Sutton)

Dynamically updating layers in QGIS with PostGIS views

View here on youtube: https://www.youtube.com/watch?v=oOhbbEkl4Kg

by Tim Sutton at April 10, 2013 02:39 PM

CartoDB

Guest Post: TeamUP wins third prize in Urban Data Challenge

Today we here from Chong Zi Xin and a team of hackers that took part in the recent, Urban Data Challenge. The team reached out a few months ago about using CartoDB for their challenge entry and the other day we found that their entry had won 3rd place. We were really impressed with some of the maps they produced, including perspective views with integrated bar charts (wow!). 

The Urban Data Challenge is a competition that aims to improve transportation through the visualization of urban data sets by drawing meaningful insights. Public transport data such as trams, buses, bicycles and pedestrians from Zurich, Geneva and San Francisco is provided for participants to merge and compare mobility data sets from these three cities.

image

The project, titled “A City’s Heartbeat”, done by core members of three start-ups, won third prize in the Urban Data Challenge. The project utilizes Geneva’s trams and their passenger flow information to help improve urban mobility, tourism experience as well as businesses (such as cafes near tram stops) to make better decisions.

Our first challenge, is to render big, time-series data of tram movements over a two day period. This temporal mapping was achieved by using the CartoDB SQL API and reusing code from their Torque examples. The basic idea is to treat the database table as a cube, while only downloading and visualizing a few slices of the data at a time. It worked beautifully. 

image

image

April 10, 2013 02:04 PM

April 09, 2013

Nicklas Avén

Tiny WKB

Lately I have spent some time on a compressed binary output format from PostGIS. It is so far just some sort of “proof of concept”.

The idea is a binary format with some of the features found in common text-based gis formats. The main features is:

  1. Controllable precision (number of decimals)
  2. Relative coordinates
  3. The ID of the geoemtry is stored in the geoometry

I have called the format Tiny WKB since the wkb-format was the closest I know of. But probably the name should be something different since wkb means “well known binary” and this is not “well known”. But Tiny WKB or twkb will have to do for now. The function in PostGIS to create a twkb geometry is I have called ST_ASTWKB, ST_ASTWKB(geometry, precision, ID, endianess).
The sourse code for the TWKB creator is found in http://svn.osgeo.org/postgis/spike/nicklas/twkb.
Just get it with subversion and compile as usual with PostGIS.

So, let’s take a look at the advertised features:

Control over number of decimals

The geometries stored in the database have far more precision than needed for presentation purposes. Often when showing a map on the web, a precision more than one meter is overkill, even when zoomed in. So, if you are using a meter based projection and you want just full meter precision you set the precision parameter to 0. If you want 10 meters precision you set precision to -1.

Relative coordinates

For instance a line like
‘LINESTRING(352400 6752414, 352415 6752418, 352452 6752402)’
, with relative coordinates looks like this:
‘LINESTRING(352400 6752414, 15 4, 37 -16)’

The more coordinates in a geometry the more space we save by using relative coordinates. This is used in formats like SVG and TopoJSON. It gets more complicated when dealing with a binary format since there is no separator between the numbers. In wkb-format for instance that is no problem since all numbers uses the same number of bytes or bits. The reader just counts the bits and knows where the number stops. But then we would gain nothing from our relative coordinates. So twkb handles 3 different storage sizes of the coordinates 1, 2 or 4 bytes.

Storage of the geometry ID  inside the geometry

In the header of the geometry there is a 4 byte integer for storing an ID of the geometry. This gives some possibilities. For instance we can write an aggregating variant of ST_ASTWKB. Then we can aggregate the twkb geometries to geometry collections grouped by intersection with a grid. Then we get vector-tiles directly from the database with ID inside the tile to each single geometry. So at client side each geometry can be identified and joined to it’s attribute data.

The ID should also make it easier to implement support for typologies. All edges can be sent separately with included ID.

OK, so how small does it get

To give some numbers in bytes:

geometry WKB TWKB incl 4 bytes of ID
POINT(1 1) 21 14
LINESTRING(1 1, 10 15) 41 20
LINESTRING(1 1, 10 15, 22 30) 57 22

Ok, you get the point. Bigger geometries gains more from twkb than smaller. But the gain gets smaller if the need of precision is higher. If we take the last example and wants to store 3 decimals the difference is smaller. Also if the distance between the coordinates increases we need more space to store the relative coordinates. There is also an overhead in changes of sizes. So, to make it extreme:

geometry WKB TWKB incl 4 bytes of ID
LINESTRING(1 1, 1000000 15, 1010 30) 57 36

TWKB is still quite a lot smaller than WKB but the difference is smaller.

But how fast is it?

That is not easy to answer. It takes some overhead to create the TWKB since the geometry have to be analyzed in the database and each coordinate calculated, not just copied. But that overhead seems to disappear in the gain of decreased IO.

I have a layer of all the roads in Norway. Some stats of the layer:
Number of linestrings: 1224248
Total number of vertex points: 23485321

To just check the cost of creating WKB vs TWKB we can do like this (and get the total size as bonus):
SELECT SUM(LENGTH(ST_ASBinary(geom))) FROM veger;
that takes on this machine 979 ms

The corresponding query for TWKB looks like this:
SELECT SUM(LENGTH(ST_ASTWKB(geom,0,gid,’NDR’))) FROM veger;
and takes 2770 ms

So we have an almost 2 seconds overhead.

But if we instead of just checking the size of the result actually puts the result in a table:

CREATE TABLE wkb_veger as
SELECT ST_ASBinary(geom) geom FROM veger;

takes 6437 ms

and

CREATE TABLE wkb_veger as
SELECT ST_ASTWKB(geom,0,gid,’NDR’) geom FROM veger;

takes 3680 ms

So the smaller size even in internal handling in the database eats up the overhead.

To be fair we should mention that we reduce the number of decimals to 0. But actually the original layer had no more than 1 decimal precision even if there is a lot of trailing zeros. So if we create TWKB with 1 decimal instead it takes 4346 ms.

The geometries as WKB uses 368 mb

If stored as TWKB with 0 decimals it uses 63 mb, with 1 decimal 79 mb and with 2 decimals (1 trailing zero), 108 mb. Don’t forget that includes 4 bytes of ID to each geometry.

So, the database is quite fast in handling TWKB. But for web-mapping, how about php and javascript?

The DEMO

I think there is quite a lot of optimization to do in my demo. Maybe NodeJS is faster than php for getting the binary data out for example. Also the javascript TWKB reader I have written probably suffers from bad coding.

But it works, and my hope is that other people finds this interesting enough to build interesting clients. It would for instance be very interesting to see how QGIS would react on more slimmed geometries. I think it would give new possibilities to get faster rendering.

The demo can be found here:

http://179.78.156.122/twkb

It is a Leaflet map. To turn on the TWKB layers check the check boxes in the bottom of the page. I have tested in Chrome and Firefox. As you can see from the timer that appears after a TWKB layer is loaded there is several bottlenecks. I think php seems to work quite slow here and also the addition of the geometries in leaflet. The reading of the TWKB geometries (parsing) is just a very small part of the time it takes. The layers is stored in srid 4326. The first Municipalities layer has 3 decimals and Municipalities HD has 5 decimals. You can see the difference when zooming close. The “Areal Types layer” also has 5 decimals.

Summary

Now this is just a “prof of concept” in my sandbox in PostGIS resporitory.
If this sounds interesting give some feedback what is needed to make something good out of it. If you have the possibility it would be very valuable with a better and more sophisticated client. As mentioned QGIS rendering TWKB would be very interesting. If there is an interest I will write a new post describing the technical aspects of the format.

If the interest is big enough it might go into PostGIS some time :-)

by Nicklas Avén at April 09, 2013 10:25 PM

Postgres OnLine Journal (Leo Hsu, Regina Obe)

pgRouting windows binaries for PostgreSQL 9.2 32-bit and 64-bit

We've got experimental pgRouting windows binaries available for windows PostgreSQL 9.2 32-bit and 64-bit for pgRouting 1.0.7 development branch. More details on our Boston GIS blog page.

The final versions we plan to release with upcoming PostGIS 2.1 PostgreSQL 9.2 on stackbuilder as part of the PostGIS install. Barring no difficulties we'll also have experimental binaries for PostgreSQL 9.3 releases once 9.3 reaches beta.

This version and upcoming pgRouting versions support the PostgreSQL extension model, so if you have postgis already installed, its just an additonal simple step:


CREATE EXTENSION pgrouting;

by Leo Hsu and Regina Obe (nospam@example.com) at April 09, 2013 04:26 AM

Boston GIS (Regina Obe, Leo Hsu)

pgRouting 1.07dev windows binaries available for PostgreSQL 9.2 32-bit and 64-bit

We've made our first huge milestone. With much of Steve Woodbridge's help and patience as well as support from pgRouting Windows campaign sponsors, we have windows PostgreSQL 9.2 binaries for the pgRouting 1.07 development branch for both PostgreSQL 32-bit and 64-bit. You can download these from: Winnie's 9.2 windows downloads. Details on how to install are described on Windows download page at bottom. Please give these a try to see if they work okay for you. These binaries will work for PostGIS 2+ releases as well as the experimental PostGIS 2.1 builds and upcoming PostGIS 2.1 release.

We are still missing payments from some pgRouting sponsors. So if you haven't sent us payment yet, please do so. If you weren't on the initial campaign and would still like to give, you can still contact us at lr at pcorp dot us to make payment arrangements. If you want to contribute, we ask you do $100 USD or more since smaller amounts are too much bookkeeping. Any additional money's will go toward work on pgRouting 2.0 (not just Windows but general support of the rewrite) and future buildbot upgrades.

Steve is now pushing further forward with upcoming pgRouting 2.0, so the pgRouting code base will soon be a bit volatile and unstable. We are still in middle of setting up the buildbot to automate the future builds and then come PostGIS 2.1, you can expect to see pgRouting included in the PostgreSQL 9.2+ PostGIS 2.1 application stack builder packages.

by Regina Obe (nospam@example.com) at April 09, 2013 04:08 AM

April 06, 2013

CartoDB

Develop geo apps and maps at NYC BigApps 2013 with CartoDB

image

This year’s BigApps competition is kicking off right now in New York City. The competition challenges developers and designers to create applications that help the city tackle big issues, help make people’s lives a little better, and help people engage in the city around them.

We have been supporting the competition for a few years now, and we have seen cool applications like Scene Near Me developed using CartoDB. For this years challenge, the City has opened some great new datasets and has even expanded the rules of what you can use to participate on the challenge. As part of that expansion, CartoDB is now one of the official APIs and developing your app using CartoDB qualifies you to enter into the competition. We would love to see one of you win any of the great prices.

We are at the NYC BigApps 2013 Expo and Hackathon Weekend at eBay presenting our API and helping developers with anything geo and maps. If you are around, Andrew Hill can give your team a free upgrade to a Magellan account on CartoDB. 

We can imagine lots of different applications that can be developed for the great city of New York.  There are some areas in particular where we think CartoDB can really help participants. If your application has:

  • Maps that are interactive and that are dynamic
  • You need to find what is the closest subway, park, museum or whatever to a location.
  • You what to intersect location data from phones with any other dataset, in real-time.
  • You need a backend to store your data and be able to query on it live.
  • You need to analyze multiple datasets, merging them via location. For example what neighborhoods are more “bike friendly”.

We are really excited on this challenge and we look forward to help all participants with their GEO needs! Good luck everybody.

April 06, 2013 04:43 PM

April 05, 2013

Postgres OnLine Journal (Leo Hsu, Regina Obe)

PostGIS In Action 2nd Edition MEAP 3 Update

The 3rd MEAP update of PostGIS In Action, 2nd Edition will be going out very shortly to Early Action purchasers. Keep your eyes peeled. Lots of errata corrections in previous chapters and appendix, and one very VERY new chapter on Raster functions which took a ton of time to write, so hopefully it will be well received. Our progress on the chapters is listed on PostGIS In Action 2nd Edition Chapters and all the ones marked as completed you will find in the MEAP. The ones with paperclips have downloadable code and data which you can click on the paperclip to download.

Regarding Raster, the Raster Function chapter is just merely the tip. You'll see a lot more raster usage in upcoming Relating two or more spatial objects and Raster Processing chapter which we are still fleshing out.

We are immensely grateful to all the early action subscribers who have posted errata or general comments about what can be clarified or examples that don't work. General comments about what specific kinds of examples you'd like to see are also welcome. Your opinions really influence what we write and make for a better book.


Continue reading "PostGIS In Action 2nd Edition MEAP 3 Update"

by Leo Hsu and Regina Obe (nospam@example.com) at April 05, 2013 11:06 PM

April 03, 2013

CartoDB

Guest Post: Michael Keller from Newsbeast Labs

As some of you may already know, Newsweek / The Daily Beast has been using CartoDB for some time now, and as such today’s blog post comes from Michael Keller of Newsbeast labs. We’d also like to take the opportunity thank Michael for his amazing contributions to the CartoDB community. Thanks!  

A number of recent stories at the Daily Beast have had some kind of mapping component. We use them often to let people see how a national topic affects readers’ local areas.

image

I have been reusing code from former projects and so it was about time I standardized them into reusable templates with Leaflet.js. I released them on Github this week. 

I made three categories: basic map with hover states, hover states + hover infowindow, and all of that with templated infowindows using Underscore.js.

In each of these categories you’ll see a template for a point map, a polygon map, and a map with both points and polygons.

Some features:

• On point + polygon templates, the polygon hover state turns off when you hover over a point.

• Hover windows follow the mouse and respect the boundaries of the map-canvas. I find it most useful to have hover windows close to the mouse so your eye doesn’t have to leave that map region to see that region’s details

image

• Templates with Underscore.js hover windows include sample formatHelper functions to act as a formatting layer between your data values and how you want them to display. For instance, you could store all your feature attributes as boolean variables and run them through various formatHelpers functions to return nice display strings.

• The hover states work by storing a simplified GeoJSON representation of that feature as a feature attribute. On featureOver, that GeoJSON is plotted as a vector using Leaflet.js.

• Point + polygon templates add a secondary style class to hover windows when hovering over points to differentiate from polygons.

If you have any questions, I’m at @mhkeller. If you have improvements, pull requests at http://github.com/mhkeller/cartodb-templates

April 03, 2013 10:22 PM

OpenGeo

Why We Sprint

I spent last week in Boston, attending an annual code sprint for C-based open source geospatial projects.  I’ve been doing this every year since 2008.  Since getting back, I’ve had to explain the event to several people, technical and non-technical, since the concept isn’t obvious at all.

p3

Open source development of characterized by some features that differ a great deal from traditional work environments:

  • the developers work asynchronously, often in different time zones, usually in different locations,
  • the developers coordinate exclusively using text tools, like e-mail, issue tracking systems, and sometimes instant messaging

Because there is no need to be in the same space with other developers, either physically or even temporally, the barriers to entry to a project are lowered. More people can participate than otherwise.

p1

However, there are disadvantages to working asynchronously and with text communications.

  • asking for help when you get stuck can be time consuming, because your colleagues might be asleep at the moment when help would be most useful
  • issues of subtlety or complexity take a great deal of text to describe, and any misunderstandings on the part of a reader take even more text to correct
  • discussion of emotional issues can lead to conflict due to the limited emotional nuance in text communication

A code sprint is a chance to work for a time with your open source colleagues “the old fashioned way”, face to face, on the same clock.

p2

Because everyone is together, and communications are high-bandwidth and high-fidelity, a code sprint is a great time for:

  • planning and designing large scale changes to the code
  • designing new APIs or new user interfaces, and
  • triaging ticket lists to prepare for release

I usually spend the first half of a sprint on communication-heavy tasks like the ones above. The second half I usually spend heads down on a hard piece of code.

If the right experts are around, code sprints are an excellent time to attack a new piece of code you don’t quite understand. Learning how a module works from the expert who wrote it is far faster than doing it alone at home.

And finally, having lunch and dinner and socializing usually provide the social space for unexpected topics to slip out and get a discussion, whether they be uncomfortable issues like dealing with a difficult team member or just a crazy feature idea that turns out to be not so crazy at all when discussed with the group.

If you have a chance to participate in a code sprint on a project you contribute to, don’t pass it up!

by Paul Ramsey at April 03, 2013 04:42 PM

April 02, 2013

Boston GIS (Regina Obe, Leo Hsu)

Waiting for PostGIS 2.1: ST_FromGDALRaster free those images

We have a confession to make. We're not GIS analysts; we just play one at parties. Truth is the bread and butter of our business involves pretty boring stuff like e-Commerce, pricing (venture capital, private equity, travel, pension management), project management, work force management and all that other stuff that would bore a real GIS analyst to tears. Somehow we've got a lot of pictures to deal with particularly with project management and e-commerce work. So I was elated when Bborie checked in this new function ST_FromGDALRaster. With this function you can do all resizing and other manipulations right in the database with standard type images like PNGs, bitmaps and anything else users will throw at you.

As mentioned before, we like keeping our work related pictures in the database, but every once in a while, we'd like to manipulate them and it would be nice not to have to keep many sizes of one image in the database. Having to drag them out of the database to do stuff with them is kind of a pain or to keep extra sizes is also a pain. We'd like to keep the original format we were given intact, but all other custom sizes people ask for do on the fly.

For these operations, I'm using:

POSTGIS="2.1.0SVN r11230" GEOS="3.4.0dev-CAPI-1.8.0 r0" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.9.2, released 2012/10/08" LIBXML="2.7.8" LIBJSON="UNKNOWN" RASTER PostgreSQL 9.2.2, compiled by Visual C++ build 1600, 64-bit

Using the buildbot builds generated by Winnie PostGIS buildbot.


Continue reading "Waiting for PostGIS 2.1: ST_FromGDALRaster free those images"

by Regina Obe (nospam@example.com) at April 02, 2013 03:01 AM

April 01, 2013

Postgres OnLine Journal (Leo Hsu, Regina Obe)

PostOS

Forget Linux, Forget Unix, Forget MacWhatever, forget Windows, and any other OS you may be using. Say hello to PostOS. PostOS is built on PostgreSQL technology and fits you like a glove.

The built-in planner watches you type (or stare in confusion) and creates a composite image of what kind of person you are and what behavior it should emulate. It's integrated monitor display and speakers are used to provide information as well as to watch and hear your every move. The built-in image recognition system (an extension to the PostGIS extension), can distinguish between members of your family and can impersonate them as well and change behavior accordingly.


Continue reading "PostOS"

by Leo Hsu and Regina Obe (nospam@example.com) at April 01, 2013 06:24 AM

Stephen Mather

Boston Code Sprint

I hung out this week at the Boston Code Sprint http://wiki.osgeo.org/wiki/Boston_Code_Sprint_2013, which is a “C-Tribe” code sprint for improving things like PostGIS, MapServer, and other GeoFOSS projects written in C. See Paul Ramsey’s posts on PostGIS and MapServer for more on what everyone was working on.

Being my first time at a code sprint, it’s been very interesting, and it’s a very warm and inviting group. I will have some forthcoming posts on the work I did on skeletonization, and also work on getting it up on GitHub. Toward this end, Voronoi (yipee!) should land in PostGIS in the future via two venues. The first venue to provide Voronoi will be from the recently welcomed SFCGAL (optional) dependency additions to PostGIS coming down the pike from the Oslandia representatives, Olivier Courtin and Hugo Mercier, who were at the sprint. The second venue will be the addition of Voronoi from within GEOS as a port from JTS, since JTS already has it implemented. That may be a few months off, as it is being proposed as a Google Summer of Code (GSoC) project which Sandro Santilli agreed to manage (after hunting me down in IRC for my overly broad GEOS ticket).

For my part, I cleaned up and worked on documenting my existing code base for routing skeletonization, played a bit with some additional filtering techniques appropriate to skeletonization, and ran some performance tests against the skeleton results that Olivier was producing from an ST_StraightSkeleton function leveraging the CGAL computational geometry library. It wasn’t a fair test, as my skeletonization was approximate, and Olivier’s exact, but it did give us the sense that ST_Voronoi from that codebase might be more performant for the skeletonization problem than exact skeletonization as performed by CGAL. As part of the skeletonization problem, I have been tasked by Paul Ramsey to write a C implementation of Dijkstra routing, to remove my pgRouting dependency from my skeletonization code, which I will start in on when I get a moment to breathe.

So, what will skeletonization look like when it’s complete? Nobody knows, but my projection is that we’ll have a few functions, dependent upon the kind of information you have about the geometry you want to skeletonize. So for example, if you had a stream network with known inputs and outputs, the algorithm would take advantage of that a priori knowledge and use it to clean up the final skeleton. Something like:


skeleton_geometry ST_Skeletonize(geometry polygon, geometry multipoint);

This is will create a nearly perfect skeleton for the cases where you have this a priori knowledge.

Stream Centerlines

The tougher problem, of course, is when you have less knowledge about the skeleton. And if you want to encourage PostGIS developers to kibitz about analytical geometry, pose this as a problem– believe me that hours will be spent generating new algorithms for solving it. I arrived with 4 ideas on skeletonization (one of them the above) and left with an additional 3 or 4 great ones from conversations with Stephen Woodbridge, Regina and Leo, Pierre Racine, and Bborie Park (hopefully I haven’t forgotten any). But, regardless of which of these pan out, the idea is simple, instead of two input geometries, these will take an input polygon geometry and one or more tuning parameters. Cheers to Paul too for helping to limit the depth of this rabbit hole for me.


skeleton_geometry ST_Skeletonize(geometry polygon, value double, skeletonType text);

These solutions will likely not be as good as the routing solution above, but will be tunable to a posteriori results. The use case here might be scanned maps of road networks, contours or similar from which we want to extract linear features, or similar. Thus these approaches are an important addition to enhancing conversion from PostGIS Raster data type.


by smathermather at April 01, 2013 02:51 AM

March 29, 2013

Postgres OnLine Journal (Leo Hsu, Regina Obe)

Boston OSGeo Code Sprint Highlights

Today was the last day of the Boston OSGeo code sprint we hosted. Several OSGeo project tribes were represented. PostGIS had a big showing with core PostGIS developers and related working on PostGIS core, PostGIS 3D, PostGIS raster, pgRouting, geocoding, and point clouds. Leo and I with lots of help from Steve Woodbridge, spent a good chunk of time working out kinks of PostGIS pgRouting packaging for Windows and address normalizer replacement for the one packaged with tiger geocoder.

A special shout-out thanks to all the Code Sprint sponsors:

More details Paul's PostGIS Summary and Paul's MapServer Summary and our Boston OSGeo Code Sprint Synopsis.

by Leo Hsu and Regina Obe (nospam@example.com) at March 29, 2013 01:42 AM

March 28, 2013

Boston GIS (Regina Obe, Leo Hsu)

Boston OSGeo Code Sprint Synopsis

The Boston OSGeo Code Sprint ended today. Overall I think it was a great success just in terms of what was accomplished and the fact that it was the very first conference we had ever set up. We were all nerves so couldn't enjoy it as much as we wanted to. It was also the first conference we were able to sorta attend all days for.

Paul already gave a great cap on what was going on in the PostGIS and MapServer camps. I still felt like there was way too much coding going on and would be nice to have a bit more talking and a bit less typing.

I want to thank EnterpriseDb for being a Gold Sponsor and it would have been nice if they gave a talk. Maybe I can drag them in some other day. Rich Grady, of AppGeo gave a wonderful and humorous talk about the metamophisis AppGeo is going thru coming from a predominantly ESRI shop, now focused on the prize of finding the best solutions to solve spatial IT problems; which surprisingly does not always involve ESRI and is more and more requiring Open Source GIS technologies. They did show off their ESRI medals of honor and how well they kept papers from flying around.

For those who contributed to our pgRouting campaign, a BIG THANKS. We'll be circling back later this week or early next to try to finish collecting and charging credit cards. If you already wrote us asking, but how do I pay? and we haven't responded with details, don't worry about it. We'll get to you next week. More concerned about those who haven't contacted us.


Continue reading "Boston OSGeo Code Sprint Synopsis"

by Regina Obe (nospam@example.com) at March 28, 2013 09:49 PM

Stephen Mather

Boston Code Sprint

I hung out this week at the Boston Code Sprint http://wiki.osgeo.org/wiki/Boston_Code_Sprint_2013, which is a “C-Tribe” code sprint for improving things like PostGIS, MapServer, and other GeoFOSS projects written in C. See Paul Ramsey’s posts on PostGIS and MapServer for more on what everyone was working on.

Being my first time at a code sprint, it’s been very interesting, and it’s a very warm and inviting group. I will have some forthcoming posts on the work I did on skeletonization, and also work on getting it up on GitHub. Toward this end, Voronoi (yipee!) should land in PostGIS in the future via two venues. The first venue to provide Voronoi will be from the recently welcomed SFCGAL (optional) dependency additions to PostGIS coming down the pike from the Oslandia representatives, Olivier Courtin and Hugo Mercier, who were at the sprint. The second venue will be the addition of Voronoi from within GEOS as a port from JTS, since JTS already has it implemented. That may be a few months off, as it is being proposed as a Google Summer of Code (GSoC) project which Sandro Santilli agreed to manage (after hunting me down in IRC for my overly broad GEOS ticket).

For my part, I cleaned up and worked on documenting my existing code base for routing skeletonization, played a bit with some additional filtering techniques appropriate to skeletonization, and ran some performance tests against the skeleton results that Olivier was producing from an ST_StraightSkeleton function leveraging the CGAL computational geometry library. It wasn’t a fair test, as my skeletonization was approximate, and Olivier’s exact, but it did give us the sense that ST_Voronoi from that codebase might be more performant for the skeletonization problem than exact skeletonization as performed by CGAL. As part of the skeletonization problem, I have been tasked by Paul Ramsey to write a C implementation of Dijkstra routing, to remove my pgRouting dependency from my skeletonization code, which I will start in on when I get a moment to breathe.

So, what will skeletonization look like when it’s complete? Nobody knows, but my projection is that we’ll have a few functions, dependent upon the kind of information you have about the geometry you want to skeletonize. So for example, if you had a stream network with known inputs and outputs, the algorithm would take advantage of that a priori knowledge and use it to clean up the final skeleton. Something like:


skeleton_geometry ST_Skeletonize(geometry polygon, geometry multipoint);

This is will create a nearly perfect skeleton for the cases where you have this a priori knowledge.

Stream Centerlines

The tougher problem, of course, is when you have less knowledge about the skeleton. And if you want to encourage PostGIS developers to kibitz about analytical geometry, pose this as a problem– believe me that hours will be spent generating new algorithms for solving it. I arrived with 4 ideas on skeletonization (one of them the above) and left with an additional 3 or 4 great ones from conversations with Stephen Woodbridge, Regina and Leo, Pierre Racine, and Bborie Park (hopefully I haven’t forgotten any). But, regardless of which of these pan out, the idea is simple, instead of two input geometries, these will take an input polygon geometry and one or more tuning parameters. Cheers to Paul too for helping to limit the depth of this rabbit hole for me.


skeleton_geometry ST_Skeletonize(geometry polygon, value double, skeletonType text);

These solutions will likely not be as good as the routing solution above, but will be tunable to a posteriori results. The use case here might be scanned maps of road networks, contours or similar from which we want to extract linear features, or similar. Thus these approaches are an important addition to enhancing conversion from PostGIS Raster data type.


by smathermather at March 28, 2013 08:59 PM

March 26, 2013

Paul Ramsey

Boston Code Sprint: PostGIS

Rather than try and do a day-by-day take on the sprint, this year I'll try to outline project-by-project what folks are hoping to accomplish and who is attending.

This year we have the largest contingent of PostGIS folks ever, and work is being done on old-school PostGIS as well as the raster and geocoding portions that I usually look in with a bit of fear and trembling.

Azavea has sent four staff to the sprint. David Zwarg has worked on PostGIS raster at previous sprints and is continuing the tradition this year, focussing on building raster overviews inside the database.  Justin Walgran is updating GDAL to do EPSG code determination for arbitrary WKT strings. Adam Hinz is returning 1.5 semantics to some OGC geometry functions, and exploring SP-GiST implementation for PostGIS. And Kenny Shepard is adding geometry validity checking and policy enforcement to the shape loader utilities. Update: And, Rob Emanuele, who worked on QGIS support for PostGIS raster and the GDAL QGIS plug-in. Thank him, QGIS users!

Regina Obe has been working with Steven Woodbridge on an upgrade to the TIGER GeoCoder, integrating a C module for address normalization and a flatter scheme for storing address information. Early tests have shown this new approach to be much faster than the old PL/PgSQL code, which should make all the bulk geocoders out there very happy.

Stephen Mather is working on polygon skeletonization, to convert lakes and roads to linear equivalent features.

Oslandia has sent two representatives. Olivier Courtin and Hugo Mercier are working on SFCGAL, a C library wrapper around the C++ CGAL computational geometry library. SFCGAL will bridge PostGIS to use the CGAL 3D geometry algorithms, as well as algorithms like line voronoi generation, which will be useful for Stephen's skeleton project.

The two heavyweights of the PostGIS raster world, Pierre Racine and Bborie Park are here. Bborie is improving the performance of expression-based map algebra functions.  Always pushing the leading edge, Pierre Racine is coordinating the raster work, and collecting up new functional routines in PL/PgSQL into a library of utilities.

I'm spending time fixing my bugs in the 2.1 milestone, completing distance calculation for curved geometry types, and on the new pointcloud extension for LIDAR storage in PostgreSQL.

by Paul Ramsey (noreply@blogger.com) at March 26, 2013 02:56 PM

Bill Dollins

Light Housekeeping

Just a quick note to tidy up some loose ends related to recent posts...

First, regarding the post "A #LazyWeb Compendium of Python Resources for Beginners," the University of South Florida PyBulls Python interest group, as promised, compiled a list of Python resources and posted it on their GitHub page. Thanks to them for their quick response.

Second, following up on the post "The Best Thing I Saw at TUGIS 2013," the data and workbooks for Dr. Arthur Lembo's introduction to open-source GIS have been made available. The data can be found on GitHub and the workbooks can be found on the Eastern Shore Regional GIS Cooperative web site. Many thanks for contributing these resources.

These items are embedded in the comments for their respective posts but I thought it would be useful to call them out more prominently.

March 26, 2013 01:35 AM

March 23, 2013

Boston GIS (Regina Obe, Leo Hsu)

pgRouting and Boston OSGeo Code Sprint

The Boston OSGeo Code Sprint is just days away . Looking forward to seeing a lot of you. Of course, if you'd like to still sponsor some money to offset the cost of sprinters, that would be appreciated.

One of the projects we will be spending a lot of effort on is pgRouting on windows with special focus on pgRouting 2.0. Steve Woodbridge is doing much of the work on both the pgRouting 2.0 (making sure works cleanly with PostGIS 2.0+ series) and also helping us work out the issues with building under windows. That said -- if you promised to give us money for pgRouting windows campaign and haven't contacted us yet, PLEASE DO SO (lr at pcorp dot us). Of course, if you weren't on the campaign, it's not too late to subsidize this effort. Just contact us directly. It will go towards pgRouting on windows, general pgRouting cleanup, integration with PostGIS 2.0+ series, and CREATE EXTENSION support.

by Regina Obe (nospam@example.com) at March 23, 2013 03:45 AM