Getting Near by cities

119 views
Skip to first unread message

prame...@gmail.com

unread,
Mar 19, 2009, 3:18:34 AM3/19/09
to geoPlugin
Hello,

Can we get the near by cities with the city name instead of latitude
and longitude.

or can we get latitude and longitude with the given city name so that
we can get near by cities with latitude and longitude

i.e
http://www.geoplugin.net/extras/nearby.gp?city=ccc&output=ZZZ

instead of

http://www.geoplugin.net/extras/nearby.gp?lat=XXX&long=YYY&output=ZZZ

Thanks,
Prameela.

geoPlugin Support

unread,
Mar 19, 2009, 4:14:38 AM3/19/09
to geop...@googlegroups.com
Hi Pameela,

It's not possible to get nearby cities by city name as this is far too
vague a search term - latitude/longitude values are unique in a
geospatial database, whereas city names occur many many times (this is
a worldwide database).

As to your second point, where do you want to have the lat/long
returned with a city name? Nearby paces will only return nearby
places, not the actual place itself for a given lat/long.
If you want to know what is the populated place for a given latitude/
longitude, you need to use the "Lat/Long to Place" service:
http://www.geoplugin.com/webservices/extras#latitudelongitude_to_place

If you could give me a more detailed example of what you're trying to
do maybe I can come up with a better way to approach the problem

Thanks
Andy

prame...@gmail.com

unread,
Mar 19, 2009, 5:21:44 AM3/19/09
to geoPlugin
Hello Andy,

First of all thanks for your quick response.
Actually my requirement is to show the events of near by cities just
by entering the city name.

i.e city name is available from the user.with that city name am tying
to get near by 10 cities and show all events with those cities.

But the service available with geoplugin is to get near by cities with
latitude and longitude.

I wanted to use this web service as it gives nearby cities in XML
format.

If i can get the latitude and longitude with the city name then i can
get the near by cities.

or if u have any suggestions please do post.I have been searching for
this feature from 2 weeks.

Thanks,
Prameela.

On Mar 19, 1:14 pm, geoPlugin Support <gp_supp...@geoplugin.com>
wrote:
> Hi Pameela,
>
> It's not possible to get nearby cities by city name as this is far too  
> vague a search term - latitude/longitude values are unique in a  
> geospatial database, whereas city names occur many many times (this is  
> a worldwide database).
>
> As to your second point, where do you want to have the lat/long  
> returned with a city name? Nearby paces will only return nearby  
> places, not the actual place itself for a given lat/long.
> If you want to know what is the populated place for a given latitude/
> longitude, you need to use the "Lat/Long to Place" service:http://www.geoplugin.com/webservices/extras#latitudelongitude_to_place
>
> If you could give me a more detailed example of what you're trying to  
> do maybe I can come up with a better way to approach the problem
>
> Thanks
> Andy
>

geoPlugin Support

unread,
Mar 19, 2009, 8:12:55 AM3/19/09
to geop...@googlegroups.com
Ah, OK I see your problem.

I've created something that may suite you:

http://www.geoplugin.net/extras/place_lookup.gp?place=paris&country=FR&format=xml

Will pull the location of Paris, France.

However, because of the abundance of place name replications in a
country, the output can be multiple - for example

http://www.geoplugin.net/extras/place_lookup.gp?place=paris&country=US&format=xml

Will give the locations of all the places called Paris in the United
States.

It will be up to you to sort out which is the relevant place name to
use (ie you can sort the xml on region perhaps?). You can then obtain
the lat/lon values to put into a nearby places search as normal

Note:
1.
The country must be a valid 2-Letter ISO 3166 country code:
see http://www.iso.org/iso/english_country_names_and_code_elements
for valid codes

2.
And, the place name MUST be ascii text - no accents etc. The field
being searched on is an ascii field, not UTF-8.

3.
As usual, &format= can be xml, php, or json (default php)

Hope this helps you
Andy

prame...@gmail.com

unread,
Mar 23, 2009, 2:36:41 AM3/23/09
to geoPlugin
Hello Andy,

i thought i can complete it with your help.

but when started doing i got the problem.

http://www.geoplugin.net/extras/nearby.gp?lat=35.2920325&amp;long=-93.7299173&amp;format=xml;

is not giving the correct values and also not in xml format.

The latitude and longitude provided in the above url are from the
below service.

http://www.geoplugin.net/extras/place_lookup.gp?place=paris&country=US&format=xml.

For any lat & long values i am getting my location addresses.

Could you please check it once. and also not in the format i expected.

Thanks,
Prameela.

On Mar 19, 5:12 pm, geoPlugin Support <gp_supp...@geoplugin.com>
wrote:
> Ah, OK I see your problem.
>
> I've created something that may suite you:
>
> http://www.geoplugin.net/extras/place_lookup.gp?place=paris&country=F...
>
> Will pull the location of Paris, France.
>
> However, because of the abundance of place name replications in a  
> country, the output can be multiple - for example
>
> http://www.geoplugin.net/extras/place_lookup.gp?place=paris&country=U...
>
> Will give the locations of all the places called Paris in the United  
> States.
>
> It will be up to you to sort out which is the relevant place name to  
> use (ie you can sort the xml on region perhaps?). You can then obtain  
> the lat/lon values to put into a nearby places search as normal
>
> Note:
> 1.
> The country must be a valid 2-Letter ISO 3166 country code:
> seehttp://www.iso.org/iso/english_country_names_and_code_elements
> for valid codes
>
> 2.
> And, the place name MUST be ascii text - no accents etc. The field  
> being searched on is an ascii field, not UTF-8.
>
> 3.
> As usual, &format= can be xml, php, or json (default php)
>
> Hope this helps you
> Andy
>

geoPlugin Support

unread,
Mar 23, 2009, 2:51:02 AM3/23/09
to geop...@googlegroups.com
Hi Pamela,

The reason that you are getting your location and that it is not in
XML format is because the url is not properly formed.
&amp; is HTML code for " & " and is not a valid url character, and you
have a semicolon (;) at the end of your url.

You can use &amp; in your HTML links that will get translated to &
when clicked, but not in the URL bar

So, in your example:

http://www.geoplugin.net/extras/nearby.gp?lat=35.2920325&long=-93.7299173&format=xml

will work fine

Thanks

-----
geoPlugin Support

geoPlugin - geolocation made simple
http://www.geoplugin.com/

prame...@gmail.com

unread,
Mar 25, 2009, 5:14:11 AM3/25/09
to geoPlugin
Hi Andy,

It works fine.Thank you very much.
With your help i have completed my task.
Really this site is very good.It will be very useful for us in future.

Prameela.

On Mar 23, 11:51 am, geoPlugin Support <gp_supp...@geoplugin.com>
wrote:
> Hi Pamela,
>
> The reason that you are getting your location and that it is not in  
> XML format is because the url is not properly formed.
> &amp; is HTML code for " & " and is not a valid url character, and you  
> have a semicolon (;) at the end of your url.
>
> You can use &amp; in your HTML links that will get translated to &  
> when clicked, but not in the URL bar
>
> So, in your example:
>
> http://www.geoplugin.net/extras/nearby.gp?lat=35.2920325&long=-93.729...
>
> will work fine
>
> Thanks
>
> -----
> geoPlugin Support
>
> geoPlugin - geolocation made simplehttp://www.geoplugin.com/
>
> On Mar 23, 2009, at 7:36 AM, prameela...@gmail.com wrote:
>
>
>
> > Hello Andy,
>
> > i thought i can complete it with your help.
>
> > but when started doing i got the problem.
>
> >http://www.geoplugin.net/extras/nearby.gp?lat=35.2920325&long=-93...
> > ;
>
> > is not giving the correct values and also not in xml format.
>
> > The latitude and longitude provided in the above url are from the
> > below service.
>
> >http://www.geoplugin.net/extras/place_lookup.gp?place=paris&country=U...

