JSOUP parse iframe Google Maps

I am trying to parse the latitude and longitude from the Google Maps map on this website http://hdh.ucsd.edu/mobile/dining/locationmap.aspx?l=39 but I am unable to fetch anything. How would I be able to get the latitude and longitude? Or what query would be able to accomplish this?

Document document = Jsoup.connect(url).get();
Elements elements = document.select("div.place-name");
String LOCATION = elements.text();


You can read the coordinates from the src attribute of the iframe tag. That URL contains the q parameter that will give you the coordinates separated by comma.

package com.github.davidepastore.stackoverflow34038430;

import java.io.IOException;
import java.net.URL;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

 * Stackoverflow 34038430 question.
public class App {

    public static void main(String[] args) throws IOException {
        String url = "http://hdh.ucsd.edu/mobile/dining/locationmap.aspx?l=39";
        Document document = Jsoup.connect(url).get();
        String src = document.select("iframe").first().attr("src");
        URL srcUrl = new URL(src);
        String result = getParamValue(srcUrl.getQuery());
        String[] coordinates = result.split(",");
        Double latitude = Double.parseDouble(coordinates[0]);
        Double longitude = Double.parseDouble(coordinates[1]);
        System.out.println("Latitude: " + latitude);
        System.out.println("Longitude: " + longitude);

     * Get the param value.
     * @param query The query string.
     * @return Returns the parameter value.
    public static String getParamValue(String query) {
        String[] params = query.split("&");
        for (String param : params) {
            String name = param.split("=")[0];
                return param.split("=")[1];
        return null;


This url that you provided does not have div.place-name because it is in iframe if you inspect it with firebug.

It is harder to get coordinates because this URL must be used in iframe.

Iframe tag has src tag that has coordinates. If those are cooridnates q=32.881093211,-117.2406307 you can get the iframe with JSOUP and extract these two numbers with custom regex.

Need Your Help

ActiveX controls with old Delphi versions

delphi activex

I'm testing a non visual ActiveX control based on a registered .ocx