logo
down
shadow

User to location mapping with country state and city in the same table


User to location mapping with country state and city in the same table

By : user2949604
Date : November 17 2020, 01:00 AM
will help you What worked best for us was to have a country table (totally separate table, which can store other country related information, a state table (ditto), and then the city table with ID's to the other tables.
code :
CREATE TABLE Country (CountryID int, Name varchar(50))
CERATE TABLE State (StateID int, CountryID int, Name varchar(50))
CREATE TABLE City (CityID int, StateID int, Name varchar(50))


Share : facebook icon twitter icon
How to find user's country, state(region/county/province) and city in MVC application depending upon location from where

How to find user's country, state(region/county/province) and city in MVC application depending upon location from where


By : TalOs
Date : March 29 2020, 07:55 AM
help you fix your problem There are several ways. One is to ask the user to share his location with the remote server.
https://developer.mozilla.org/en-US/docs/WebAPI/Using_geolocation
How to get the location type or how to identify if a given location it's a city, a state , a country after a location lo

How to get the location type or how to identify if a given location it's a city, a state , a country after a location lo


By : Vitor Arjol
Date : March 29 2020, 07:55 AM
will help you The types are available on the Google Places API /Autocomplete response on the "types" array:
Country = "types" : [ "country", "political", "geocode" ]
code :
    {
                  "description" : "Italy", "id" : "25e96cea79a01f7308e93c44a0df106bb0f95e3f", 
                  "matched_substrings" : [ { "length" : 2, "offset" : 0 } ],
                  "place_id" : "ChIJA9KNRIL-1BIRb15jJFz1LOI",
                  "reference" : "CiQdAAAA70Hqa7YV7SeclW_Lfg1TB2s1o5aAk9j9iRn79CODJI4SEFgu3rYiXss6oQY1PKBniy8aFN5525fCHdYaSHfFcuK1jmf4tGiv",
                  "terms" : [ { "offset" : 0, "value" : "Italy" } ],
                  "types" : [ "country", "political", "geocode" ] 
                }
{ "description" : "Itingen, Switzerland", "id" : "d3caa11828d35eb13c066fa987a5859cf4dc8219", "matched_substrings" : [ { "length" : 2, "offset" : 0 } ], "place_id" : "ChIJo5eKUs7KkUcRdgR0wD1DONE", "reference" : "CjQsAAAAur4OIssVGpNZ68mQn4zwvkFWl2vqGEdJYpO1BVc9aUU8XtJ7uQyen-tPXaDGxf-3EhANsxjvPxzsAAGVyBzP0LPeGhREmHdg7PVMtfsodwFN0KO4z6hqDA", "terms" : [ { "offset" : 0, "value" : "Itingen" }, { "offset" : 9, "value" : "Switzerland" } ], "types" : [ "locality", "political", "geocode" ] }
How to get parameters like country,city,state and area information when user share their location...?

How to get parameters like country,city,state and area information when user share their location...?


By : user2979027
Date : March 29 2020, 07:55 AM
it helps some times When a user share their location, below codes gives all the required data, like country,state,city,area,pin-code, latitude,longitude and many more....
code :
<!DOCTYPE html>
    <html>
      <head>
        <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
        <meta charset="utf-8">
        <title>Places Search Box</title>
        <style>
          /* Always set the map height explicitly to define the size of the div
           * element that contains the map. */
          #map {
            height: 100%;
          }
          /* Optional: Makes the sample page fill the window. */
          html, body {
            height: 100%;
            margin: 0;
            padding: 0;
          }
          #description {
            font-family: Roboto;
            font-size: 15px;
            font-weight: 300;
          }

          #infowindow-content .title {
            font-weight: bold;
          }

          #infowindow-content {
            display: none;
          }

          #map #infowindow-content {
            display: inline;
          }

          .pac-card {
            margin: 10px 10px 0 0;
            border-radius: 2px 0 0 2px;
            box-sizing: border-box;
            -moz-box-sizing: border-box;
            outline: none;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
            background-color: #fff;
            font-family: Roboto;
          }

          #pac-container {
            padding-bottom: 12px;
            margin-right: 12px;
          }

          .pac-controls {
            display: inline-block;
            padding: 5px 11px;
          }

          .pac-controls label {
            font-family: Roboto;
            font-size: 13px;
            font-weight: 300;
          }

          #pac-input {
            background-color: #fff;
            font-family: Roboto;
            font-size: 15px;
            font-weight: 300;
            margin-left: 12px;
            padding: 0 11px 0 13px;
            text-overflow: ellipsis;
            width: 400px;
          }

          #pac-input:focus {
            border-color: #4d90fe;
          }

          #title {
            color: #fff;
            background-color: #4d90fe;
            font-size: 25px;
            font-weight: 500;
            padding: 6px 12px;
          }
          #target {
            width: 345px;
          }
        </style>
      </head>
      <body>
        <input id="pac-input" class="controls" type="text" placeholder="Search Box">
        <div id="map"></div>
        <script>
          // This example adds a search box to a map, using the Google Place Autocomplete
          // feature. People can enter geographical searches. The search box will return a
          // pick list containing a mix of places and predicted search terms.

          // This example requires the Places library. Include the libraries=places
          // parameter when you first load the API. For example:
          // <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=places">

          function initAutocomplete() {
            var map = new google.maps.Map(document.getElementById('map'), {
              center: {lat: -33.8688, lng: 151.2195},
              zoom: 13,
              mapTypeId: 'roadmap'
            });

            // Create the search box and link it to the UI element.
            var input = document.getElementById('pac-input');
            var searchBox = new google.maps.places.SearchBox(input);
            map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);

            // Bias the SearchBox results towards current map's viewport.
            map.addListener('bounds_changed', function() {
              searchBox.setBounds(map.getBounds());
            });

            var markers = [];
            // Listen for the event fired when the user selects a prediction and retrieve
            // more details for that place.
            searchBox.addListener('places_changed', function() {
              var places = searchBox.getPlaces();

              if (places.length == 0) {
                return;
              }

              // Clear out the old markers.
              markers.forEach(function(marker) {
                marker.setMap(null);
              });
              markers = [];

              // For each place, get the icon, name and location.
              var bounds = new google.maps.LatLngBounds();
              places.forEach(function(place) {
                if (!place.geometry) {
                  console.log("Returned place contains no geometry");
                  return;
                }
                var icon = {
                  url: place.icon,
                  size: new google.maps.Size(71, 71),
                  origin: new google.maps.Point(0, 0),
                  anchor: new google.maps.Point(17, 34),
                  scaledSize: new google.maps.Size(25, 25)
                };

                // Create a marker for each place.
                markers.push(new google.maps.Marker({
                  map: map,
                  icon: icon,
                  title: place.name,
                  position: place.geometry.location
                }));

                if (place.geometry.viewport) {
                  // Only geocodes have viewport.
                  bounds.union(place.geometry.viewport);
                } else {
                  bounds.extend(place.geometry.location);
                }
              });
              map.fitBounds(bounds);
            });
          }

        </script>
        <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=places&callback=initAutocomplete"
             async defer></script>
      </body>
    </html>