geoPlugin Support

unread,
Mar 25, 2009, 5:40:15 AM3/25/09
to geop...@googlegroups.com
That's great Prameela!

Sorry though for contiguously spelling your name wrong!
Andy

prame...@gmail.com

unread,
Mar 25, 2009, 9:12:21 AM3/25/09
to geoPlugin
Hello Andy,

One more doubt;
the following URL works fine.

http://www.geoplugin.net/extras/nearby.gp?lat=39.6852874&long=-93.9268836&limit=100&radius=100&format=xml

but for >100miles ,cities are not displayed as expected.It is showing
the cities with nearby 10 miles.
http://www.geoplugin.net/extras/nearby.gp?lat=39.6852874&long=-93.9268836&limit=100&radius=101&format=xml

Is there any limit for the attributes "limit and radius"?

Prameela.

On Mar 25, 2:40 pm, geoPlugin Support <gp_supp...@geoplugin.com>
wrote:
> That's great Prameela!
>
> Sorry though for contiguously spelling your name wrong!
> Andy
>

geoPlugin Support

unread,
Mar 25, 2009, 9:29:20 AM3/25/09
to geop...@googlegroups.com
Yes, exactly. The maximum radius possible is 100 miles. >100miles
defaults back to the default 10 mile radius. This is for a couple of
reasons:
1) Protect mysql load - with a geospatial database of several million
entries, the math processing to retrieve each entry within a 100 mile
radius is very processor intensive. >100 miles is even more so, so a
decision was made to limit radius o 100 miles
2) Allowing unlimited radius would allow theft of our database. Even
with 100 miles, it is still possible to steal the entire database
through repetitive queries, but at least this makes it slightly more
difficult, especially combined with the abuse filter that monitors
each *.gp lookup on the geoplugin.net server.

Cheers
Andy

prame...@gmail.com

unread,
Apr 23, 2009, 8:15:48 AM4/23/09
to geoPlugin
Hello Andy,

I am not able to get regions >50 miles

Check the following URLS.

For radius>100
http://www.geoplugin.net/extras/nearby.gp?long=-93.9268836&lat=39.6852874&radius=100&format=xml&limit=100


For radius>50
http://www.geoplugin.net/extras/nearby.gp?long=-93.9268836&lat=39.6852874&radius=50&format=xml&limit=100

For both the above urls iam getting the same data.
Is there any mistake in the url?
i think I was able to get cities with >50 miles but suddenly i am
getting same values.
Is there any change in the web service?

Thanks ,
Prameela.

On Mar 25, 6:29 pm, geoPlugin Support <gp_supp...@geoplugin.com>
wrote:
> Yes, exactly. The maximum radius possible is 100 miles. >100miles  
> defaults back to the default 10 mile radius. This is for a couple of  
> reasons:
> 1) Protect mysql load - with a geospatial database of several million  
> entries, the math processing to retrieve each entry within a 100 mile  
> radius is very processor intensive. >100 miles is even more so, so a  
> decision was made to limit radius o 100 miles
> 2) Allowing unlimited radius would allow theft of our database. Even  
> with 100 miles, it is still possible to steal the entire database  
> through repetitive queries, but at least this makes it slightly more  
> difficult, especially combined with the abuse filter that monitors  
> each *.gp lookup on the geoplugin.net server.
>
> Cheers
> Andy
>
> On Mar 25, 2009, at 2:12 PM, prameela...@gmail.com wrote:
>
>
>
> > Hello Andy,
>
> >          One more doubt;
> > the following URL works fine.
>
> >http://www.geoplugin.net/extras/nearby.gp?lat=39.6852874&long=-93.926...
>
> > but for >100miles ,cities are not displayed as expected.It is showing
> > the cities with nearby 10 miles.
> >http://www.geoplugin.net/extras/nearby.gp?lat=39.6852874&long=-93.926...
Reply all
Reply to author
Forward
0 new messages