The reason why it is functionally useless at this point is because the id/et_id is not being transferred through the process correctly. Perhaps an explanation of the process is in order:<br>The SQL stage is basically for reprojection and selecting a bounding box. If you already had both the government and the OSM roads converted into a Shapefile format, and they both had the same projection, and you were willing to work on the entire country at the same time, then you wouldn't even need SQL. You generally don't want to do the whole country at a time (trust me, it's not something you do in OpenJUMP), and you generally need to do some reprojection/format conversion, so we need SQL. What gets spit out of the SQL step is two files, OSM.shp and GOV.shp, and they each have geometry (where the roads are) and id numbers (internal numbers used by each).<br>
These two files get loaded into OpenJUMP Roadmatcher, where you find the matches, find the standalones, then output the result. This result file has a list of the id numbers for the roads that are standalone in the government database.<br>
Then (for Canada) geobase2osm.py will use the Roadmatcher result file as a mask to see which roads to copy from the government gml file over to an osm file. It does this by looking at the standalone id numbers, and then copying only the roads in the gml that have those ids.<br>
I kind of think of it like a transistor. A transistor takes some voltage input and connects it to the output, depending on whether the gate voltage is on or not. The input/output voltages can be large or small, but the gate voltage only needs to be tiny. The gate voltage itself doesn't get passed through to the output. Something like this:<br>
               gate<br>                 |<br>input -- transistor -- output<br><br>Equivalently, geobase2osm.py connects the Government.gml geometry to the Standalone.osm geometry, but only if the Standalone Result ID is on. The Result ID itself doesn't get passed through, it's only used as a gate mask. So we get something like:<br>
                                     Result ID#<br>                                           |<br>GovGeometry.gml -- geobase2osm.py -- StandaloneGeometry.osm<br><br>Since I haven't yet gotten the ID numbers to pass through, we can't use them as a mask for geobase2osm.py, rendering it useless. We can't generate osm files that have no duplicates with what's already on OSM.<br>
<br>Let's say you want to do things more manually. You could run the match process in Roadmatcher, then visually look and see what roads need to be copied over, then go over to JOSM and manually pick out those roads. This is silly, as you could do this faster by skipping Roadmatcher, and just matching by eye within JOSM.<br>
<br>Even if I do get ID numbers to transfer through, I don't know how portable geobase2osm.py will be to the Albanian data. What tools have other imports used? Maybe there's something else that uses a slightly different method?<br>
<br>Adam<br><br><div class="gmail_quote">On Thu, Mar 18, 2010 at 1:38 PM, <a href="mailto:jamesmikedupont@googlemail.com">jamesmikedupont@googlemail.com</a> <span dir="ltr"><<a href="mailto:jamesmikedupont@googlemail.com">jamesmikedupont@googlemail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><br>The roads shp files  are all the same,, that is true.<br><br><br><div class="gmail_quote">
<div><div></div><div class="h5">On Thu, Mar 18, 2010 at 9:19 PM, Adam Dunn <span dir="ltr"><<a href="mailto:dunnadam@gmail.com" target="_blank">dunnadam@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">So far, I've got the LL_Roads2 files imported in PostgreSQL, and I've written some functions to export them (modified from the NRN process on wiki), but it's not working properly. Using pgAdmin on Linux, I can see what data values there are, and their types:<br>



gid serial NOT NULL,<br>id numeric,<br>"type" character varying(50),<br>category smallint,<br>cat2 smallint,<br>shape_leng numeric,<br>"name" character varying(30),<br>shape_le_1 numeric,<br>et_id integer,<br>



the_geom geometry,<br><br>When I export this to shp and open in OpenJUMP, I can see that some of the values aren't getting exported properly. gid doesn't seem to be exported at all. id, type, shape_leng, shape_le_1, and the_geom all seem to be fine. Unfortunately, category, cat2, and et_id are all coming up with the value 0, even though they had other values in the original dataset. Name I can't test, since it seems to be null in the original data.<br>



Here's the function I'm using:<br><br><br>DROP TYPE albania_gov_data;<br>CREATE TYPE albania_gov_data AS (<br>  --Included all Albanian keys, since I don't know what they mean/which are important<br>    gid integer,<br>



    the_geom geometry,<br>    id numeric,<br>    way_type text,<br>    category smallint,<br>    cat2 smallint,<br>    shape_leng numeric,<br>    way_name text,<br>    shape_le_1 numeric,<br>    et_id integer<br><br>);<br>



CREATE OR REPLACE FUNCTION select_albania_gov_roadtile(coordinates text)<br>RETURNS SETOF albania_gov_data<br>AS $$<br>    SELECT gid,ST_Transform(the_geom,4326),id,"type", --might need 4191 rather than 4326<br>



                category,cat2,shape_leng,"name",shape_le_1,et_id FROM albania_roadseg<br>        WHERE<br>              ST_Intersects(ST_Transform(the_geom,4326),<br>                              ST_GeomFromEWKT($1))<br>



<br>       <br>$$<br>LANGUAGE SQL;<br><br>CREATE TYPE albania_osm_data AS (   <br>    way geometry,<br>    osm_id integer,<br>    name text<br>);<br><br>CREATE OR REPLACE FUNCTION select_albania_osm_roadtile(coordinates text)<br>



RETURNS SETOF albania_osm_data<br>AS $$<br>    SELECT ST_Transform(way,4326),osm_id,substr(name,0,80) --might need 4191 rather than 4326<br>                FROM planet_osm_line WHERE<br>        ST_Intersects(way,ST_GeomFromEWKT($1))        <br>



             AND ((highway is not null)<br>               OR (railway is not null)) --Albania appears to have railways in gov_data<br>$$<br>LANGUAGE SQL;<br><br><br>Anybody got any ideas?<br></blockquote></div></div><div>
But the shapes are working?<br>

 <br></div><div class="im"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>On the data itself:<br>What is the difference between all the files on the ftp? There is LL_Roads, LL_Roads2, LL_Roads_OSM, but a quick check in OpenJUMP, and they all look the same.<br>


</blockquote></div><div><br>no difference<br> <br></div><div class="im"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
For my test, I exported an area around Gjirokastra [<a href="http://www.openstreetmap.org/index.html?minlat=40&minlon=20&maxlat=40.2&maxlon=20.2&box=yes&layers=B000FTF" target="_blank">http://www.openstreetmap.org/index.html?minlat=40&minlon=20&maxlat=40.2&maxlon=20.2&box=yes&layers=B000FTF</a>]. In this area, the id tag was only partially useful: In downtown Gjirokastra (the densely roaded area that is not currently visible on OSM, but is approx bounded by [<a href="http://www.openstreetmap.org/browse/way/30455602" target="_blank">http://www.openstreetmap.org/browse/way/30455602</a>] and [<a href="http://www.openstreetmap.org/browse/way/36777258" target="_blank">http://www.openstreetmap.org/browse/way/36777258</a>]) the id tag seemed to be missing for roads. The id tag was only available in the outer (rural?) areas. Shape_leng was mostly 0.0, except for about 20 roads at the south end of Gjirokastra (out of 2479 roads), in which case it matched up with shape_le_1. This data also includes Footpath as a type, along with the other types I mentioned in my last email. A listing of all the different ways/types/categories in this data would be nice to have.<br>


</blockquote></div><div><br>I can tag them afterwards.<br>I have a tag tool as well to do a report.<br>the most important thing is to get rid of the duplicates<br><br> <br></div><div class="im"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">



<br>The data is missing a gml file. This is necessary to run the geobase2osm.py step. You could probably use ogr2ogr to do it, but you'd need proper id or et_id, whichever would work better as a unique identifier (probably not id, since it's not available in urban areas!).<br>


</blockquote></div><div><br>hmmm...  <br></div><div class="im"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>I did get both the OSM data and the (I assume) government data into openjump roadmatcher, so it would be possible to roadmatch with what I have, but not very useful.<br></blockquote></div><div><br>why not?<br>thank you for your efforts to you irc? come to <a href="http://irc.freenode.net" target="_blank">irc.freenode.net</a> #flossk or add me on skype : h4ck3rm1k3<br>


<br>thanks,<br>mike<br> </div><div><div></div><div class="h5"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><font color="#888888"><br>Adam</font><div>
<div></div><div>

<br><br>On Wed, Mar 17, 2010 at 2:47 PM, Adam Dunn <<a href="mailto:dunnadam@gmail.com" target="_blank">dunnadam@gmail.com</a>> wrote:<br>
><br>> Hi, I was kind of hoping someone more knowledgeable in GIS programming would've responded first for the following reasons: geobase2osm.py is an integral part of the whole roadmatching process for Canada, and it's a very Canadian-specific script (there are chunks of code that deal with naming of major trunks on a province-by-province basis using if-else programming).<br>



><br>> Also, I don't have much experience programming GIS stuff. For example, the Canadian way of doing this uses EPSG 3348 for projection [1]. I did some Google searching, and it looks like you would want to use EPSG 4191 for the Albania area (see [2]), but 2462 might also the one you want to use ([3], although it looks like you get weird projected bounds with it). I don't know why this reprojection is really even necessary. When you look at EPSG 3348 (the Canadian one), the projected bounds are really weird there as well, so maybe it has to be done just to match up with NRN. If the Albania dataset is already in Lat/Long and 4191 is in Lat/Long and OSM is in Lat/Long, maybe you don't need to reproject at all? Someone with more GIS knowledge should know.<br>



><br>> You'll also want a script to automatically convert various attributes in the shp file to tags that are used by OSM. For example, I opened up the Roads_OSM.shp file in OpenJUMP (just the way it is, no changes or reprojections or anything), and I see that one road has the following properties:<br>



> ID: 175879.0<br>> Type: Well-Kept Gravel Road<br>> Category: 2<br>> Cat2: 20<br>> Shape_Leng: 0.0<br>> Name:<br>> Shape_Le_1: 774.851<br>> ET_ID: 167693<br>><br>> Most of these you probably won't care about, but Type: Well-Kept Gravel Road should be converted to<br>



> surface=gravel;<br>> and highway=unclassified or residential or track=* depending on what the Category: 2 and Cat2: 20 mean.<br>><br>> Another road has Type: Dwelling Area Road, which would probably be highway=residential;<br>



><br>> I've also seen Type: Village Road, Type: Railway, Type: Seasonal Road, and Type: National Asphalted Road.<br>><br>> You can see where geobase2osm.py makes similar mappings for Canada, by looking at lines 63 to 77 in geobase2osm.py [4].<br>



><br>> None of the roads I sampled had names associated with them (even the national highway, the name was blank). You'll probably have to match up road names to the roads using one of the other data sets?<br>><br>



> I would like to help out more, but I'm afraid I don't have the experience. I could lend a hand in modifying the SQL tables and geobase2osm.py, but I would be of limited help there, and I haven't a clue how you would get road names imported. You'll want more expertise help in getting the proper toolchain.<br>



><br>> [1] <a href="http://spatialreference.org/ref/epsg/3348/" target="_blank">http://spatialreference.org/ref/epsg/3348/</a><br>> [2] <a href="http://spatialreference.org/ref/epsg/4191/" target="_blank">http://spatialreference.org/ref/epsg/4191/</a><br>



> [3] <a href="http://spatialreference.org/ref/epsg/2462/" target="_blank">http://spatialreference.org/ref/epsg/2462/</a><br>> [4] <a href="http://svn.openstreetmap.org/applications/utils/import/geobase2osm/geobase2osm.py" target="_blank">http://svn.openstreetmap.org/applications/utils/import/geobase2osm/geobase2osm.py</a><br>



><br>> Adam<br>><br>> On Wed, Mar 17, 2010 at 12:31 PM, Sam Vekemans <<a href="mailto:acrosscanadatrails@gmail.com" target="_blank">acrosscanadatrails@gmail.com</a>> wrote:<br>>><br>>> Hi Adam,<br>


>> James is looking to use RoadMatcher, i know its on the wiki, but that<br>
>> page needs to be fixed.<br>>> Would you be able to explain it?<br>>><br>>> Personally, i now favour tracing WMS, but for massive areas<br>>> RoadMatcher is the way to go :-)<br>>><br>



