[OSM-dev] Distance Grid

2009-12-01 Thread Vitor George
Hi there,

I want to start a project in Brazil that is similar to the Tiger Fixup 250
Cities [1], and I looking forward to build a script that generates a
distance grid, like this:

http://matt.sandbox.cloudmade.com/usa-routes.html

I've tried to contact the authors via wiki, but I was unsuccessful, so I
want to develop it by myself. I'm not a professional programmer, but I have
some experience in java. Is the LibOSM the easiest way tool to implement it?

Thanks,
Vitor

[1] http://wiki.openstreetmap.org/wiki/TIGER_fixup/250_cities
___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] Distance Grid

2009-12-01 Thread Matt Amos
On Tue, Dec 1, 2009 at 4:04 PM, Vitor George vitor.geo...@gmail.com wrote:
 I want to start a project in Brazil that is similar to the Tiger Fixup 250
 Cities [1], and I looking forward to build a script that generates a
 distance grid, like this:

 http://matt.sandbox.cloudmade.com/usa-routes.html

 I've tried to contact the authors via wiki, but I was unsuccessful, so I
 want to develop it by myself. I'm not a professional programmer, but I have
 some experience in java. Is the LibOSM the easiest way tool to implement it?

sorry you missed us on the wiki. i have to say, i don't really check
the discussion pages like a good wikian should :-(

the script is very simple, and uses cloudmade's ruby API [1] to get
the routes. you'll need to sign up for a cloudmade API key, if you
haven't already. the script i've attached will output CSV on stdout,
but i usually put them in a database for easy access.

run it like ruby routes.rb conf file. i've attached an example
configuration file, which is just a yaml map of string to lat/lon
array.

i look forward to seeing brazil's 250 cities :-)

cheers,

matt

[1] http://developers.cloudmade.com/projects/show/ruby-lib


routes.rb
Description: application/ruby


usa_extract.yml
Description: Binary data
___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev


Re: [osmosis-dev] Two tag keys with different capitalisation

2009-12-01 Thread Anthony
On Tue, Dec 1, 2009 at 12:17 PM, Marcus Wolschon
marcus.wolsc...@googlemail.com wrote:
 How is that a problem for MySQL?
 h and H have different binary representations and are
 thus different keys, are they now?

By default MySQL treats all comparisons on varchars as case insensitive.

The alternative is to use varchar binary to treat comparisons as case
sensitive, but this has the side-effect of sorting based on binary
value.

___
osmosis-dev mailing list
osmosis-...@openstreetmap.org
http://lists.openstreetmap.org/listinfo/osmosis-dev


Re: [osmosis-dev] Two tag keys with different capitalisation

2009-12-01 Thread Anthony
On Tue, Dec 1, 2009 at 12:20 PM, Anthony o...@inbox.org wrote:
 On Tue, Dec 1, 2009 at 12:17 PM, Marcus Wolschon
 marcus.wolsc...@googlemail.com wrote:
 How is that a problem for MySQL?
 h and H have different binary representations and are
 thus different keys, are they now?

 By default MySQL treats all comparisons on varchars as case insensitive.

mysql create table blah ( `k` varchar(255) NOT NULL default '',
primary key (k));
Query OK, 0 rows affected (0.00 sec)

mysql insert into blah values ('hellO');
 Query OK, 1 row affected (0.00 sec)

mysql select * from blah where k='hello';
+---+
| k |
+---+
| hellO |
+---+
1 row in set (0.02 sec)

The exception would be if your default collation is binary (which
would have the same side-effect as to making your sorts bunch all the
capital letters together and all the lowercase letters together).

If you need to sort 'H' next to 'h', but don't want to treat 'H' as
equal to 'h', you need to use a database other than MySQL.

___
osmosis-dev mailing list
osmosis-...@openstreetmap.org
http://lists.openstreetmap.org/listinfo/osmosis-dev


Re: [OSM-dev] Distance Grid

2009-12-01 Thread Vitor George
Thank you very much, Matt!

I'll try it right now...

On Tue, Dec 1, 2009 at 11:06 AM, Matt Amos zerebub...@gmail.com wrote:

 On Tue, Dec 1, 2009 at 4:04 PM, Vitor George vitor.geo...@gmail.com
 wrote:
  I want to start a project in Brazil that is similar to the Tiger Fixup
 250
  Cities [1], and I looking forward to build a script that generates a
  distance grid, like this:
 
  http://matt.sandbox.cloudmade.com/usa-routes.html
 
  I've tried to contact the authors via wiki, but I was unsuccessful, so I
  want to develop it by myself. I'm not a professional programmer, but I
 have
  some experience in java. Is the LibOSM the easiest way tool to implement
 it?

 sorry you missed us on the wiki. i have to say, i don't really check
 the discussion pages like a good wikian should :-(

 the script is very simple, and uses cloudmade's ruby API [1] to get
 the routes. you'll need to sign up for a cloudmade API key, if you
 haven't already. the script i've attached will output CSV on stdout,
 but i usually put them in a database for easy access.

 run it like ruby routes.rb conf file. i've attached an example
 configuration file, which is just a yaml map of string to lat/lon
 array.

 i look forward to seeing brazil's 250 cities :-)

 cheers,

 matt

 [1] http://developers.cloudmade.com/projects/show/ruby-lib

___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] Distance Grid

2009-12-01 Thread Ævar Arnfjörð Bjarmason
On Tue, Dec 1, 2009 at 17:06, Matt Amos zerebub...@gmail.com wrote:
 On Tue, Dec 1, 2009 at 4:04 PM, Vitor George vitor.geo...@gmail.com wrote:
 I want to start a project in Brazil that is similar to the Tiger Fixup 250
 Cities [1], and I looking forward to build a script that generates a
 distance grid, like this:

 http://matt.sandbox.cloudmade.com/usa-routes.html

 I've tried to contact the authors via wiki, but I was unsuccessful, so I
 want to develop it by myself. I'm not a professional programmer, but I have
 some experience in java. Is the LibOSM the easiest way tool to implement it?

 sorry you missed us on the wiki. i have to say, i don't really check
 the discussion pages like a good wikian should :-(

 the script is very simple, and uses cloudmade's ruby API [1] to get
 the routes. you'll need to sign up for a cloudmade API key, if you
 haven't already. the script i've attached will output CSV on stdout,
 but i usually put them in a database for easy access.

 run it like ruby routes.rb conf file. i've attached an example
 configuration file, which is just a yaml map of string to lat/lon
 array.

 i look forward to seeing brazil's 250 cities :-)

I made a hacky script to generate .yml from XAPI output (attached):

wget 
'http://www.informationfreeway.org/api/0.6/node[place=city|town|village|hamlet][bbox=-25.74085,62.84553,-12.41708,67.50085]'
-O iceland-places.osm
perl -CI place2yaml.pl  place.osm   place.yml

But I just get internal server errors from the CM API:

$ ruby routes.rb place.yml
[Tue Dec 01 18:59:57 + 2009] HTTP error: Couldn't read data. HTTP
status: #Net::HTTPInternalServerError:0xb769348c, retrying...

Anyway do you have a script to generate that cute HTML matrix? And how
can I link to a route on CM's website. I have to supply lat/lon/zoom
it seems and not just starting/ending lat/lon (at least the URLs I've
seen are all like that).


place2yaml.pl
Description: Binary data
___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] Distance Grid

2009-12-01 Thread Vitor George
No, I don't have the script to generate the cute html... :)

By now, we will start with the capitals and some other important cities
(30-35 cities), but your script will be necessary in the future, when we
raise the number of the cities.

On Tue, Dec 1, 2009 at 1:03 PM, Ævar Arnfjörð Bjarmason ava...@gmail.comwrote:

 On Tue, Dec 1, 2009 at 17:06, Matt Amos zerebub...@gmail.com wrote:
  On Tue, Dec 1, 2009 at 4:04 PM, Vitor George vitor.geo...@gmail.com
 wrote:
  I want to start a project in Brazil that is similar to the Tiger Fixup
 250
  Cities [1], and I looking forward to build a script that generates a
  distance grid, like this:
 
  http://matt.sandbox.cloudmade.com/usa-routes.html
 
  I've tried to contact the authors via wiki, but I was unsuccessful, so I
  want to develop it by myself. I'm not a professional programmer, but I
 have
  some experience in java. Is the LibOSM the easiest way tool to implement
 it?
 
  sorry you missed us on the wiki. i have to say, i don't really check
  the discussion pages like a good wikian should :-(
 
  the script is very simple, and uses cloudmade's ruby API [1] to get
  the routes. you'll need to sign up for a cloudmade API key, if you
  haven't already. the script i've attached will output CSV on stdout,
  but i usually put them in a database for easy access.
 
  run it like ruby routes.rb conf file. i've attached an example
  configuration file, which is just a yaml map of string to lat/lon
  array.
 
  i look forward to seeing brazil's 250 cities :-)

 I made a hacky script to generate .yml from XAPI output (attached):

 wget '
 http://www.informationfreeway.org/api/0.6/node[place=city|town|village|hamlet][bbox=-25.74085,62.84553,-12.41708,67.50085]http://www.informationfreeway.org/api/0.6/node[place=city%7Ctown%7Cvillage%7Chamlet][bbox=-25.74085,62.84553,-12.41708,67.50085]
 '
 -O iceland-places.osm
 perl -CI place2yaml.pl  place.osm   place.yml

 But I just get internal server errors from the CM API:

 $ ruby routes.rb place.yml
 [Tue Dec 01 18:59:57 + 2009] HTTP error: Couldn't read data. HTTP
 status: #Net::HTTPInternalServerError:0xb769348c, retrying...

 Anyway do you have a script to generate that cute HTML matrix? And how
 can I link to a route on CM's website. I have to supply lat/lon/zoom
 it seems and not just starting/ending lat/lon (at least the URLs I've
 seen are all like that).

___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] Distance Grid

2009-12-01 Thread Matt Amos
On Tue, Dec 1, 2009 at 7:03 PM, Ævar Arnfjörð Bjarmason
ava...@gmail.com wrote:
 On Tue, Dec 1, 2009 at 17:06, Matt Amos zerebub...@gmail.com wrote:
 On Tue, Dec 1, 2009 at 4:04 PM, Vitor George vitor.geo...@gmail.com wrote:
 I want to start a project in Brazil that is similar to the Tiger Fixup 250
 Cities [1], and I looking forward to build a script that generates a
 distance grid, like this:

 http://matt.sandbox.cloudmade.com/usa-routes.html

 I've tried to contact the authors via wiki, but I was unsuccessful, so I
 want to develop it by myself. I'm not a professional programmer, but I have
 some experience in java. Is the LibOSM the easiest way tool to implement it?

 sorry you missed us on the wiki. i have to say, i don't really check
 the discussion pages like a good wikian should :-(

 the script is very simple, and uses cloudmade's ruby API [1] to get
 the routes. you'll need to sign up for a cloudmade API key, if you
 haven't already. the script i've attached will output CSV on stdout,
 but i usually put them in a database for easy access.

 run it like ruby routes.rb conf file. i've attached an example
 configuration file, which is just a yaml map of string to lat/lon
 array.

 i look forward to seeing brazil's 250 cities :-)

 I made a hacky script to generate .yml from XAPI output (attached):

 wget 
 'http://www.informationfreeway.org/api/0.6/node[place=city|town|village|hamlet][bbox=-25.74085,62.84553,-12.41708,67.50085]'
 -O iceland-places.osm
 perl -CI place2yaml.pl  place.osm   place.yml

 But I just get internal server errors from the CM API:

 $ ruby routes.rb place.yml
 [Tue Dec 01 18:59:57 + 2009] HTTP error: Couldn't read data. HTTP
 status: #Net::HTTPInternalServerError:0xb769348c, retrying...

interesting. if you could send me a trace of what's going on that
would be very helpful.

 Anyway do you have a script to generate that cute HTML matrix? And how
 can I link to a route on CM's website. I have to supply lat/lon/zoom
 it seems and not just starting/ending lat/lon (at least the URLs I've
 seen are all like that).

i've just thrown something together here - might be buggy, etc...
you'll need to play with the factor variable to see what looks right
for your area.

cheers,

matt


to_html.rb
Description: application/ruby
___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] Distance Grid

2009-12-01 Thread Ævar Arnfjörð Bjarmason
On Tue, Dec 1, 2009 at 20:27, Matt Amos zerebub...@gmail.com wrote:
 On Tue, Dec 1, 2009 at 7:03 PM, Ævar Arnfjörð Bjarmason
 ava...@gmail.com wrote:
 On Tue, Dec 1, 2009 at 17:06, Matt Amos zerebub...@gmail.com wrote:
 On Tue, Dec 1, 2009 at 4:04 PM, Vitor George vitor.geo...@gmail.com wrote:
 I want to start a project in Brazil that is similar to the Tiger Fixup 250
 Cities [1], and I looking forward to build a script that generates a
 distance grid, like this:

 http://matt.sandbox.cloudmade.com/usa-routes.html

 I've tried to contact the authors via wiki, but I was unsuccessful, so I
 want to develop it by myself. I'm not a professional programmer, but I have
 some experience in java. Is the LibOSM the easiest way tool to implement 
 it?

 sorry you missed us on the wiki. i have to say, i don't really check
 the discussion pages like a good wikian should :-(

 the script is very simple, and uses cloudmade's ruby API [1] to get
 the routes. you'll need to sign up for a cloudmade API key, if you
 haven't already. the script i've attached will output CSV on stdout,
 but i usually put them in a database for easy access.

 run it like ruby routes.rb conf file. i've attached an example
 configuration file, which is just a yaml map of string to lat/lon
 array.

 i look forward to seeing brazil's 250 cities :-)

 I made a hacky script to generate .yml from XAPI output (attached):

 wget 
 'http://www.informationfreeway.org/api/0.6/node[place=city|town|village|hamlet][bbox=-25.74085,62.84553,-12.41708,67.50085]'
 -O iceland-places.osm
 perl -CI place2yaml.pl  place.osm   place.yml

 But I just get internal server errors from the CM API:

 $ ruby routes.rb place.yml
 [Tue Dec 01 18:59:57 + 2009] HTTP error: Couldn't read data. HTTP
 status: #Net::HTTPInternalServerError:0xb769348c, retrying...

 interesting. if you could send me a trace of what's going on that
 would be very helpful.

Silly me, I was generating an invalid YAML file. still this could use
a better error message:

{{{
GET http://routes.cloudmade.com/MY_API_KEY/api/0.3/,,,/car.js?lang=enunits=km
HTTP/1.1
Accept: */*
Host: routes.cloudmade.com

075.101.134.058.00080-192.168.002.101.41914: HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Content-Length: 40
Date: Tue, 01 Dec 2009 20:28:09 GMT
Connection: close

Sorry, some unrecoverable error happened
}}}

 Anyway do you have a script to generate that cute HTML matrix? And how
 can I link to a route on CM's website. I have to supply lat/lon/zoom
 it seems and not just starting/ending lat/lon (at least the URLs I've
 seen are all like that).

 i've just thrown something together here - might be buggy, etc...
 you'll need to play with the factor variable to see what looks right
 for your area.

Sweet, I'll try it out.

___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] Distance Grid

2009-12-01 Thread Ævar Arnfjörð Bjarmason
On Tue, Dec 1, 2009 at 20:27, Matt Amos zerebub...@gmail.com wrote:
 i've just thrown something together here - might be buggy, etc...
 you'll need to play with the factor variable to see what looks right
 for your area.

I had to set it to 4.

Anyway here's the scripts I used (including yours, hacked):
http://git.nix.is/?p=avar/osm-place-matrix;a=summary

And here's the output: http://osm.is/tmp/road-dist.html

Thanks!

___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev


[OSM-dev] Code works on sandbox API, doesn't work on main API

2009-12-01 Thread Janos Rusiczki
I've posted this on the forum also (
http://forum.openstreetmap.org/viewtopic.php?id=5594 ) but figured I might
have better luck asking here.

---

Hello,

I wrote a small PHP script to import all the Romanian settlement boundaries
and it is working perfectly fine on api06.dev.openstreetmap.org. However
when I switched to api.openstreetmap.org I keep getting bad request errors.

Here's the code that creates a changeset.

$server = 'api.openstreetmap.org';

$put_file = fopen('tmp/tmpfile', 'w+');
fwrite($put_file, $create_changeset_data);
rewind($put_file);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://
'.$server.'/api/0.6/changeset/create');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_PUT, true);
curl_setopt($ch, CURLOPT_INFILE, $put_file);
curl_setopt($ch, CURLOPT_USERPWD, $user.':'.$password);
$changeset_id = curl_exec($ch);
curl_close($ch);
fclose($put_file);

In $create_changeset_data I have the following:

osm
changeset
tag k=created_by v=Romanian Settlement Boundaries v0.1/
tag k=comment v=Boundaries for Bicaz / Source: Mircea Angelescu
(cultura.ro)/
/changeset
/osm

The provided user / password combination works and I can write tmp/tmpfile.

The error I'm getting (including headers) is here:
http://pastebin.com/m40669009

As I said, if I change $server to api06.dev.openstreetmap.org it works fine.
I don't get it, isn't the sandbox supposed to be exactly the same as the
main API? What's the use of it if it's not? :(

Regards,
Janos
___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev