I am developing a district editor for cities. The idea is that we divide the city into districts. I am using GoogleMaps, but any other js library is acceptable.

Problem 1: districts are connected polygons, so changing one's border changes it's neighbour. I can not imagine a simple interface to join the polygons, and the ones, that I can think of are hard to implement (like sticky borders idea where borders 'stick' together when are near and 'unstick' when stretched far away.)

Question: Is there some library or an example of an Editor that can join Polygons, and changing one's border changes the neighbour? (Even non web examples would be of use to give me an idea of the user interface.)

Problem 2: I have a dataset based on data from wikimapia, that contains district polygons. Problem is that those polygons do not join by points and somehow overlap or have space between them.

Question: How can I process those polygons to gain ones, that have joined borders. I can use Python scripts or any other if needed instructions are provided. This is a one time operation, no need to implement a graceful solution.

Example of wikimapia dataset visualization


This is a slightly old question, but here is my Answer:

There is a wonderful Library called d3, which has been recently been used for a lot of GIS webMapping with vectors.

One of the best sites, that shows its capabilities, is OpenStreetMap's iD editor. You can also have topological editing in d3.

You can find many question about usage of d3, on this site itself. Here is a search result, which can get you started: https://gis.stackexchange.com/search?q=D3+is%3Aquestion

This is a good tutorial, to get started: http://bost.ocks.org/mike/map/


Problem 1

I am not aware of any JavaScript library that handles what you are looking for and if someone else does I would be interested to know. Being this also a topology problem it could be interesting to have a look at topojson, but that certainly would not solve your problem out of the box.

From my experience, one alternative solution I can suggest is to solve the problem on the server side with PostGIS. If you can not set it up on your own server you could rely on cartodb, it works really well and it has a JavaScript API for making queries to PostGIS tables (free up to a limited amount). How you would implement this in PostGIS, on top of my head I do not know, but certainly you would have more than one way to go for it. On the client-side with Leaflet you could use Leaflet.draw. In this way you could easily create-edit simple polygons with no topology, but you could then validate and save these in real time on the server with PostGIS and have them sent back again. That would be a quite neat JavaScript Web application. In general, from any point you take it, it's complex stuff.

Problem 2

Again, in my opinion, this is another complex problem. You could try looking in the topology features of GRASS, but if you have never used it, it is not the most intuitive piece of GIS software. Still, it's completely free and open source and QGIS has a slightly more friendly interface to it. You might even be able to do something with PostGIS, but not sure.

Again though, depending on how these polygons do not match up, you will might need to go and edit things by hand.

Hope this helps.

  • Thanks for the answer. I will inspect the software, that you recommended if I have enough time. It looks tricky, but interesting. Knowing the terminology sure helps in seaching. Never new, that this problem in the "topology" problem. Thanks that pointed that out. Topojson gives some hints to, will look if postGIS supports some format of that kind. – Taras Voinarovskyi Jun 25 '13 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.