>> Also, Robert (Bob) Shand from PEI is currently Itching to also learn<br>>> how its done.<br>>><br>>> Cheers,<br>>> Sam<br>>><br>>> ---------- Forwarded message ----------<br>>> From: Michael Barabanov <<a href="mailto:michael.barabanov@gmail.com" target="_blank">michael.barabanov@gmail.com</a>><br>



>> Date: Wed, 17 Mar 2010 12:13:39 -0700<br>>> Subject: Re: [Talk-ca] call for help, importing roads<br>>> To: "<a href="mailto:jamesmikedupont@googlemail.com" target="_blank">jamesmikedupont@googlemail.com</a>" <<a href="mailto:jamesmikedupont@googlemail.com" target="_blank">jamesmikedupont@googlemail.com</a>><br>



>> Cc: <a href="mailto:talk-ca@openstreetmap.org" target="_blank">talk-ca@openstreetmap.org</a><br>>><br>>> Sounds like you just need to convert SHP to OSM. Then you can upload from<br>>> JOSM. There's a script here (though I haven't tried it):<br>



>> <a href="http://redmine.yellowbkpk.com/projects/list_files/geo" target="_blank">http://redmine.yellowbkpk.com/projects/list_files/geo</a><br>>><br>>> On Mon, Mar 15, 2010 at 12:48 PM, <a href="mailto:jamesmikedupont@googlemail.com" target="_blank">jamesmikedupont@googlemail.com</a> <<br>



>> <a href="mailto:jamesmikedupont@googlemail.com" target="_blank">jamesmikedupont@googlemail.com</a>> wrote:<br>>><br>>> > Hi,<br>>> > I have been talking to Sam V. who mentioned that you guys are experts in<br>



>> > openjump for road importing.<br>>> > before I dig too deep into this myself, let me ask if anyone can help me<br>>> > with my current problem:<br>>> ><br>>> > I have these files from a public domain source, projected into Lat/Lon<br>



>> ><br>>> > <a href="http://xhema.flossk.org:8080/mapdata/03/MapAction/tpginc/" target="_blank">http://xhema.flossk.org:8080/mapdata/03/MapAction/tpginc/</a><br>>> ><br>>> > [image: [ ]] LL_Roads_OSM.dbf<<a href="http://xhema.flossk.org:8080/mapdata/03/MapAction/tpginc/LL_Roads_OSM.dbf" target="_blank">http://xhema.flossk.org:8080/mapdata/03/MapAction/tpginc/LL_Roads_OSM.dbf</a>>05-Mar-2010<br>



>> > 07:48 53M  [image: [ ]]LL_Roads_OSM.prj<<a href="http://xhema.flossk.org:8080/mapdata/03/MapAction/tpginc/LL_Roads_OSM.prj" target="_blank">http://xhema.flossk.org:8080/mapdata/03/MapAction/tpginc/LL_Roads_OSM.prj</a>>05-Mar-2010 07:48 143<br>