Weather API, how to combine search parameters for more detailed location (city, state, country etc) to prevent location

Weather API, how to combine search parameters for more detailed location (city, state, country etc) to prevent location


By : Anders Hemmingsen
Date : March 29 2020, 07:55 AM
I hope this helps . If using a city doesn’t work directly there are two other options. One is using its latitude and longitude and the other is using it’s id.
Latitude/Longitude method:
Query to Retrive Country,State,City and Location from a Table?

Query to Retrive Country,State,City and Location from a Table?


By : Bouassoul badar
Date : September 24 2020, 03:00 AM
like below fixes the issue Table Design , Try JOIN
code :
    SELECT DISTINCT `[` + COT.ParentDescription +','+ ST.ParentDescription +','+ CT.ParentDescription +','+ LT.ParentDescription + `]` AS AddressList
    FROM LocationTable LT JOIN CityTable CT ON LT.ParentID = CT.OLMID AND CT.ParnetTag = 'City'
    JOIN StateTable ST ON ST.OLMID = CT.ParentID AND ST.ParnetTag = 'State'
    JOIN CountryTable COT ON COT.OLMID = ST.ParentID AND ST.ParnetTag = 'Country'
    WHERE LT.ParentDescription = 'Gopalapuram' AND LT.IsActive = 1 AND ST.IsActive = 1 AND CT.IsActive = 1 AND COT.IsActive = 1
