GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
queries for multi-word cities, admin1codes in Mexico  XML
Forum Index -> General
Author Message
mwease



Joined: 16/04/2011 20:44:44
Messages: 3
Location: Texas
Offline

i'm trying to get coordinates for cities. i find that cities with more than 2
words in them are sometimes a problem. for US cities with only 2 words,
replacing the blank between the words with a plus sign (+) returns the
same as not replacing them (in the one test i made - i must have had problems with others because a while ago i decided to always replace blanks with '+', but it might be because of cities with 3+ words).

i am told to use utf8 encoding. however, for Boca del Mar, FL (3 words), i
get the following coordinates for using the city name in the specified ways:

Boca del Mar 8.58333, 37.08333
Boca+del+Mar 26.34508, -80.14671
Boca del Mar (using utf8 encoding) 8.58333, 37.08333
according to Wikipedia 26.34495, -80.14659

i believe those returned with blanks AND the utf8 encoding are wrong, if
only because neither the lattitude (first) nor the longitude are negative.
of course, since Wikipedia basically matches using the '+' query and both
the lat and long are MUCH closer to other cities in FL, i'm guessing that's
the correct one.

for Juarez City, Mexico, i get no results at all replacing the blank with '+',
contradicting what happens with the one US city with 2 words i tried, but i
get the correct coordinates with the blank and with utf8 encoding with
blank.

i'm very uncertain how i am to get coordinates for mexico. in addition
to the '+' working the opposite of US cities, the admincode1 code for mexico seems not to be used: i get correct results for Juarez City with
admin1code='09' (the federal district), when the city is actually in the state of Chihuahua (admincode1='06').

anybody know a guaranteed solution to ensure that i get coordinates and
that they are the correct ones? am i missing something?

Mike Wease
[Email] [WWW]
marc



Joined: 08/12/2005 07:39:47
Messages: 4501
Offline

Mike

You have to utf8 URL encode:

http://forum.geonames.org/gforum/posts/list/8.page

This is more than just utf8 encoding.

Best

Marc

[WWW]
mwease



Joined: 16/04/2011 20:44:44
Messages: 3
Location: Texas
Offline

didn't realized i need both. i did them on Juarez City, like this:

$city = rawurlencode(utf8_encode('Juarez City'));

$city was not found.

with no encoding, i get the correct results.

i'm using the Drupal interface. would that make a difference?

mike

Mike Wease
[Email] [WWW]
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.5 © JForum Team