Searching X by Location: What Still Works and What Quietly Broke

8 min readSocialAPI Engineering

Searching X by Location: What Still Works and What Quietly Broke

Most people searching for this want something that barely exists any more.

The mental model is reasonable: posts have locations, so you should be able to ask for posts near a place. That worked well around 2012. Today the feature is technically alive and practically thin, and understanding why saves you from building on it.

★The short version: geotagging is opt-in, almost nobody opts in, and location search can only find what was tagged.★


Why location search returns so little

Attaching a location to a post has always been optional, and the share of users who do it has fallen for a decade. Precise geotagging was de-emphasised years ago, and the setting now defaults off.

The consequence is arithmetic: if a small fraction of posts carry coordinates, then a location query searches only that fraction. ⚠️ ★You are not seeing "posts from this city" — you are seeing "the small minority of posts from this city whose authors deliberately tagged them."★

Those two things differ enough to invalidate most conclusions drawn from the second while believing it was the first.

Everything below works on public data only — the same boundary our API operates inside.


The location operators that still function

X's search syntax accepts geographic operators, and they pass straight through:

Operator Meaning
near:"London" Posts tagged near a named place
within:10km Radius, used together with near:
geocode:51.5,-0.12,10km Latitude, longitude, radius
place:<place_id> A specific X place identifier
import requests

BASE = "https://api.socialapi.tech"
KEY  = "your_api_key"
HDRS = {"X-API-Key": KEY}

def near(term, place, radius="25km", limit=50):
    """Geotagged posts only — expect thin results, by design."""
    r = requests.get(f"{BASE}/v1/search/advanced",
                     params={"query": f'{term} near:"{place}" within:{radius}',
                             "limit": limit, "product": "Latest"},
                     headers=HDRS, timeout=60)
    r.raise_for_status()
    return r.json()["data"]

hits = near("power outage", "Manchester")
print(f"{len(hits)} geotagged results")

★Treat a small result count as the expected outcome, not a bug.★ (The query is just search syntax, so anything X supports, this supports.) If you get nothing back, the usual cause is that nobody geotagged anything — not that the query is malformed.


The location signal that actually works

Here is the part most articles on this topic miss: there is a reliable, well-populated location signal on the platform, and it is not geotagged posts.

★Trends are computed per region, and every post feeding them is included whether or not its author tagged a location.★

def local_trends(woeid):
    """Regional trends — location data that is actually dense."""
    r = requests.get(f"{BASE}/v1/trends/place",
                     params={"woeid": woeid}, headers=HDRS, timeout=60)
    r.raise_for_status()
    return r.json()["data"]["trends"]

def regions():
    """The full WOEID dictionary of available locations."""
    r = requests.get(f"{BASE}/v1/trends/locations", headers=HDRS, timeout=60)
    r.raise_for_status()
    return r.json()["data"]

for t in local_trends(44418)[:10]:          # 44418 = London
    print(f"  {t['name']}")

Why this is the better tool: trend membership is inferred from where users are, ★so it reflects a whole region rather than the tagging minority★. For "what is happening in this city right now", it answers the question that geotag search only appears to.

The region list covers hundreds of places — countries and major cities, each with a numeric WOEID you pass to the trends call.


Finding where an account is based

A different question that lands on the same search terms: not "posts from a place" but "where is this account from".

The profile carries a free-text location field, and that field is exactly as reliable as free text implies — people write real cities, jokes, fictional places, or leave it blank.

def stated_location(username):
    r = requests.get(f"{BASE}/v1/user/info",
                     params={"username": username}, headers=HDRS, timeout=60)
    r.raise_for_status()
    d = r.json()["data"]
    return d.get("location") or None      # ★self-reported, unvalidated★

⚠️ ★This is a claim, not a measurement.★ Nothing verifies it, and treating it as ground truth is the most common mistake in audience-location analysis. Use it as a weak signal across many accounts, never as a fact about one.


Questions people ask

How do I search Twitter by location? Use near:"City" with within:10km in your search query. Only geotagged posts match.

Why does location search return so few results? ★Because geotagging is opt-in and rarely used.★ The feature works; the data is thin.

Can I see tweets near me? Only ones explicitly tagged near you. Most local posts carry no location at all.

How do I find the location of a tweet? If the author tagged it, the post carries place data. Otherwise it does not exist.

Can I find someone's location from their tweets? Not reliably. ★Absence of geotags is the norm, and profile location is self-reported.★

How do I add a location to my tweets? It is a posting option in the app. We are read-only and cannot post or tag on your behalf.

How do I check an account's location? Read the profile location field, ★remembering it is unverified free text★.

Is the profile location accurate? Often not. People write jokes, regions, or nothing.

What is a WOEID? A numeric region identifier used by the trends endpoints. The locations call returns the full dictionary.

How do I get trends for a specific city? Pass that city's WOEID to the trends-by-place call.

How many locations have trends? Several hundred — countries plus major cities. Not every city has its own entry.

Are trends better than geotag search for local activity? ★Usually yes★, because trends include posts from users in a region regardless of tagging.

Can I search by coordinates? Yes, with geocode:lat,lon,radius. Same geotag limitation applies.

What radius should I use? Wider than feels right. A tight radius on already-sparse data returns nothing.

Does near: work with any city name? It works with places X recognises. Obscure names may not resolve.

Can I combine location with a date range? Yes — location operators compose with date filters.

Can I combine location with keywords? Yes, and you generally should. Location alone is too broad to be useful.

Why did geotagging decline? Privacy. Precise location sharing was de-emphasised and now defaults off.

Do most posts have coordinates? No — the tagged share is small enough that you should assume any given post lacks one.

Can I get historical posts by location? Only the tagged subset, and archive depth limits apply.

Is there an endpoint that returns everyone in a city? No. ★That would require location on every user, which does not exist.★

Can I monitor a location in real time? You can monitor keywords and read regional trends — how monitoring works.

How do I find local news accounts? Search profiles by city name in the bio. More effective than geotag search for this.

Does the location field affect what a user sees? Their trends are regionally influenced, but the profile text field itself is just text.

Can I filter search results by country? Not directly. Language filters and regional trends are the practical substitutes.

What are Twitter Lists, and can I search them? Lists are user-curated account collections. You can read a list's timeline, members, and subscribers by list ID — but there is no global list search.

How do I get posts from a list? Pass the list ID to the list timeline call. ★A list is often a better local feed than any location query, because a human curated it.★

Can I see which lists include an account? List membership is public, though discovery works by list, not by member.

Why is my location search empty? Almost always no geotagged matches. Widen the radius and drop rare keywords first.

Is location data ever precise? When tagged, it can be. But the sample is self-selected and small.

Can I map where a hashtag is being used? Only across geotagged posts, ★which makes the resulting map a map of taggers★ — hashtag measurement in full.


The short version

Location search works, and it will disappoint you if you expect coverage. Geotagging is opt-in, uptake is low, and ★a location query can only ever return the tagging minority★.

The signal that does work is regional trends, because membership is inferred rather than volunteered — it reflects a whole region instead of the few who tagged.

Our API passes location operators straight through to search, returns per-region trends by WOEID with the full region dictionary, and exposes list timelines by ID — so a local feed can be built from trends and curated lists rather than from sparse geotags. Read-only, flat price per call.

What no API can give you: the location of a post that was never tagged, or a verified location for an account. ★Both would require data the platform does not collect.★

Related reading: what regional trends actually measure · search operators in full · finding accounts by name or bio · monitoring a topic continuously.