>> >   [image: [ ]]LL_Roads_OSM.shp<<a href="http://xhema.flossk.org:8080/mapdata/03/MapAction/tpginc/LL_Roads_OSM.shp" target="_blank">http://xhema.flossk.org:8080/mapdata/03/MapAction/tpginc/LL_Roads_OSM.shp</a>>05-Mar-2010 07:48<br>



>> > 35M  [image: [ ]]LL_Roads_OSM.shx<<a href="http://xhema.flossk.org:8080/mapdata/03/MapAction/tpginc/LL_Roads_OSM.shx" target="_blank">http://xhema.flossk.org:8080/mapdata/03/MapAction/tpginc/LL_Roads_OSM.shx</a>>05-Mar-2010 07:48<br>



>> > 1.5M<br>>> > They are from <a href="http://tpginc.net/gis/albania/albania.php" target="_blank">http://tpginc.net/gis/albania/albania.php</a><br>>> ><br>>> > we would like to find the new roads that are not in OSM and import them.<br>



>> > Can anyone help? can you tell me exactly what software to install, I am a<br>>> > bit confused my the many pages and broken links I found for jump.<br>>> ><br>>> > thanks,<br>>> > mike<br>



>> ><br>>> > _______________________________________________<br>>> > Talk-ca mailing list<br>>> > <a href="mailto:Talk-ca@openstreetmap.org" target="_blank">Talk-ca@openstreetmap.org</a><br>


>> > <a href="http://lists.openstreetmap.org/listinfo/talk-ca" target="_blank">http://lists.openstreetmap.org/listinfo/talk-ca</a><br>
>> ><br>>> ><br>>><br>>><br>>><br>>> --<br>>> Twitter: @Acrosscanada<br>>> Blog:  <a href="http://Acrosscanadatrails.blogspot.com" target="_blank">http://Acrosscanadatrails.blogspot.com</a><br>



>> Facebook: <a href="http://www.facebook.com/sam.vekemans" target="_blank">http://www.facebook.com/sam.vekemans</a><br>>> Skype: samvekemans<br>>> OpenStreetMap IRC: <a href="http://irc.openstreetmap.org" target="_blank">http://irc.openstreetmap.org</a><br>



>> @Acrosscanadatrails<br>><br><br>
</div></div></blockquote></div></div></div><br>
</blockquote></div><br>