I'm trying to edit my local database using JOSM. I'm already running the "Rails Port API" and pointing to it.

I imported a pbf file to my local database using the osm2pgsql without errors.

The connection is validated in the JOSM's Connection settings, and I already tried to use the basic authentication and OAuth authentication and the two are working without problems.

But, when I tried to download the data on the JOSM (using the Ctrl + Shift + Down option) appears the error "No data found in this area".

In my development.log of the API shows the JOSM's call:

Parameters:    {"bbox"=>"-48.9653778,-26.4644263,-48.8960266,-26.4481357"}

SELECT  "current_nodes".* FROM "current_nodes" WHERE (( tile BETWEEN 870717944 AND 870717951 OR tile BETWEEN 870718288 AND 870718303 OR tile BETWEEN 870718320 AND 870718335 OR tile BETWEEN 870718416 AND 870718425 OR tile BETWEEN 870718428 AND 870718429 OR tile BETWEEN 870718632 AND 870718636 OR tile BETWEEN 870718976 AND 870718980 OR tile BETWEEN 870718984 AND 870718988 OR tile BETWEEN 870719008 AND 870719012 OR tile BETWEEN 870719016 AND 870719020 OR tile BETWEEN 870719104 AND 870719108 OR tile BETWEEN 870719112 AND 870719113 OR tile IN (870718638,870718982,870718990,870719014,870719022,870719110,870719116) ) AND latitude BETWEEN -264644263.0 AND -264481357.00000003 AND longitude BETWEEN -489653778.0 AND -488960266.0) AND "current_nodes"."visible" = $1 LIMIT 50001  [["visible", "t"]]
Relation Load (22.2ms)  SELECT "current_relations".* FROM "current_relations" INNER JOIN "current_relation_members" ON "current_relation_members"."relation_id" = "current_relations"."id" WHERE "current_relation_members"."member_type" = 'Node' AND 1=0 AND "current_relations"."visible" = $1  [["visible", "t"]]
Relation Load (0.2ms)  SELECT "current_relations".* FROM "current_relations" INNER JOIN "current_relation_members" ON "current_relation_members"."relation_id" = "current_relations"."id" WHERE "current_relation_members"."member_type" = 'Way' AND 1=0 AND "current_relations"."visible" = $1  [["visible", "t"]]
Relation Load (0.2ms)  SELECT "current_relations".* FROM "current_relations" INNER JOIN "current_relation_members" ON "current_relation_members"."relation_id" = "current_relations"."id" WHERE "current_relation_members"."member_type" = 'Relation' AND 1=0 AND "current_relations"."visible" = $1  [["visible", "t"]]

But my current_nodes table is empty. Does anybody know how I can populate this table to edit in an editor?

I think that my question is related to this issue: http://github.com/openstreetmap/openstreetmap-website/issues/282


You're running osm2pgsql to populate a database, but I think that's the wrong thing to do in this situation. Long story short, I think you should be reading the CONFIGURE.md instructions

osm2pgsql is a tool for populating a PostGIS database. It's a powerful thing, letting you run Mapnik rendering software, Nominatim search software, or your own geospatial queries. But it's a totally different database table structure to that required by the openstreetmap-website rails app.

For the rails app database, you need a different approach. If you just want some test data in there, you might use JOSM to write to the database (it's a read & write API after all!). First you'll need to create a test user account on your local copy of the OpenStreetMap website, and then try drawing a little map and "uploading" from JOSM to your API.

But you had a PBF file you wanted to import. That can be done with Osmosis. Something like this

osmosis --read-pbf greater-london-latest.osm.pbf \ --write-apidb host="localhost" database="openstreetmap" \ user="openstreetmap" password="" validateSchemaVersion="no"

Although you might be left with a sequence issue

  • 3
    Extending on the good things Harry wrote: the osm2pgsql creates a PostGIS database, and requires PostGIS functions. The rails-port application doesn't, it just requires a custom relational database schema designed by the original OSM developers to store node and way information, which is not compliant or reliant on anything OGC. It is not an OGC Simple Features implementation.
    – Marco_B
    Nov 12 '15 at 11:48

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.