Opened 13 years ago
Closed 12 years ago
#7515 closed enhancement (fixed)
Convert to JTS geometries
Reported by: | joshdoe | Owned by: | joshdoe |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Plugin conflation | Version: | |
Keywords: | github | Cc: |
Description
For the conflation plugin, I'd like to take advantage of all the functions provided by the Java Topology Suite (JTS) and the Java Conflation Suite (JCS). So the first thing is to convert OsmPrimitive
s to JTS geometries. I've got a first take, which I've attached; I would appreciate comments, especially since I think these routines could be used by other plugins. Most notably I'm not doing anything with relations yet.
Also, JTS itself doesn't care about attributes of features, just geometry, so for JCS they use some classes from JUMP. The OsmFeature
is a simple subclass of the JUMP Feature
class, which simply makes a copy of the geometry and attributes. This could be a lot smarter, such as updating directly from the OsmPrimitive
itself, however the JUMP classes assume a fixed attribute schema, so I'm not sure how I'd handle this.
Attachments (2)
Change History (16)
by , 13 years ago
Attachment: | JTSConversion.java added |
---|
follow-up: 2 comment:1 by , 13 years ago
I'm thinking of creating a jts
plugin, which simply includes the JTS library and helper functions for converting between JOSM primitives and JTS geometry. From what I can tell, at least ImportImage and OpenData depend on JTS, and Conflation will depend on it soon. Instead of including the JAR, these plugins can just depend on this JTS plugin.
comment:2 by , 13 years ago
Replying to joshdoe:
I'm thinking of creating a
jts
plugin, which simply includes the JTS library and helper functions for converting between JOSM primitives and JTS geometry. From what I can tell, at least ImportImage and OpenData depend on JTS, and Conflation will depend on it soon. Instead of including the JAR, these plugins can just depend on this JTS plugin.
It could be useful, for both developers and users :)
comment:3 by , 13 years ago
I've added a JTS plugin in [o28162]. I still need to write conversion to MultiPolygons, and conversion back to JOSM objects from JTS geometry.
follow-up: 5 comment:4 by , 13 years ago
Thanks :) Could you publish the plugin jar ? I'd like to use it in opendata plugin :)
follow-ups: 6 8 comment:5 by , 13 years ago
Replying to Don-vip:
Thanks :) Could you publish the plugin jar ? I'd like to use it in opendata plugin :)
Just added. I moved the code to a GitHub repository, but will push the JARs to the OSM SVN.
follow-up: 7 comment:6 by , 13 years ago
Replying to joshdoe:
Replying to Don-vip:
Thanks :) Could you publish the plugin jar ? I'd like to use it in opendata plugin :)
Just added. I moved the code to a GitHub repository, but will push the JARs to the OSM SVN.
We don't want external plugins to publish their binaries in svn. Please use a system similar to https://github.com/Gubaer/josm-scripting-plugin and publish the jar files somewhere else, e.g. on github.
comment:7 by , 13 years ago
Replying to bastiK:
We don't want external plugins to publish their binaries in svn. Please use a system similar to https://github.com/Gubaer/josm-scripting-plugin and publish the jar files somewhere else, e.g. on github.
Sure thing, I'll switch it over tonight. Feel free to delete the JAR files in the meantime if you wish.
follow-up: 9 comment:8 by , 13 years ago
Replying to joshdoe:
I moved the code to a GitHub repository
Why did you do that ? It was easier for me to use it in opendata if located in OSM SVN :( How can I refer to it now ?
follow-ups: 10 11 comment:9 by , 13 years ago
Replying to Don-vip:
Replying to joshdoe:
I moved the code to a GitHub repository
Why did you do that ? It was easier for me to use it in opendata if located in OSM SVN :( How can I refer to it now ?
Because I believe Git is far superior to SVN, and I try to minimize my interaction with SVN (and other non-DVCS's) as much as possible. I'm setting up a simple project (josm-all.git?) which will pull down all existing code in SVN and all known git plugins (into ext-plugins
), with convenience tasks to update both SVN and git code. In the meantime you can just run git clone https://joshdoe@github.com/joshdoe/josm-jts-plugin.git
in the ext-plugins
directory (place this adjacent to the existing plugins
directory). I just added the JAR to the plugin page so it should be available again.
comment:10 by , 13 years ago
Replying to joshdoe:
Because I believe Git is far superior to SVN...
I never used Git because I don't see the point of using another new system when SVN satisfies plenty my needs and is used both by JOSM and OSM. I tried to make an external link to jts.jar in [o28202] but this does not seem to work :( Is there a simple way to do this ? (simple = allow people to checkout my Java project from SVN without having to manually enter the command line you gave me for each git-hosted plugin I would use ?)
follow-up: 12 comment:11 by , 13 years ago
Replying to joshdoe:
Because I believe Git is far superior to SVN, ...
For the given purpose, any revision control software would do the job. One plugin is typically just a view hundred commits from a dozen committers - even CVS or tar-balls would work for such a small scale project.
The significant differences are not technical, but social. The main JOSM contributors cannot maintain your plugin because we have no write access to your repository. JOSM does not have a stable plugin API. Fundamental classes are refactored quite often but all the SVN-plugins that break in the process are fixed by the team. In addition, you have to care for translations yourself and have to manage history handling for older JOSM versions. Having dependencies like with Don-vips opendata plugin gets significantly more complicated and there are various way how it can break.
Well, do what you like, it's your code. :)
comment:12 by , 13 years ago
Replying to bastiK:
Replying to joshdoe:
Because I believe Git is far superior to SVN, ...
For the given purpose, any revision control software would do the job. One plugin is typically just a view hundred commits from a dozen committers - even CVS or tar-balls would work for such a small scale project.
The significant differences are not technical, but social.
It seems to me that you likely haven't used Git (or any other DVCS) to a significant extent. I use Git for all my projects at work, many of which have just myself as the only committer, so the benefits are not just for large complicated projects with many committers. Biggest benefits to me are lightweight branches, the stash, the speed, and offline committing. And yes, GitHub/Gitorious/etc. are a big plus for some projects.
The main JOSM contributors cannot maintain your plugin because we have no write access to your repository. JOSM does not have a stable plugin API. Fundamental classes are refactored quite often but all the SVN-plugins that break in the process are fixed by the team. In addition, you have to care for translations yourself and have to manage history handling for older JOSM versions. Having dependencies like with Don-vips opendata plugin gets significantly more complicated and there are various way how it can break.
Point taken regarding plugins that become dependencies of other plugins. I think it's best then to move jts back to SVN, by reverting the changeset in which I deleted it. For other plugins we (at least Git users) should think about a Git repo on git.osm.org.
I should have addressed this sooner but life has gotten crazy for me lately. Sorry for the inconvenience.
comment:13 by , 12 years ago
Keywords: | github added |
---|
comment:14 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
converting to JTS geometries