DECLARE @Str VARCHAR(8000) 
SELECT @Str  = COALESCE(@Str   + ' ', '') + AddressList
FROM (
        SELECT DISTINCT `[` + COT.ParentDescription +','+ ST.ParentDescription +','+ CT.ParentDescription +','+ LT.ParentDescription + `]` AS AddressList
        FROM LocationTable LT JOIN CityTable CT ON LT.ParentID = CT.OLMID AND CT.ParnetTag = 'City'
        JOIN StateTable ST ON ST.OLMID = CT.ParentID AND ST.ParnetTag = 'State'
        JOIN CountryTable COT ON COT.OLMID = ST.ParentID AND ST.ParnetTag = 'Country'
        WHERE LT.IsActive = 1 AND ST.IsActive = 1 AND CT.IsActive = 1 AND COT.IsActive = 1
)X

SELECT @Str
Related Posts Related Posts :
  • Select records based on two tables where one column in one table starts with the records from another tables column usin
  • How to write select using two ids combination in Oracle 11g
  • Frequently use of 'UPDATE STATISTICS WITH FULLSCAN' is normal?
  • need query for this simple pulling data sql server
  • Sql query by using decode to show grades of employee
  • Not a single function error in Oracle
  • Oracle SQL optimizer's behavior when dealing with ORs and row-independent predicates (such as functions returning same v
  • Combining output of two or more select statement
  • Must Declare Scalar Variable Exception
  • Postgres Calculate Difference Using Window Functions
  • SQL Server : unsure how to retrieve selected records
  • SQL unique field: concurrency bugs?
  • Query to get the next identity?
  • SQL Server Adding summing values based on the month
  • Join on month if available else join on latest month
  • How to solve error: ORA-01406 fetched column value was truncated?
  • Selecting Field Multiple Times using OR
  • Which SQL datatype can be used to store mobile numbers in numeric forms, without including characters like brackets and
  • Oracle SQL - "Not a group by expression" after adding CASE statements
  • Runnning total of unique string values in column over days
  • VB.Net to AccessDB by SQL - INSERT INTO with parameters error
  • SQL/Excel/VBA - UPDATE query: 'Syntax Error (missing operator) in query expression'
  • Code to combine two sql queries
  • Setting SQL Date field value based off Week Number and Day Number Field
  • SQL query to find matching records but with differences in case sensitivity?
  • How to sort record inside views in SQL Server 2008
  • How to link the output of teradata sql query to an excel sheet?
  • Matching sets in SQL when cross-referencing
  • error even after following Microsoft format in SQL
  • Increase price by percentage, results rounded
  • Can we Use "Case" in a ColdFusion Query-of-Query
  • displaying 'Active' for a row which has 'A' as value
  • Using pattern search in SQL Server Query
  • SQL - how to group transactions for a certain date pattern?
  • How to Index SQL with multiple AND conditions nested inside OR
  • SQL rank with priority
  • Does BigQuery support SubQueries?
  • Any ideas for persisting H2 Database In-Memory mode transaction?
  • How to improve SQL query performance (correlated subqueries)?
  • Filter repeated columns in Oracle
  • SQL Server join on whichever column has value populated
  • use sql stored procedure to insert data which is returned from a query stored in a table
  • Query not working1
  • SQL - using an alias in a where clause in a subquery
  • How to search for a whole word with special char using oracle contains?
  • Production Perfomance of using SELECT * statements?
  • String concatenation not working as expected in SELECT statement
  • How to detect which stored procedures UPDATE or INSERT into a certain TABLE?
  • Select statement inside CASE - SQL
  • .Net Float error 4 - float(4) = 4.44089209850063E-16
  • How to show as column to recursive rows in a table With SQL Server
  • SQL Server error: Column name or number of supplied values does not match table definition
  • How to find a table name which's column name consist cl_
  • Cannot access existing table from WCF Code
  • SQL CREATE VIEW Error
  • Many Statement in the same transaction PLSQL
  • Tables are not joining properly in sql server 2008
  • DB2 how to sum two column from two different table
  • SQL msAccess: list unfinished courses of a student
  • SQL Server delete multiple rows
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org