Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8828941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:43:15+00:00 2026-06-14T07:43:15+00:00

I’m working on a Google map to plot criminal activity in my local area.

  • 0

I’m working on a Google map to plot criminal activity in my local area. It works but now I want to filter on street name, date range, nature, etc using a form from the same page.

I followed the tutorial located here https://developers.google.com/academy/apis/maps/visualizing/earthquakes.

They’re using a jsonp feed as a data source.

script.src = 'http://earthquake.usgs.gov/earthquakes/feed/geojsonp/2.5/week'

I created a script called “process_request.php” to return criminal data from my area to coincide.

I’m lost on how to apply my filters/form criteria. So here are my questions … should I use AJAX to update the window.eqfeed_callback? Should the form action be “index.php” or “process_request.php”? Should I be using onsubmit="refreshMap();" in my form?

 <script>
      var map;

      function initialize() {
        var mapOptions = {
          zoom: 13,
          center: new google.maps.LatLng(37.749919,-68.869871),
          mapTypeId: google.maps.MapTypeId.TERRAIN
        };

        map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);

        // Create a <script> tag and set the USGS URL as the source.
        var script = document.createElement('script');
        // (In this example we use a locally stored copy instead.)
        // script.src = 'http://earthquake.usgs.gov/earthquakes/feed/geojsonp/2.5/week';
        script.src = 'https://example.com/crime/process_request.php';
        document.getElementsByTagName('head')[0].appendChild(script);
      }

      // Loop through the results array and place a marker for each
      // set of coordinates.
      window.eqfeed_callback = function(results) {

        var infowindow = new google.maps.InfoWindow();

        for (var i = 0; i < results.features.length; i++) {
            var coords = results.features[i].geometry.coordinates;
            var latLng = new google.maps.LatLng(coords[0],coords[1]);
            var weight_factor = results.features[i].properties.weight;

            var marker = new google.maps.Marker({
                position: latLng,
                map: map,
                icon: getCircle(weight_factor),
            });

            google.maps.event.addListener(marker,'click', (function(marker, i) {
                return function() {
                    infowindow.setContent('<strong>Address:</strong> ' + results.features[i].properties.address + "<br><strong>Total Reports:</strong> "+ results.features[i].properties.weight + "<br><strong>Nature:</strong> " + results.features[i].properties.nature);
                    infowindow.open(map, marker);
                }
            })(marker, i));

        }
      }

    function getCircle(weight_factor) {
        return {
            path: google.maps.SymbolPath.CIRCLE,
            fillColor: 'red',
            fillOpacity: .3,
            scale: weight_factor * 3, //Math.pow(2, magnitude) / Math.PI,
            strokeColor: 'white',
            strokeWeight: .8
        };
    }

   </script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T07:43:16+00:00Added an answer on June 14, 2026 at 7:43 am

    I ended up reworking most of the script and building the json from scratch (I don’t think I’ll be needing the jsonp functionality) and using a javascript function for the form action.

    <form name="filter_form" action="javascript:drawMap(getData())" method="POST">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to count how many characters a certain string has in PHP, but
I have a French site that I want to parse, but am running into
I want to construct a data frame in an Rcpp function, but when I
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I want to show the soap response to UIWebview.. my soap response is, <p><img
This could be a duplicate question, but I have no idea what search terms

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.